Lines Matching refs:b
36 void buffer_free(buffer *b); /* b can be NULL */
40 void buffer_move(buffer * restrict b, buffer * restrict src);
49 char* buffer_string_prepare_copy(buffer *b, size_t size);
59 char* buffer_string_prepare_append(buffer *b, size_t size);
67 char* buffer_extend(buffer * const restrict b, size_t x);
75 void buffer_commit(buffer *b, size_t size);
83 static inline void buffer_clear(buffer *b);
93 static inline void buffer_reset(buffer *b);
100 void buffer_free_ptr(buffer *b);
102 void buffer_copy_string(buffer * restrict b, const char * restrict s);
103 void buffer_copy_string_len(buffer * restrict b, const char * restrict s, size_t len);
104 void buffer_copy_string_len_lc(buffer * restrict b, const char * restrict s, size_t len);
106 void buffer_append_string(buffer * restrict b, const char * restrict s);
107 void buffer_append_string_len(buffer * restrict b, const char * restrict s, size_t len);
108 void buffer_append_str2(buffer * restrict b, const char *s1, size_t len1, const char *s2, size_t le…
109 void buffer_append_str3(buffer * restrict b, const char *s1, size_t len1, const char *s2, size_t le…
120 void buffer_append_iovec(buffer * restrict b, const struct const_iovec *iov, size_t n);
122 #define buffer_append_uint_hex(b,len) buffer_append_uint_hex_lc((b),(len)) argument
124 void buffer_append_uint_hex_lc(buffer *b, uintmax_t len);
126 void buffer_append_int(buffer *b, intmax_t val);
128 void buffer_append_strftime(buffer * restrict b, const char * restrict format, const struct tm * re…
147 int buffer_eq_icase_ssn(const char * const a, const char * const b, const size_t len);
151 int buffer_eq_icase_ss(const char * const a, const size_t alen, const char * const b, const size_t …
155 int buffer_eq_icase_slen(const buffer * const b, const char * const s, const size_t slen);
159 int buffer_eq_slen(const buffer * const b, const char * const s, const size_t slen);
163 int buffer_is_equal(const buffer *a, const buffer *b);
166 void buffer_substr_replace (buffer * restrict b, size_t offset, size_t len, const buffer * restrict…
169 void buffer_append_string_encoded_hex_lc(buffer * restrict b, const char * restrict s, size_t len);
171 void buffer_append_string_encoded_hex_uc(buffer * restrict b, const char * restrict s, size_t len);
180 void buffer_append_string_encoded(buffer * restrict b, const char * restrict s, size_t s_len, buffe…
184 void buffer_append_string_c_escaped(buffer * restrict b, const char * restrict s, size_t s_len);
187 void buffer_append_bs_escaped (buffer * restrict b, const char * restrict s, size_t len);
188 void buffer_append_bs_escaped_json (buffer * restrict b, const char * restrict s, size_t len);
191 void buffer_urldecode_path(buffer *b);
195 int buffer_is_valid_UTF8(const buffer *b);
198 void buffer_path_simplify(buffer *b);
201 void buffer_to_lower(buffer *b);
203 void buffer_to_upper(buffer *b);
239 #define light_bshift(b) ((uint64_t)1uL << (b)) argument
240 #define light_btst(a,b) ((a) & ((uint64_t)1uL << (b))) argument
241 #define light_bclr(a,b) ((a) &= ~((uint64_t)1uL << (b))) argument
242 #define light_bset(a,b) ((a) |= ((uint64_t)1uL << (b))) argument
245 void buffer_append_path_len(buffer * restrict b, const char * restrict a, size_t alen); /* join str…
246 void buffer_copy_path_len2(buffer * restrict b, const char * restrict s1, size_t len1, const char *…
250 static inline int buffer_has_slash_suffix (const buffer * const b);
254 static inline int buffer_has_pathsep_suffix (const buffer * const b);
267 static inline int buffer_is_unset(const buffer *b);
268 static inline int buffer_is_unset(const buffer *b) { in buffer_is_unset() argument
269 return 0 == b->used; in buffer_is_unset()
274 static inline int buffer_is_blank(const buffer *b);
275 static inline int buffer_is_blank(const buffer *b) { in buffer_is_blank() argument
276 return b->used < 2; /* buffer_is_blank() || buffer_is_unset() */ in buffer_is_blank()
282 static inline uint32_t buffer_clen (const buffer *b);
283 static inline uint32_t buffer_clen (const buffer *b) { in buffer_clen() argument
284 return b->used - (0 != b->used); in buffer_clen()
290 static inline uint32_t buffer_string_space(const buffer *b);
291 static inline uint32_t buffer_string_space(const buffer *b) { in buffer_string_space() argument
292 return b->size ? b->size - (b->used | (0 == b->used)) : 0; in buffer_string_space()
296 static inline void buffer_copy_buffer(buffer * restrict b, const buffer * restrict src);
297 static inline void buffer_copy_buffer(buffer * restrict b, const buffer * restrict src) { in buffer_copy_buffer() argument
298 buffer_copy_string_len(b, BUF_PTR_LEN(src)); in buffer_copy_buffer()
302 static inline void buffer_append_buffer(buffer * restrict b, const buffer * restrict src);
303 static inline void buffer_append_buffer(buffer * restrict b, const buffer * restrict src) { in buffer_append_buffer() argument
304 buffer_append_string_len(b, BUF_PTR_LEN(src)); in buffer_append_buffer()
308 static inline void buffer_truncate(buffer *b, uint32_t len);
309 static inline void buffer_truncate(buffer *b, uint32_t len) { in buffer_truncate() argument
310 b->ptr[len] = '\0'; /* b->ptr must exist; use buffer_blank() for trunc 0 */ in buffer_truncate()
311 b->used = len + 1; in buffer_truncate()
315 static inline void buffer_blank(buffer *b);
316 static inline void buffer_blank(buffer *b) { in buffer_blank() argument
317 b->ptr ? buffer_truncate(b, 0) : (void)buffer_extend(b, 0); in buffer_blank()
321 static inline void buffer_append_char (buffer *b, char c);
322 static inline void buffer_append_char (buffer *b, char c) { in buffer_append_char() argument
323 *(buffer_extend(b, 1)) = c; in buffer_append_char()
328 static inline void buffer_append_slash(buffer *b);
329 static inline void buffer_append_slash(buffer *b) { in buffer_append_slash() argument
330 const uint32_t len = buffer_clen(b); in buffer_append_slash()
331 if (len > 0 && '/' != b->ptr[len-1]) in buffer_append_slash()
332 buffer_append_char(b, '/'); in buffer_append_slash()
335 static inline void buffer_clear(buffer *b) { in buffer_clear() argument
336 b->used = 0; in buffer_clear()
339 static inline void buffer_reset(buffer *b) { in buffer_reset() argument
340 b->used = 0; in buffer_reset()
342 if (b->size > BUFFER_MAX_REUSE_SIZE) buffer_free_ptr(b); in buffer_reset()
345 static inline int buffer_has_slash_suffix (const buffer * const b) { in buffer_has_slash_suffix() argument
346 return (b->used > 1 && b->ptr[b->used-2] == '/'); in buffer_has_slash_suffix()
349 static inline int buffer_has_pathsep_suffix (const buffer * const b) { in buffer_has_pathsep_suffix() argument
350 return (b->used > 1 && b->ptr[b->used-2] == '/'); in buffer_has_pathsep_suffix()
373 static inline int buffer_is_empty(const buffer *b);
374 static inline int buffer_is_empty(const buffer *b) { in buffer_is_empty() argument
375 return NULL == b || buffer_is_unset(b); in buffer_is_empty()
379 static inline int buffer_string_is_empty(const buffer *b);
380 static inline int buffer_string_is_empty(const buffer *b) { in buffer_string_is_empty() argument
381 return NULL == b || buffer_is_blank(b); in buffer_string_is_empty()
386 static inline uint32_t buffer_string_length(const buffer *b);
387 static inline uint32_t buffer_string_length(const buffer *b) { in buffer_string_length() argument
388 return NULL != b ? buffer_clen(b) : 0; in buffer_string_length()
398 static inline void buffer_string_set_length(buffer *b, uint32_t len);
399 static inline void buffer_string_set_length(buffer *b, uint32_t len) { in buffer_string_set_length() argument
400 if (len < b->size) in buffer_string_set_length()
401 buffer_truncate(b, len); in buffer_string_set_length()
403 buffer_extend(b, len - buffer_clen(b)); in buffer_string_set_length()