127 |
void st_bare_pad_len_copy (char *dest, const char *src, size_t n, size_t len); |
void st_bare_pad_len_copy (char *dest, const char *src, size_t n, size_t len); |
128 |
void st_pad_copy (char *dest, const char *src, size_t n); |
void st_pad_copy (char *dest, const char *src, size_t n); |
129 |
|
|
130 |
/* Lengthed strings. */ |
/* Fixed-length strings. */ |
131 |
struct len_string |
struct fixed_string |
132 |
{ |
{ |
133 |
char *string; |
char *string; |
134 |
size_t length; |
size_t length; |
135 |
}; |
}; |
136 |
|
|
137 |
void ls_create (struct len_string *, const char *); |
void ls_create (struct fixed_string *, const char *); |
138 |
void ls_create_buffer (struct len_string *, |
void ls_create_buffer (struct fixed_string *, |
139 |
const char *, size_t len); |
const char *, size_t len); |
140 |
void ls_init (struct len_string *, const char *, size_t); |
void ls_init (struct fixed_string *, const char *, size_t); |
141 |
void ls_shallow_copy (struct len_string *, const struct len_string *); |
void ls_shallow_copy (struct fixed_string *, const struct fixed_string *); |
142 |
void ls_destroy (struct len_string *); |
void ls_destroy (struct fixed_string *); |
143 |
|
|
144 |
void ls_null (struct len_string *); |
void ls_null (struct fixed_string *); |
145 |
int ls_null_p (const struct len_string *); |
int ls_null_p (const struct fixed_string *); |
146 |
int ls_empty_p (const struct len_string *); |
int ls_empty_p (const struct fixed_string *); |
147 |
|
|
148 |
size_t ls_length (const struct len_string *); |
size_t ls_length (const struct fixed_string *); |
149 |
char *ls_c_str (const struct len_string *); |
char *ls_c_str (const struct fixed_string *); |
150 |
char *ls_end (const struct len_string *); |
char *ls_end (const struct fixed_string *); |
151 |
|
|
152 |
#if __GNUC__ > 1 |
#if __GNUC__ > 1 |
153 |
extern inline size_t |
extern inline size_t |
154 |
ls_length (const struct len_string *st) |
ls_length (const struct fixed_string *st) |
155 |
{ |
{ |
156 |
return st->length; |
return st->length; |
157 |
} |
} |
158 |
|
|
159 |
extern inline char * |
extern inline char * |
160 |
ls_c_str (const struct len_string *st) |
ls_c_str (const struct fixed_string *st) |
161 |
{ |
{ |
162 |
return st->string; |
return st->string; |
163 |
} |
} |
164 |
|
|
165 |
extern inline char * |
extern inline char * |
166 |
ls_end (const struct len_string *st) |
ls_end (const struct fixed_string *st) |
167 |
{ |
{ |
168 |
return st->string + st->length; |
return st->string + st->length; |
169 |
} |
} |
170 |
#endif |
#endif |
171 |
|
|
172 |
/* Dynamic strings. */ |
/* Variable length strings. */ |
173 |
|
|
174 |
struct string |
struct string |
175 |
{ |
{ |