diff options
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c index 094cee2..ddd1c59 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -281,7 +281,7 @@ int buffer_append_long_hex(buffer *b, unsigned long value) { return 0; } -int ltostr(char *buf, long val) { +int LI_ltostr(char *buf, long val) { char swap; char *end; int len = 1; @@ -320,7 +320,7 @@ int buffer_append_long(buffer *b, long val) { if (b->used == 0) b->used++; - b->used += ltostr(b->ptr + (b->used - 1), val); + b->used += LI_ltostr(b->ptr + (b->used - 1), val); return 0; } @@ -503,6 +503,7 @@ buffer *buffer_init_string(const char *str) { } int buffer_is_empty(buffer *b) { + if (!b) return 1; return (b->used == 0); } @@ -574,7 +575,13 @@ int buffer_caseless_compare(const char *a, size_t a_len, const char *b, size_t b } } - return 0; + /* all chars are the same, and the length match too + * + * they are the same */ + if (a_len == b_len) return 0; + + /* if a is shorter then b, then b is larger */ + return (a_len - b_len); } |