From: mdw Date: Mon, 17 May 1999 20:36:50 +0000 (+0000) Subject: Make the magical constants for the buffer flags uppercase. X-Git-Tag: 2.0.4~317 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/commitdiff_plain/1ef7279c324e278ecf75243ca651710db9ac708e Make the magical constants for the buffer flags uppercase. --- diff --git a/lbuf.c b/lbuf.c index b81136f..63eb447 100644 --- a/lbuf.c +++ b/lbuf.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: lbuf.c,v 1.1 1999/05/14 21:01:14 mdw Exp $ + * $Id: lbuf.c,v 1.2 1999/05/17 20:36:08 mdw Exp $ * * Block-to-line buffering * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: lbuf.c,v $ + * Revision 1.2 1999/05/17 20:36:08 mdw + * Make the magical constants for the buffer flags uppercase. + * * Revision 1.1 1999/05/14 21:01:14 mdw * Integrated `select' handling bits from the background resolver project. * @@ -82,7 +85,7 @@ void lbuf_flush(lbuf *b, char *p, size_t len) cr = 0; len = b->len; } else - cr = b->f & lbuf_cr; + cr = b->f & LBUF_CR; l = p + len; @@ -132,7 +135,7 @@ void lbuf_flush(lbuf *b, char *p, size_t len) else *q = 0; b->func(base, b->p); - if (!(b->f & lbuf_enable)) { + if (!(b->f & LBUF_ENABLE)) { base = q + 1; break; } @@ -152,9 +155,9 @@ void lbuf_flush(lbuf *b, char *p, size_t len) memmove(b->buf, base, len); b->len = len; if (cr) - b->f |= lbuf_cr; + b->f |= LBUF_CR; else - b->f &= ~lbuf_cr; + b->f &= ~LBUF_CR; } } @@ -176,7 +179,7 @@ void lbuf_close(lbuf *b) b->buf[b->len] = 0; b->func(b->buf, b->p); } - if (b->f & lbuf_enable) + if (b->f & LBUF_ENABLE) b->func(0, b->p); } @@ -263,7 +266,7 @@ void lbuf_init(lbuf *b, b->func = func; b->p = p; b->len = 0; - b->f = lbuf_enable; + b->f = LBUF_ENABLE; } /*----- That's all, folks -------------------------------------------------*/ diff --git a/lbuf.h b/lbuf.h index 7772885..9543d08 100644 --- a/lbuf.h +++ b/lbuf.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: lbuf.h,v 1.1 1999/05/14 21:01:14 mdw Exp $ + * $Id: lbuf.h,v 1.2 1999/05/17 20:36:08 mdw Exp $ * * Block-to-line buffering * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: lbuf.h,v $ + * Revision 1.2 1999/05/17 20:36:08 mdw + * Make the magical constants for the buffer flags uppercase. + * * Revision 1.1 1999/05/14 21:01:14 mdw * Integrated `select' handling bits from the background resolver project. * @@ -105,8 +108,8 @@ typedef struct lbuf { } lbuf; enum { - lbuf_cr = 1, /* Read a carriage return */ - lbuf_enable = 2 /* Buffer is currently enabled */ + LBUF_CR = 1, /* Read a carriage return */ + LBUF_ENABLE = 2 /* Buffer is currently enabled */ }; /*----- Functions provided ------------------------------------------------*/ diff --git a/selbuf.c b/selbuf.c index 0f07dfc..aafe711 100644 --- a/selbuf.c +++ b/selbuf.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: selbuf.c,v 1.1 1999/05/14 21:01:15 mdw Exp $ + * $Id: selbuf.c,v 1.2 1999/05/17 20:36:50 mdw Exp $ * * Line-buffering select handler * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: selbuf.c,v $ + * Revision 1.2 1999/05/17 20:36:50 mdw + * Make the magical constants for the buffer flags uppercase. + * * Revision 1.1 1999/05/14 21:01:15 mdw * Integrated `select' handling bits from the background resolver project. * @@ -64,8 +67,8 @@ void selbuf_enable(selbuf *b) { - if (!(b->b.f & lbuf_enable)) { - b->b.f |= lbuf_enable; + if (!(b->b.f & LBUF_ENABLE)) { + b->b.f |= LBUF_ENABLE; sel_addfile(&b->reader); lbuf_flush(&b->b, 0, 0); } @@ -83,8 +86,8 @@ void selbuf_enable(selbuf *b) void selbuf_disable(selbuf *b) { - if (b->b.f & lbuf_enable) { - b->b.f &= ~lbuf_enable; + if (b->b.f & LBUF_ENABLE) { + b->b.f &= ~LBUF_ENABLE; sel_rmfile(&b->reader); } } @@ -147,7 +150,7 @@ void selbuf_init(selbuf *b, void *p) { lbuf_init(&b->b, func, p); - b->b.f &= ~lbuf_enable; + b->b.f &= ~LBUF_ENABLE; sel_initfile(s, &b->reader, fd, SEL_READ, selbuf_read, b); selbuf_enable(b); }