projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* mh_xmalloc(), mh_xrealloc(), pwd(): Add comments describing the purpose
[mmh]
/
uip
/
pick.c
diff --git
a/uip/pick.c
b/uip/pick.c
index
9f4bf0f
..
8cdfa58
100644
(file)
--- a/
uip/pick.c
+++ b/
uip/pick.c
@@
-12,6
+12,7
@@
#include <h/mh.h>
#include <h/tws.h>
#include <h/picksbr.h>
#include <h/mh.h>
#include <h/tws.h>
#include <h/picksbr.h>
+#include <h/utils.h>
/*
* We allocate space for messages (msgs array)
/*
* We allocate space for messages (msgs array)
@@
-103,8
+104,7
@@
main (int argc, char **argv)
*/
nummsgs = 0;
maxmsgs = MAXMSGS;
*/
nummsgs = 0;
maxmsgs = MAXMSGS;
- if (!(msgs = (char **) malloc ((size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to allocate storage");
+ msgs = (char **) mh_xmalloc ((size_t) (maxmsgs * sizeof(*msgs)));
while ((cp = *argp++)) {
if (*cp == '-') {
while ((cp = *argp++)) {
if (*cp == '-') {
@@
-199,9
+199,8
@@
main (int argc, char **argv)
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
}
msgs[nummsgs++] = cp;
}