Use ddsrt_strsep instead of ddsrt_strtok_r

The two do essentially the same think, and ddsrt_strtok_r was only used
in one place.  (Triggered by Solaris 2.6 not providing strtok_r.)

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-07-05 23:57:26 +02:00 committed by eboasson
parent 0d33462664
commit 96e09d2d4e
4 changed files with 3 additions and 66 deletions

View file

@ -2516,10 +2516,10 @@ int main(int argc, char *argv[]) {
}
break;
case 'S': {
char *copy = dds_string_dup(optarg), *tok, *lasts;
char *copy = dds_string_dup(optarg), *tok, *cursor = copy;
if (copy == NULL)
abort();
tok = ddsrt_strtok_r(copy, ",", &lasts);
tok = ddsrt_strsep(&cursor, ",");
while (tok) {
if (strcmp(tok, "pr") == 0 || strcmp(tok, "pre-read") == 0)
spec[specidx].rd.print_match_pre_read = 1;
@ -2551,7 +2551,7 @@ int main(int argc, char *argv[]) {
fprintf (stderr, "-S %s: invalid event\n", tok);
exit(2);
}
tok = ddsrt_strtok_r(NULL, ",", &lasts);
tok = ddsrt_strsep(&cursor, ",");
}
dds_free(copy);
}