X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/6c42153ad9362cc676ea66563bf400d7511b3b68..1524cb8c0b86a854149d7859d6a2503d61dbaa36:/sbr/brkstring.c diff --git a/sbr/brkstring.c b/sbr/brkstring.c index 27f187e2..d2f71aa3 100644 --- a/sbr/brkstring.c +++ b/sbr/brkstring.c @@ -11,6 +11,7 @@ */ #include +#include /* allocate this number of pointers at a time */ #define NUMBROKEN 256 @@ -33,8 +34,7 @@ brkstring (char *str, char *brksep, char *brkterm) /* allocate initial space for pointers on first call */ if (!broken) { len = NUMBROKEN; - if (!(broken = (char **) malloc ((size_t) (len * sizeof(*broken))))) - adios (NULL, "unable to malloc array in brkstring"); + broken = (char **) mh_xmalloc ((size_t) (len * sizeof(*broken))); } /* @@ -48,8 +48,7 @@ brkstring (char *str, char *brksep, char *brkterm) /* enlarge pointer array, if necessary */ if (i >= len) { len += NUMBROKEN; - if (!(broken = realloc (broken, (size_t) (len * sizeof(*broken))))) - adios (NULL, "unable to realloc array in brkstring"); + broken = mh_xrealloc (broken, (size_t) (len * sizeof(*broken))); } while (brkany (c = *s, brksep))