projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removed ignored -verbose (and -noverbose) options to mhstore.
[mmh]
/
sbr
/
brkstring.c
diff --git
a/sbr/brkstring.c
b/sbr/brkstring.c
index
68c7b70
..
32dd37f
100644
(file)
--- a/
sbr/brkstring.c
+++ b/
sbr/brkstring.c
@@
-46,7
+46,7
@@
brkstring(char *str, char *brksep, char *brkterm)
}
/* handle separators */
}
/* handle separators */
- while (strchr(brksep, c = *s)) {
+ while ((c=*s) && brksep && strchr(brksep, c)) {
*s++ = '\0';
}
*s++ = '\0';
}
@@
-54,7
+54,7
@@
brkstring(char *str, char *brksep, char *brkterm)
** we are either at the end of the string, or the
** terminator found has been found, so finish up.
*/
** we are either at the end of the string, or the
** terminator found has been found, so finish up.
*/
- if (!c || strchr(brkterm, c)) {
+ if (!c || (brkterm && strchr(brkterm, c))) {
*s = '\0';
broken[i] = NULL;
return broken;
*s = '\0';
broken[i] = NULL;
return broken;
@@
-62,8
+62,13
@@
brkstring(char *str, char *brksep, char *brkterm)
/* set next start addr and walk over word */
broken[i] = s;
/* set next start addr and walk over word */
broken[i] = s;
- while ((c=*++s) && !strchr(brksep, c) && !strchr(brkterm, c)) {
- continue;
+ while ((c = *++s)) {
+ if (brksep && strchr(brksep, c)) {
+ break;
+ }
+ if (brkterm && strchr(brkterm, c)) {
+ break;
+ }
}
}
adios("brkstring()", "reached unreachable point");
}
}
adios("brkstring()", "reached unreachable point");