projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* patch #3966: Create a mh_xmalloc function to prevent mistakes when
[mmh]
/
uip
/
scansbr.c
diff --git
a/uip/scansbr.c
b/uip/scansbr.c
index
be68bf8
..
b178e75
100644
(file)
--- a/
uip/scansbr.c
+++ b/
uip/scansbr.c
@@
-14,6
+14,7
@@
#include <h/fmt_scan.h>
#include <h/scansbr.h>
#include <h/tws.h>
#include <h/fmt_scan.h>
#include <h/scansbr.h>
#include <h/tws.h>
+#include <h/utils.h>
#ifdef _FSTDIO
# define _ptr _p /* Gag */
#ifdef _FSTDIO
# define _ptr _p /* Gag */
@@
-96,8
+97,7
@@
scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
width = MAXSCANL;
}
dat[3] = slwidth = width;
width = MAXSCANL;
}
dat[3] = slwidth = width;
- if ((scanl = (char *) malloc((size_t) (slwidth + 2) )) == NULL)
- adios (NULL, "unable to malloc scan line (%d bytes)", slwidth+2);
+ scanl = (char *) mh_xmalloc((size_t) (slwidth + 2) );
if (outnum)
umask(~m_gmprot());
if (outnum)
umask(~m_gmprot());
@@
-133,8
+133,7
@@
scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
used_buf += ncomps+1; *--used_buf = 0;
rlwidth = bodycomp && (width > SBUFSIZ) ? width : SBUFSIZ;
for (i = ncomps; i--; )
used_buf += ncomps+1; *--used_buf = 0;
rlwidth = bodycomp && (width > SBUFSIZ) ? width : SBUFSIZ;
for (i = ncomps; i--; )
- if ((*nxtbuf++ = malloc(rlwidth)) == NULL)
- adios (NULL, "unable to allocate component buffer");
+ *nxtbuf++ = mh_xmalloc(rlwidth);
}
/*
}
/*