diff options
author | Aki <please@ignore.pl> | 2021-08-21 16:17:05 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-08-21 16:17:05 +0200 |
commit | 4c76943de7912996cc6e380a44da9e8f3ea32503 (patch) | |
tree | 9a6da26832fa6ad3dce36e8ea139e6d6b6f0bece /buffer.c | |
parent | 6cefc948d37cd856d23caf00970ad3565672b016 (diff) | |
download | plop-4c76943de7912996cc6e380a44da9e8f3ea32503.zip plop-4c76943de7912996cc6e380a44da9e8f3ea32503.tar.gz plop-4c76943de7912996cc6e380a44da9e8f3ea32503.tar.bz2 |
Added prefix to buffer related functions
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -9,7 +9,7 @@ #include "stream.h" -void grow(lua_State * L, struct buffer * b) +void buffer_grow(lua_State * L, struct buffer * b) { int allocated = b->allocated + 1024; @@ -31,13 +31,13 @@ void grow(lua_State * L, struct buffer * b) b->allocated = allocated; } -int read_more(lua_State * L, int fd, struct buffer * in, int minimum_length, lua_KContext ctx) +int buffer_read_more(lua_State * L, int fd, struct buffer * in, int minimum_length, lua_KContext ctx) { const int free_space = in->allocated + in->offset - in->length - 1; while (free_space < minimum_length) { - grow(L, in); + buffer_grow(L, in); } if (0 < in->offset) @@ -67,19 +67,19 @@ int read_more(lua_State * L, int fd, struct buffer * in, int minimum_length, lua return length; } -int prepare_at_least(lua_State * L, int fd, struct buffer * in, int minimum_length, lua_KContext ctx) +int buffer_prepare_at_least(lua_State * L, int fd, struct buffer * in, int minimum_length, lua_KContext ctx) { const int remaining_bytes = in->length - in->next; if (remaining_bytes < minimum_length) { - return read_more(L, fd, in, minimum_length, ctx); + return buffer_read_more(L, fd, in, minimum_length, ctx); } return remaining_bytes; } -int until(struct buffer * b, const char * pattern, int pattern_length) +int buffer_until(struct buffer * b, const char * pattern, int pattern_length) { while (b->next + pattern_length <= b->length) { |