]> git.proxmox.com Git - libgit2.git/commitdiff
config: make cvar_free behave more like other free functions
authorCarlos Martín Nieto <cmn@elego.de>
Thu, 7 Apr 2011 09:24:16 +0000 (11:24 +0200)
committerCarlos Martín Nieto <cmn@elego.de>
Thu, 7 Apr 2011 15:15:38 +0000 (17:15 +0200)
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>
src/config.c

index d537fd8a5225a1c1c2e2eac2fbc65d4c656a53ce..5f0bcd880ecc4c96631bec5d978ccf96a9756f8c 100644 (file)
@@ -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)