X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/blobdiff_plain/26f325c05cf0aa292589458b5c1aa8b5f5ab92ba..a4589237d33eb5ed0858371a668f652651f4bcda:/buf.c diff --git a/buf.c b/buf.c index 3dc4996..3223d90 100644 --- a/buf.c +++ b/buf.c @@ -222,7 +222,7 @@ static int findz(buf *b, size_t *nn) { octet *p; - if ((p = memchr(BCUR(b), 0, BLEN(b))) == 0) { + if ((p = memchr(BCUR(b), 0, BLEFT(b))) == 0) { buf_break(b); return (-1); } @@ -246,7 +246,7 @@ static int findz(buf *b, size_t *nn) void *buf_getmem##w(buf *b, size_t *nn) \ { \ uint##n sz; \ - if (buf_getu##n(b, &sz)) return (0); \ + if (buf_getu##w(b, &sz)) return (0); \ *nn = sz; \ return (buf_get(b, sz)); \ } @@ -275,7 +275,7 @@ void *buf_getmemz(buf *b, size_t *nn) int buf_putmem##w(buf *b, const void *p, size_t sz) \ { \ assert(sz <= MASK##W); \ - if (buf_putu##n(b, sz) || buf_put(b, p, sz)) \ + if (buf_putu##w(b, sz) || buf_put(b, p, sz)) \ return (-1); \ return (0); \ }