diff options
author | Vincent Labrecque <vincent@cvs.openbsd.org> | 2002-06-19 22:05:59 +0000 |
---|---|---|
committer | Vincent Labrecque <vincent@cvs.openbsd.org> | 2002-06-19 22:05:59 +0000 |
commit | 7eb89df76b15037d09789fce0ef4ee5647b9de3f (patch) | |
tree | 45b7731cbd7fd3a427e0b2b1080871921ae8567f /usr.bin/mg | |
parent | 369dac595f557a7860e1fba5afd10ec3fc8002e8 (diff) |
initialize some undo-related variables.
ok deraadt@
Diffstat (limited to 'usr.bin/mg')
-rw-r--r-- | usr.bin/mg/buffer.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c index de84e267a18..dbb226e7ee8 100644 --- a/usr.bin/mg/buffer.c +++ b/usr.bin/mg/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.28 2002/03/16 19:30:29 vincent Exp $ */ +/* $OpenBSD: buffer.c,v 1.29 2002/06/19 22:05:58 vincent Exp $ */ /* * Buffer handling. @@ -441,19 +441,19 @@ bfind(const char *bname, int cflag) } if (cflag != TRUE) return NULL; - /* NOSTRICT */ - if ((bp = (BUFFER *) malloc(sizeof(BUFFER))) == NULL) { + + if ((bp = malloc(sizeof(BUFFER))) == NULL) { ewprintf("Can't get %d bytes", sizeof(BUFFER)); return NULL; } if ((bp->b_bname = strdup(bname)) == NULL) { ewprintf("Can't get %d bytes", strlen(bname) + 1); - free((char *) bp); + free(bp); return NULL; } if ((lp = lalloc(0)) == NULL) { free((char *) bp->b_bname); - free((char *) bp); + free(bp); return NULL; } bp->b_altb = bp->b_bufp = NULL; @@ -466,6 +466,8 @@ bfind(const char *bname, int cflag) bp->b_linep = lp; bp->b_nmodes = defb_nmodes; LIST_INIT(&bp->b_undo); + bp->b_undoptr = NULL; + memset(&bp->b_undopos, 0, sizeof bp->b_undopos); i = 0; do { bp->b_modes[i] = defb_modes[i]; |