Commit 493384e3 by Carlos Martín Nieto

config: make cvar_free behave more like other free functions

Make cvar_free return void instad of the next element, as it was
mostly a hack to make cvar_list_free shorter but it's now using the
list macros.

Also check if the input is NULL and return immediately in that case.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
parent 6b45cb8a
......@@ -37,15 +37,14 @@ static int config_parse(git_config *cfg_file);
static int parse_variable(git_config *cfg, char **var_name, char **var_value);
void git_config_free(git_config *cfg);
static git_cvar *cvar_free(git_cvar *var)
static void cvar_free(git_cvar *var)
{
git_cvar *next = var->next;
if (var == NULL)
return;
free(var->name);
free(var->value);
free(var);
return next;
}
static void cvar_list_free(git_cvar_list *list)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment