mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2024-09-29 04:25:57 -04:00
Update: Added a (still unused) next member to the http_var_t structure
This commit is contained in:
parent
09fb1ce137
commit
0117b90aa6
@ -491,8 +491,10 @@ void httpp_deletevar(http_parser_t *parser, const char *name)
|
|||||||
|
|
||||||
if (parser == NULL || name == NULL)
|
if (parser == NULL || name == NULL)
|
||||||
return;
|
return;
|
||||||
|
memset(&var, 0, sizeof(var));
|
||||||
|
|
||||||
var.name = (char*)name;
|
var.name = (char*)name;
|
||||||
var.value = NULL;
|
|
||||||
avl_delete(parser->vars, (void *)&var, _free_vars);
|
avl_delete(parser->vars, (void *)&var, _free_vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,7 +505,7 @@ void httpp_setvar(http_parser_t *parser, const char *name, const char *value)
|
|||||||
if (name == NULL || value == NULL)
|
if (name == NULL || value == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var = (http_var_t *)malloc(sizeof(http_var_t));
|
var = (http_var_t *)calloc(1, sizeof(http_var_t));
|
||||||
if (var == NULL) return;
|
if (var == NULL) return;
|
||||||
|
|
||||||
var->name = strdup(name);
|
var->name = strdup(name);
|
||||||
@ -527,8 +529,8 @@ const char *httpp_getvar(http_parser_t *parser, const char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
fp = &found;
|
fp = &found;
|
||||||
|
memset(&var, 0, sizeof(var));
|
||||||
var.name = (char*)name;
|
var.name = (char*)name;
|
||||||
var.value = NULL;
|
|
||||||
|
|
||||||
if (avl_get_by_key(parser->vars, &var, fp) == 0)
|
if (avl_get_by_key(parser->vars, &var, fp) == 0)
|
||||||
return found->value;
|
return found->value;
|
||||||
@ -543,7 +545,7 @@ static void _httpp_set_param_nocopy(avl_tree *tree, char *name, char *value)
|
|||||||
if (name == NULL || value == NULL)
|
if (name == NULL || value == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var = (http_var_t *)malloc(sizeof(http_var_t));
|
var = (http_var_t *)calloc(1, sizeof(http_var_t));
|
||||||
if (var == NULL) return;
|
if (var == NULL) return;
|
||||||
|
|
||||||
var->name = name;
|
var->name = name;
|
||||||
@ -572,8 +574,8 @@ static const char *_httpp_get_param(avl_tree *tree, const char *name)
|
|||||||
void *fp;
|
void *fp;
|
||||||
|
|
||||||
fp = &found;
|
fp = &found;
|
||||||
|
memset(&var, 0, sizeof(var));
|
||||||
var.name = (char *)name;
|
var.name = (char *)name;
|
||||||
var.value = NULL;
|
|
||||||
|
|
||||||
if (avl_get_by_key(tree, (void *)&var, fp) == 0)
|
if (avl_get_by_key(tree, (void *)&var, fp) == 0)
|
||||||
return found->value;
|
return found->value;
|
||||||
@ -650,15 +652,20 @@ static int _compare_vars(void *compare_arg, void *a, void *b)
|
|||||||
|
|
||||||
static int _free_vars(void *key)
|
static int _free_vars(void *key)
|
||||||
{
|
{
|
||||||
http_var_t *var;
|
http_var_t *var, *next;
|
||||||
|
|
||||||
var = (http_var_t *)key;
|
next = (http_var_t *)key;
|
||||||
|
|
||||||
if (var->name)
|
while (next) {
|
||||||
free(var->name);
|
var = next;
|
||||||
if (var->value)
|
next = var->next;
|
||||||
free(var->value);
|
|
||||||
free(var);
|
if (var->name)
|
||||||
|
free(var->name);
|
||||||
|
if (var->value)
|
||||||
|
free(var->value);
|
||||||
|
free(var);
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -61,10 +61,12 @@ typedef enum httpp_request_type_tag {
|
|||||||
httpp_req_unknown
|
httpp_req_unknown
|
||||||
} httpp_request_type_e;
|
} httpp_request_type_e;
|
||||||
|
|
||||||
typedef struct http_var_tag {
|
typedef struct http_var_tag http_var_t;
|
||||||
|
struct http_var_tag {
|
||||||
char *name;
|
char *name;
|
||||||
char *value;
|
char *value;
|
||||||
} http_var_t;
|
http_var_t *next;
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct http_varlist_tag {
|
typedef struct http_varlist_tag {
|
||||||
http_var_t var;
|
http_var_t var;
|
||||||
|
Loading…
Reference in New Issue
Block a user