Skip to content

Commit 96cfa9d

Browse files
this time
1 parent 9c54831 commit 96cfa9d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

code/logic/json.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -845,9 +845,12 @@ fossil_media_json_get_path(const fossil_media_json_value_t *root, const char *pa
845845
char *tokenized = fossil_media_strdup(path);
846846
if (!tokenized) return NULL;
847847

848-
char *saveptr = NULL;
849-
char *tok = strtok_r(tokenized, ".", &saveptr);
848+
char *tok = tokenized;
850849
while (tok && cur) {
850+
char *next_dot = strchr(tok, '.');
851+
if (next_dot) {
852+
*next_dot = '\0';
853+
}
851854
if (cur->type == FOSSIL_MEDIA_JSON_OBJECT) {
852855
cur = fossil_media_json_object_get(cur, tok);
853856
} else if (cur->type == FOSSIL_MEDIA_JSON_ARRAY) {
@@ -863,7 +866,11 @@ fossil_media_json_get_path(const fossil_media_json_value_t *root, const char *pa
863866
fm_free(tokenized);
864867
return NULL;
865868
}
866-
tok = strtok_r(NULL, ".", &saveptr);
869+
if (next_dot) {
870+
tok = next_dot + 1;
871+
} else {
872+
tok = NULL;
873+
}
867874
}
868875
fm_free(tokenized);
869876
return (fossil_media_json_value_t *)cur;

0 commit comments

Comments
 (0)