chiark
/
gitweb
/
~mdw
/
mLib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
buf: Fix two embarassing bugs found while writing Lisp bindings.
[mLib]
/
buf.c
diff --git
a/buf.c
b/buf.c
index 3dc49964be5074df782dce1d6a7089e277e96675..3223d9070b93c04fd3f265e14b83b9b0aa85879b 100644
(file)
--- a/
buf.c
+++ b/
buf.c
@@
-222,7
+222,7
@@
static int findz(buf *b, size_t *nn)
{
octet *p;
{
octet *p;
- if ((p = memchr(BCUR(b), 0, BLE
N
(b))) == 0) {
+ if ((p = memchr(BCUR(b), 0, BLE
FT
(b))) == 0) {
buf_break(b);
return (-1);
}
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; \
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)); \
}
*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); \
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); \
}
return (-1); \
return (0); \
}