core.
/* -*-c-*-
*
- * $Id: lbuf.c,v 1.4 2000/06/17 10:38:14 mdw Exp $
+ * $Id: lbuf.c,v 1.5 2001/02/03 16:23:33 mdw Exp $
*
* Block-to-line buffering
*
/*----- Revision history --------------------------------------------------*
*
* $Log: lbuf.c,v $
+ * Revision 1.5 2001/02/03 16:23:33 mdw
+ * Bug fix: handle a disable during a close-induced flush without dumping
+ * core.
+ *
* Revision 1.4 2000/06/17 10:38:14 mdw
* Add support for variable buffer sizes.
*
char *base; /* Base address of current line */
int cr; /* Carriage return state */
+ if (b->f & LBUF_CLOSE) {
+ b->func(0, b->p);
+ return;
+ }
+
/* --- Initialize variables as necessary --- */
if (!p) {
x_free(b->a, b->buf);
b->buf = 0;
}
+ b->f |= LBUF_CLOSE;
if (b->f & LBUF_ENABLE)
b->func(0, b->p);
}
/* -*-c-*-
*
- * $Id: lbuf.h,v 1.5 2001/01/20 12:06:01 mdw Exp $
+ * $Id: lbuf.h,v 1.6 2001/02/03 16:23:33 mdw Exp $
*
* Block-to-line buffering
*
/*----- Revision history --------------------------------------------------*
*
* $Log: lbuf.h,v $
+ * Revision 1.6 2001/02/03 16:23:33 mdw
+ * Bug fix: handle a disable during a close-induced flush without dumping
+ * core.
+ *
* Revision 1.5 2001/01/20 12:06:01 mdw
* Define flags with macros, to ensure unsignedness.
*
#define LBUF_CR 1u /* Read a carriage return */
#define LBUF_ENABLE 2u /* Buffer is currently enabled */
+#define LBUF_CLOSE 4u /* Buffer is now closed */
/*----- Functions provided ------------------------------------------------*/
/* -*-c-*-
*
- * $Id: pkbuf.c,v 1.3 2000/07/16 18:55:45 mdw Exp $
+ * $Id: pkbuf.c,v 1.4 2001/02/03 16:23:33 mdw Exp $
*
* Simple packet buffering
*
/*----- Revision history --------------------------------------------------*
*
* $Log: pkbuf.c,v $
+ * Revision 1.4 2001/02/03 16:23:33 mdw
+ * Bug fix: handle a disable during a close-induced flush without dumping
+ * core.
+ *
* Revision 1.3 2000/07/16 18:55:45 mdw
* Remove some stray debugging code.
*
size_t l;
size_t keep;
+ if (pk->f & PKBUF_CLOSE) {
+ pk->func(0, 0, pk, 0, pk->p);
+ return;
+ }
+
/* --- Initialize variables as necessary --- */
if (!p) {
x_free(pk->a, pk->buf);
pk->buf = 0;
}
+ pk->f |= PKBUF_CLOSE;
if (pk->f & PKBUF_ENABLE)
pk->func(0, 0, pk, 0, pk->p);
}
/* -*-c-*-
*
- * $Id: pkbuf.h,v 1.2 2001/01/20 12:06:01 mdw Exp $
+ * $Id: pkbuf.h,v 1.3 2001/02/03 16:23:33 mdw Exp $
*
* Simple packet buffering
*
/*----- Revision history --------------------------------------------------*
*
* $Log: pkbuf.h,v $
+ * Revision 1.3 2001/02/03 16:23:33 mdw
+ * Bug fix: handle a disable during a close-induced flush without dumping
+ * core.
+ *
* Revision 1.2 2001/01/20 12:06:01 mdw
* Define flags with macros, to ensure unsignedness.
*
} pkbuf;
#define PKBUF_ENABLE 1u /* Buffer is currently enabled */
+#define PKBUF_CLOSE 2u /* Buffer is now closed */
/*----- Functions provided ------------------------------------------------*/