Browse Source

[core] perf: inline buffer_append_string_buffer()

personal/stbuehler/fix-fdevent
Glenn Strauss 4 years ago
parent
commit
5fe9339942
  1. 8
      src/buffer.c
  2. 6
      src/buffer.h

8
src/buffer.c

@ -233,14 +233,6 @@ void buffer_append_string_len(buffer *b, const char *s, size_t s_len) {
b->used += s_len;
}
void buffer_append_string_buffer(buffer *b, const buffer *src) {
if (NULL == src) {
buffer_append_string_len(b, NULL, 0);
} else {
buffer_append_string_len(b, src->ptr, buffer_string_length(src));
}
}
void buffer_append_uint_hex_lc(buffer *b, uintmax_t value) {
char *buf;
unsigned int shift = 0;

6
src/buffer.h

@ -71,7 +71,7 @@ void buffer_copy_buffer(buffer *b, const buffer *src);
void buffer_append_string(buffer *b, const char *s);
void buffer_append_string_len(buffer *b, const char *s, size_t s_len);
void buffer_append_string_buffer(buffer *b, const buffer *src);
static inline void buffer_append_string_buffer(buffer *b, const buffer *src);
#define buffer_append_uint_hex(b,len) buffer_append_uint_hex_lc((b),(len))
void buffer_append_uint_hex_lc(buffer *b, uintmax_t len);
@ -199,6 +199,10 @@ static inline size_t buffer_string_space(const buffer *b) {
return b->size - b->used;
}
static inline void buffer_append_string_buffer(buffer *b, const buffer *src) {
buffer_append_string_len(b, CONST_BUF_LEN(src));
}
static inline void buffer_append_slash(buffer *b) {
size_t len = buffer_string_length(b);
if (len > 0 && '/' != b->ptr[len-1]) BUFFER_APPEND_STRING_CONST(b, "/");

Loading…
Cancel
Save