version 1.1, 1995/10/18 08:45:41 |
version 1.2, 1996/04/21 23:43:17 |
|
|
/* $NetBSD: buf.c,v 1.6 1995/06/14 15:18:51 christos Exp $ */ |
/* $NetBSD: buf.c,v 1.7 1996/03/29 02:17:13 jtc Exp $ */ |
|
|
/* |
/* |
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
|
|
#if 0 |
#if 0 |
static char sccsid[] = "@(#)buf.c 5.5 (Berkeley) 12/28/90"; |
static char sccsid[] = "@(#)buf.c 5.5 (Berkeley) 12/28/90"; |
#else |
#else |
static char rcsid[] = "$NetBSD: buf.c,v 1.6 1995/06/14 15:18:51 christos Exp $"; |
static char rcsid[] = "$NetBSD: buf.c,v 1.7 1996/03/29 02:17:13 jtc Exp $"; |
#endif |
#endif |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
|
|
#define BufExpand(bp,nb) \ |
#define BufExpand(bp,nb) \ |
if (bp->left < (nb)+1) {\ |
if (bp->left < (nb)+1) {\ |
int newSize = (bp)->size + max((nb)+1,BUF_ADD_INC); \ |
int newSize = (bp)->size + max((nb)+1,BUF_ADD_INC); \ |
Byte *newBuf = (Byte *) realloc((bp)->buffer, newSize); \ |
Byte *newBuf = (Byte *) erealloc((bp)->buffer, newSize); \ |
\ |
\ |
(bp)->inPtr = newBuf + ((bp)->inPtr - (bp)->buffer); \ |
(bp)->inPtr = newBuf + ((bp)->inPtr - (bp)->buffer); \ |
(bp)->outPtr = newBuf + ((bp)->outPtr - (bp)->buffer);\ |
(bp)->outPtr = newBuf + ((bp)->outPtr - (bp)->buffer);\ |