X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/81a21a9a97d8633f6d6231e31fdb6e328d0d3ff2..4d57f81eef643ecd34082dc872557b6b4b6ec241:/sbr/brkstring.c?ds=inline diff --git a/sbr/brkstring.c b/sbr/brkstring.c index 255abf74..8b577dbe 100644 --- a/sbr/brkstring.c +++ b/sbr/brkstring.c @@ -1,10 +1,6 @@ - -/* - * brkstring.c -- (destructively) split a string into +/* brkstring.c -- (destructively) split a string into * -- an array of substrings * - * $Id$ - * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. @@ -48,8 +44,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)) @@ -62,7 +57,7 @@ brkstring (char *str, char *brksep, char *brkterm) if (!c || brkany (c, brkterm)) { *s = '\0'; broken[i] = NULL; - return broken; + break; } /* set next start addr */ @@ -72,7 +67,7 @@ brkstring (char *str, char *brksep, char *brkterm) ; /* empty body */ } - return broken; /* NOT REACHED */ + return broken; }