X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fgbuf.h;h=1f5e68fa1f83abed3a4ea4c0776a2c9d6e60f650;hb=bc5f818d21b7aceaf2c0e263b00aa4295211d8f9;hp=4e01556805ee08f28217da453b988d2c7163b0f6;hpb=6912c77a66798de162fe31f79581cd7b5c97f12c;p=libucw.git diff --git a/ucw/gbuf.h b/ucw/gbuf.h index 4e015568..1f5e68fa 100644 --- a/ucw/gbuf.h +++ b/ucw/gbuf.h @@ -27,7 +27,7 @@ * length of available memory. **/ typedef struct BUF_T { - uint 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, uint 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, uint 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, uint len) * any more) by * <>. **/ -static inline GBUF_TYPE *GBUF_PREFIX(grow)(BUF_T *b, uint 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);