rm: reuse strbuf for all remove_dir_recursively() calls
[gitweb.git] / config.c
index e7f42da18bccbc6902a6fa8be21501f77a1bc1af..03544e7a3f68f858e2fed5492a4460bd05b75602 100644 (file)
--- a/config.c
+++ b/config.c
@@ -1831,10 +1831,10 @@ int git_config_set_in_file_gently(const char *config_filename,
        return git_config_set_multivar_in_file_gently(config_filename, key, value, NULL, 0);
 }
 
-void git_config_set_in_file_or_die(const char *config_filename,
-                       const char *key, const char *value)
+void git_config_set_in_file(const char *config_filename,
+                           const char *key, const char *value)
 {
-       git_config_set_multivar_in_file_or_die(config_filename, key, value, NULL, 0);
+       git_config_set_multivar_in_file(config_filename, key, value, NULL, 0);
 }
 
 int git_config_set_gently(const char *key, const char *value)
@@ -1842,9 +1842,9 @@ int git_config_set_gently(const char *key, const char *value)
        return git_config_set_multivar_gently(key, value, NULL, 0);
 }
 
-void git_config_set_or_die(const char *key, const char *value)
+void git_config_set(const char *key, const char *value)
 {
-       git_config_set_multivar_or_die(key, value, NULL, 0);
+       git_config_set_multivar(key, value, NULL, 0);
 }
 
 /*
@@ -1889,7 +1889,7 @@ static int git_config_parse_key_1(const char *key, char **store_key, int *basele
         * Validate the key and while at it, lower case it for matching.
         */
        if (store_key)
-               *store_key = xmalloc(strlen(key) + 1);
+               *store_key = xmallocz(strlen(key));
 
        dot = 0;
        for (i = 0; key[i]; i++) {
@@ -1913,8 +1913,6 @@ static int git_config_parse_key_1(const char *key, char **store_key, int *basele
                if (store_key)
                        (*store_key)[i] = c;
        }
-       if (store_key)
-               (*store_key)[i] = 0;
 
        return 0;
 
@@ -2191,9 +2189,9 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
 
 }
 
-void git_config_set_multivar_in_file_or_die(const char *config_filename,
-                               const char *key, const char *value,
-                               const char *value_regex, int multi_replace)
+void git_config_set_multivar_in_file(const char *config_filename,
+                                    const char *key, const char *value,
+                                    const char *value_regex, int multi_replace)
 {
        if (git_config_set_multivar_in_file_gently(config_filename, key, value,
                                                   value_regex, multi_replace) < 0)
@@ -2207,11 +2205,11 @@ int git_config_set_multivar_gently(const char *key, const char *value,
                                                      multi_replace);
 }
 
-void git_config_set_multivar_or_die(const char *key, const char *value,
-                       const char *value_regex, int multi_replace)
+void git_config_set_multivar(const char *key, const char *value,
+                            const char *value_regex, int multi_replace)
 {
-       git_config_set_multivar_in_file_or_die(NULL, key, value, value_regex,
-                                              multi_replace);
+       git_config_set_multivar_in_file(NULL, key, value, value_regex,
+                                       multi_replace);
 }
 
 static int section_name_match (const char *buf, const char *name)