commit f187864c100b4cb1364e4dfcefc571098bbd979f from: Omar Polo date: Wed Apr 17 10:22:42 2024 UTC rename buf_write to buf_append reduce the confusion with bufio_write() which does different things, and makes calling it clearer. commit - 917841c04564edfc3aa914617f46177362ab90b7 commit + f187864c100b4cb1364e4dfcefc571098bbd979f blob - 424516bc75c38f21feafbd73cdcc6c5b22799fd1 blob + 5d5feabf444f8db8fb1600076dd975bd0525e748 --- web/bufio.c +++ web/bufio.c @@ -68,7 +68,7 @@ buf_grow(struct buf *buf) } int -buf_write(struct buf *buf, const void *d, size_t len) +buf_append(struct buf *buf, const void *d, size_t len) { while (buf->len + len > buf->cap) { if (buf_grow(buf) == -1) blob - 257a931f662a9d92b602a0b41305198f2ced784c blob + 929c9ee3f474f46eaeaaee2eed3057c92a8637d0 --- web/bufio.h +++ web/bufio.h @@ -50,7 +50,7 @@ struct bufio { #define BUFIO_WANT_WRITE 0x2 int buf_init(struct buf *); -int buf_write(struct buf *, const void *, size_t); +int buf_append(struct buf *, const void *, size_t); int buf_has_line(struct buf *, const char *); char *buf_getdelim(struct buf *, const char *, size_t *); void buf_drain(struct buf *, size_t); blob - b24bd2f26157718c7e62a92aea5c2ae4fbfe148a blob + ada02b17d64929123ec3dfd516d63b48a94645c1 --- web/http.c +++ web/http.c @@ -202,7 +202,7 @@ http_read(struct client *clt) return -1; } - buf_write(rbuf, "", 1); /* append a NUL byte */ + buf_append(rbuf, "", 1); while (rbuf->len > 0 && (rbuf->buf[rbuf->len - 1] == '\r' || (rbuf->buf[rbuf->len - 1] == '\n'))) rbuf->buf[--rbuf->len] = '\0';