version 1.1.1.1, 2012/03/08 23:40:21
|
version 1.1.1.1.2.2, 2012/03/09 10:03:21
|
Line 235 www_parseQuery(const char *str)
|
Line 235 www_parseQuery(const char *str)
|
} |
} |
|
|
free(base); |
free(base); |
return 0; | return cgi; |
} |
} |
|
|
/* |
/* |
Line 257 www_getValue(cgi_t * __restrict cgi, const char *name)
|
Line 257 www_getValue(cgi_t * __restrict cgi, const char *name)
|
|
|
SLIST_FOREACH(t, cgi, cgi_node) |
SLIST_FOREACH(t, cgi, cgi_node) |
if (t->cgi_name && !strcmp(name, t->cgi_name)) |
if (t->cgi_name && !strcmp(name, t->cgi_name)) |
break; | return t->cgi_value; |
|
|
return t->cgi_value; | return NULL; |
} |
} |
|
|
/* |
/* |
Line 307 www_addValue(cgi_t * __restrict cgi, const char *name,
|
Line 307 www_addValue(cgi_t * __restrict cgi, const char *name,
|
if (value) |
if (value) |
tmp->cgi_value = strdup(value); |
tmp->cgi_value = strdup(value); |
|
|
SLIST_INSERT_AFTER(t, tmp, cgi_node); | if (!t) |
| SLIST_INSERT_HEAD(cgi, tmp, cgi_node); |
| else |
| SLIST_INSERT_AFTER(t, tmp, cgi_node); |
return 0; |
return 0; |
} |
} |
|
|
Line 321 www_addValue(cgi_t * __restrict cgi, const char *name,
|
Line 324 www_addValue(cgi_t * __restrict cgi, const char *name,
|
int |
int |
www_delPair(cgi_t * __restrict cgi, const char *name) |
www_delPair(cgi_t * __restrict cgi, const char *name) |
{ |
{ |
struct tagCGI *t; | struct tagCGI *t, *tmp; |
|
|
if (!cgi || !name) { |
if (!cgi || !name) { |
www_SetErr(EINVAL, "Invalid argument(s)"); |
www_SetErr(EINVAL, "Invalid argument(s)"); |
Line 329 www_delPair(cgi_t * __restrict cgi, const char *name)
|
Line 332 www_delPair(cgi_t * __restrict cgi, const char *name)
|
} |
} |
|
|
/* search for delete */ |
/* search for delete */ |
SLIST_FOREACH(t, cgi, cgi_node) | SLIST_FOREACH_SAFE(t, cgi, cgi_node, tmp) |
if (t->cgi_name && !strcmp(name, t->cgi_name)) { |
if (t->cgi_name && !strcmp(name, t->cgi_name)) { |
SLIST_REMOVE(cgi, t, tagCGI, cgi_node); |
SLIST_REMOVE(cgi, t, tagCGI, cgi_node); |
|
|
|
if (t->cgi_name) |
|
free(t->cgi_name); |
|
if (t->cgi_value) |
|
free(t->cgi_value); |
|
free(t); |
return 1; |
return 1; |
} |
} |
|
|