forked from latticeware/Cytoplasm
Fixes #33. Co-authored-by: LoaD Accumulator <lda@freetards.xyz> Reviewed-on: Telodendria/telodendria#35 Co-authored-by: LoaD Accumulator <lda@noreply.git.telodendria.io> Co-committed-by: LoaD Accumulator <lda@noreply.git.telodendria.io>
This commit is contained in:
parent
a19ebea78f
commit
9c4c3fc899
2 changed files with 6 additions and 3 deletions
|
@ -196,7 +196,7 @@ HttpRouterRoute(HttpRouter * router, char *path, void *args, void **ret)
|
||||||
char *pathPart;
|
char *pathPart;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
HttpRouteFunc *exec = NULL;
|
HttpRouteFunc *exec = NULL;
|
||||||
Array *matches;
|
Array *matches = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
@ -254,14 +254,18 @@ HttpRouterRoute(HttpRouter * router, char *path, void *args, void **ret)
|
||||||
{
|
{
|
||||||
/* pmatch[0] is the whole string, not the first
|
/* pmatch[0] is the whole string, not the first
|
||||||
* subexpression */
|
* subexpression */
|
||||||
|
char * substr;
|
||||||
|
regmatch_t cpmatch;
|
||||||
for (i = 1; i < REG_MAX_SUB; i++)
|
for (i = 1; i < REG_MAX_SUB; i++)
|
||||||
{
|
{
|
||||||
|
cpmatch = pmatch[i];
|
||||||
|
substr = StrSubstr(pathPart, cpmatch.rm_so, cpmatch.rm_eo);
|
||||||
if (pmatch[i].rm_so == -1)
|
if (pmatch[i].rm_so == -1)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayAdd(matches, StrSubstr(pathPart, pmatch[i].rm_so, pmatch[i].rm_eo));
|
ArrayAdd(matches, substr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,6 @@ StrSubstr(const char *inStr, size_t start, size_t end)
|
||||||
}
|
}
|
||||||
|
|
||||||
len = end - start;
|
len = end - start;
|
||||||
|
|
||||||
outStr = Malloc(len + 1);
|
outStr = Malloc(len + 1);
|
||||||
if (!outStr)
|
if (!outStr)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue