Vegetable Buffer for Simple C

I need an open lightweight (preferably MIT-licensed) lightweight growing buffer implemented in simple C (preferably also compiled as C ++).

I need an API equivalent to the following (pseudocode):

  • void set_allocator(buffer * buf, allocator_Fn fn);
  • void push_bytes(buffer * buf, const char * bytes, size_t len);
  • size_t get_length(buffer * buf);
  • void overwrite_autogrow(buffer * buf, size_t offset, const char * bytes, size_t len);
  • const char * to_string(buffer * buf);

Implementation should be clean and self-contained.

overwrite_autogrowwrites lenfrom bytesto a given offset with a growing buffer as necessary (as it does push_bytes).

The ability to install a distributor is optional, but preferable to have one.

Does anyone know something close to what I want?

Or, at least, any implementations that you should pay attention to when implementing my own?

+3
source share
2

VPOOL ( BSD)

http://www.bsdua.org/libbsdua.html#vpool

Vpool - ( ). , , , ..

+3

http://library.gnome.org/devel/glib/stable/glib-Arrays.html

, overwrite_autogrow, , , . ? , g_array_set_size.

, , LGPL. , MIT .

0

Source: https://habr.com/ru/post/1732736/


All Articles