ELinks 0.16.1.1
|
String handling functions. More...
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include "elinks.h"
#include "util/conv.h"
#include "util/error.h"
#include "util/memdebug.h"
#include "util/memory.h"
#include "util/snprintf.h"
Macros | |
#define | _GNU_SOURCE /* XXX: fseeko, ftello */ |
#define | string_assert(f, l, x, o) |
#define | strlcmp_device(c, s1, n1, s2, n2, t1, t2) |
Functions | |
char * | debug_memacpy (const char *f, int l, const char *src, int len) |
char * | debug_stracpy (const char *f, int l, const char *src) |
void | add_to_strn (char **dst, const char *src) |
Concatenates src to str. | |
char * | insert_in_string (char **dst, int pos, const char *seq, int seqlen) |
Inserts seqlen chars from seq at position pos in the dst string. | |
char * | straconcat (const char *str,...) |
Takes a list of strings where the last parameter must be (char *) NULL and concatenates them. | |
int | xstrcmp (const char *s1, const char *s2) |
Compare two strings, handling correctly s1 or s2 being NULL. | |
char * | safe_strncpy (char *dst, const char *src, size_t dst_size) |
Copies at most len chars into dst. | |
int | elinks_strlcmp (const char *s1, size_t n1, const char *s2, size_t n2) |
int | elinks_strlcasecmp (const char *s1, size_t n1, const char *s2, size_t n2, const int locale_indep) |
char * | elinks_strlcasestr (const char *haystack, const int haystackl, const char *needle, const int needlel) |
int | c_strcasecmp (const char *s1, const char *s2) |
int | c_strncasecmp (const char *s1, const char *s2, size_t n) |
char * | c_strcasestr (const char *haystack, const char *needle) |
NONSTATIC_INLINE struct string * | init_string__ (const char *file, int line, struct string *string) |
NONSTATIC_INLINE void | done_string (struct string *string) |
struct string * | string_concat (struct string *string,...) |
NONSTATIC_INLINE struct string * | add_xchar_to_string (struct string *string, unsigned char character, int times) |
struct string * | add_format_to_string (struct string *string, const char *format,...) |
Add printf()-style format string to string. | |
void | string_replace (struct string *res, struct string *inp, struct string *what, struct string *repl) |
struct string * | add_to_string_list (struct string_list_item list *list, const char *source, int length) |
String handling functions.
#define string_assert | ( | f, | |
l, | |||
x, | |||
o ) |
#define strlcmp_device | ( | c, | |
s1, | |||
n1, | |||
s2, | |||
n2, | |||
t1, | |||
t2 ) |
Add printf()-style format string to string.
|
void add_to_strn | ( | char ** | str, |
const char * | src ) |
Concatenates src to str.
If reallocation of str fails str is not touched.
|
int c_strcasecmp | ( | const char * | s1, |
const char * | s2 ) |
char * c_strcasestr | ( | const char * | haystack, |
const char * | needle ) |
int c_strncasecmp | ( | const char * | s1, |
const char * | s2, | ||
size_t | n ) |
char * debug_memacpy | ( | const char * | f, |
int | l, | ||
const char * | src, | ||
int | len ) |
char * debug_stracpy | ( | const char * | f, |
int | l, | ||
const char * | src ) |
|
int elinks_strlcasecmp | ( | const char * | s1, |
size_t | n1, | ||
const char * | s2, | ||
size_t | n2, | ||
const int | locale_indep ) |
char * elinks_strlcasestr | ( | const char * | haystack, |
const int | haystackl, | ||
const char * | needle, | ||
const int | needlel ) |
int elinks_strlcmp | ( | const char * | s1, |
size_t | n1, | ||
const char * | s2, | ||
size_t | n2 ) |
NONSTATIC_INLINE struct string * init_string__ | ( | const char * | file, |
int | line, | ||
struct string * | string ) |
char * insert_in_string | ( | char ** | dst, |
int | pos, | ||
const char * | seq, | ||
int | seqlen ) |
Inserts seqlen chars from seq at position pos in the dst string.
If reallocation of dst fails it is not touched and NULL is returned.
char * safe_strncpy | ( | char * | dst, |
const char * | src, | ||
size_t | len ) |
Copies at most len chars into dst.
Ensures null termination of dst.
char * straconcat | ( | const char * | str, |
... ) |
Takes a list of strings where the last parameter must be (char *) NULL and concatenates them.
Example:
void string_replace | ( | struct string * | res, |
struct string * | inp, | ||
struct string * | what, | ||
struct string * | repl ) |
int xstrcmp | ( | const char * | s1, |
const char * | s2 ) |
Compare two strings, handling correctly s1 or s2 being NULL.