X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=ucw%2Fgbuf.h;h=1f5e68fa1f83abed3a4ea4c0776a2c9d6e60f650;hb=bc5f818d21b7aceaf2c0e263b00aa4295211d8f9;hp=4bcbe27dc6edcf24f46e8235a42ea5711ffbb849;hpb=a4fe009d3366b0a3e119713b0ecc7fc0070efdfa;p=libucw.git diff --git a/ucw/gbuf.h b/ucw/gbuf.h index 4bcbe27d..1f5e68fa 100644 --- a/ucw/gbuf.h +++ b/ucw/gbuf.h @@ -27,7 +27,7 @@ * length of available memory. **/ typedef struct BUF_T { - uns len; + size_t len; GBUF_TYPE *ptr; } BUF_T; @@ -60,16 +60,16 @@ static void UNUSED GBUF_PREFIX(done)(BUF_T *b) * Use <> * for growing. **/ -static void UNUSED GBUF_PREFIX(set_size)(BUF_T *b, uns len) +static void UNUSED GBUF_PREFIX(set_size)(BUF_T *b, size_t len) { b->len = len; b->ptr = xrealloc(b->ptr, len * sizeof(GBUF_TYPE)); #ifdef GBUF_TRACE - GBUF_TRACE(STRINGIFY_EXPANDED(BUF_T) " growing to %u items", len); + GBUF_TRACE(STRINGIFY_EXPANDED(BUF_T) " growing to %zu items", len); #endif } -static void UNUSED GBUF_PREFIX(do_grow)(BUF_T *b, uns len) +static void UNUSED GBUF_PREFIX(do_grow)(BUF_T *b, size_t len) { if (len < 2*b->len) // to ensure logarithmic cost len = 2*b->len; @@ -85,7 +85,7 @@ static void UNUSED GBUF_PREFIX(do_grow)(BUF_T *b, uns len) * any more) by * <>. **/ -static inline GBUF_TYPE *GBUF_PREFIX(grow)(BUF_T *b, uns len) +static inline GBUF_TYPE *GBUF_PREFIX(grow)(BUF_T *b, size_t len) { if (unlikely(len > b->len)) GBUF_PREFIX(do_grow)(b, len);