X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/177f020f122827214159c46dcfe7ded1e3c8d1c3..0813132987677a8b0cf3b4d0e8bf851657deeadd:/sbr/brkstring.c diff --git a/sbr/brkstring.c b/sbr/brkstring.c index 8b577dbe..8f1c297f 100644 --- a/sbr/brkstring.c +++ b/sbr/brkstring.c @@ -6,8 +6,9 @@ * complete copyright information. */ -#include -#include +#include "h/mh.h" +#include "brkstring.h" +#include "h/utils.h" /* allocate this number of pointers at a time */ #define NUMBROKEN 256 @@ -30,7 +31,7 @@ brkstring (char *str, char *brksep, char *brkterm) /* allocate initial space for pointers on first call */ if (!broken) { len = NUMBROKEN; - broken = (char **) mh_xmalloc ((size_t) (len * sizeof(*broken))); + broken = mh_xmalloc ((size_t) (len * sizeof(*broken))); } /* @@ -79,12 +80,5 @@ brkstring (char *str, char *brksep, char *brkterm) static int brkany (char c, char *str) { - char *s; - - if (str) { - for (s = str; *s; s++) - if (c == *s) - return 1; - } - return 0; + return str && c && strchr(str, c); }