chiark
/
gitweb
/
~mdw
/
mLib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bug fix: handle a disable during a close-induced flush without dumping
[mLib]
/
lbuf.c
diff --git
a/lbuf.c
b/lbuf.c
index 9c0ec229d96c8b20afff38a6ae185ca498e219ea..8b930763d34016a31ead58ad95a39b1fd2de318f 100644
(file)
--- a/
lbuf.c
+++ b/
lbuf.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-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
*
*
* Block-to-line buffering
*
@@
-30,6
+30,10
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: lbuf.c,v $
/*----- 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.
*
* Revision 1.4 2000/06/17 10:38:14 mdw
* Add support for variable buffer sizes.
*
@@
-87,6
+91,11
@@
void lbuf_flush(lbuf *b, char *p, size_t len)
char *base; /* Base address of current line */
int cr; /* Carriage return state */
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) {
/* --- Initialize variables as necessary --- */
if (!p) {
@@
-192,6
+201,7
@@
void lbuf_close(lbuf *b)
x_free(b->a, b->buf);
b->buf = 0;
}
x_free(b->a, b->buf);
b->buf = 0;
}
+ b->f |= LBUF_CLOSE;
if (b->f & LBUF_ENABLE)
b->func(0, b->p);
}
if (b->f & LBUF_ENABLE)
b->func(0, b->p);
}