confgen

Config parser generator
git clone git://git.finwo.net/app/confgen
Log | Files | Refs | LICENSE

buffer.h (648B)


      1 #ifndef __Loh3Ain3_CONFGEN_BUFFER_H__
      2 #define __Loh3Ain3_CONFGEN_BUFFER_H__
      3 
      4 #ifdef __cplusplus
      5 extern "C" {
      6 #endif
      7 
      8 #include <stddef.h>
      9 
     10 struct confgen_buffer {
     11   char *alloc;
     12   char *dat;
     13   size_t len;
     14   size_t cap;
     15 };
     16 
     17 /**
     18  * Append <length> bytes to the data in the buffer
     19  * Copies the data, does not mutate the source
     20  */
     21 void confgen_buffer_append(struct confgen_buffer *subject, const char *source, size_t length);
     22 
     23 /**
     24  * Remove <length> bytes from the front of the buffer
     25  */
     26 size_t confgen_buffer_consume(struct confgen_buffer *subject, size_t length);
     27 
     28 #ifdef __cplusplus
     29 } // extern "C"
     30 #endif
     31 
     32 #endif // __Loh3Ain3_CONFGEN_BUFFER_H__