|
|
@ -23,11 +23,11 @@ int rpd_url_parse(rpd_url *dest, const char *src) |
|
|
|
|
|
|
|
|
|
|
|
i = 0; |
|
|
|
i = 0; |
|
|
|
char *tmp, *token; |
|
|
|
char *tmp, *token; |
|
|
|
tmp = strdup(src); |
|
|
|
tmp = rpd_strdup(src); |
|
|
|
while ((token = strsep(&tmp, "/"))) { |
|
|
|
while ((token = rpd_strsep(&tmp, "/"))) { |
|
|
|
if (!strlen(token)) |
|
|
|
if (!strlen(token)) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
dest->parts[i] = strdup(token); |
|
|
|
dest->parts[i] = rpd_strdup(token); |
|
|
|
i++; |
|
|
|
i++; |
|
|
|
} |
|
|
|
} |
|
|
|
free(tmp); |
|
|
|
free(tmp); |
|
|
@ -65,7 +65,7 @@ int rpd_url_params_parse_keys(rpd_keyval *dest, const rpd_url *tpl) |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < tpl->parts_len; i++) { |
|
|
|
for (int i = 0; i < tpl->parts_len; i++) { |
|
|
|
if (*tpl->parts[i] == ':') { |
|
|
|
if (*tpl->parts[i] == ':') { |
|
|
|
dest->items[dest->size].key = strdup(tpl->parts[i] + 1); |
|
|
|
dest->items[dest->size].key = rpd_strdup(tpl->parts[i] + 1); |
|
|
|
dest->size++; |
|
|
|
dest->size++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -78,7 +78,7 @@ int rpd_url_params_parse_vals(rpd_keyval *dest, const rpd_url *url, const rpd_ur |
|
|
|
int i = 0, j = 0; |
|
|
|
int i = 0, j = 0; |
|
|
|
while (i < tpl->parts_len) { |
|
|
|
while (i < tpl->parts_len) { |
|
|
|
if (*tpl->parts[i] == ':') { |
|
|
|
if (*tpl->parts[i] == ':') { |
|
|
|
dest->items[j++].val = strdup(url->parts[i]); |
|
|
|
dest->items[j++].val = rpd_strdup(url->parts[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
i++; |
|
|
|
i++; |
|
|
|
} |
|
|
|
} |
|
|
|