Code

Optimize read_repo_config_option to reduce string comparisons
authorJonas Fonseca <fonseca@diku.dk>
Mon, 9 Feb 2009 00:54:41 +0000 (01:54 +0100)
committerJonas Fonseca <fonseca@diku.dk>
Mon, 9 Feb 2009 00:54:41 +0000 (01:54 +0100)
tig.c

diff --git a/tig.c b/tig.c
index b1804aa41e47874a803b818ef9f87067b76cd6b4..9537208ccb62199aa6ee4fe20b0aefec498ca3b1 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -6716,10 +6716,10 @@ read_repo_config_option(char *name, size_t namelen, char *value, size_t valuelen
        if (!strcmp(name, "i18n.commitencoding"))
                string_ncopy(opt_encoding, value, valuelen);
 
-       if (!strcmp(name, "core.editor"))
+       else if (!strcmp(name, "core.editor"))
                string_ncopy(opt_editor, value, valuelen);
 
-       if (!prefixcmp(name, "tig.color."))
+       else if (!prefixcmp(name, "tig.color."))
                set_repo_config_option(name + 10, value, option_color_command);
 
        else if (!prefixcmp(name, "tig.bind."))