summaryrefslogtreecommitdiff
path: root/src/config_file.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-06-07 22:49:13 +0200
committerCarlos Martín Nieto <cmn@elego.de>2011-06-08 00:12:26 +0200
commit5ab50417b7d51fff1c88158f0f334f42bfb5a9b7 (patch)
tree7780682985508aad955c646a2f8b8c2bf6718796 /src/config_file.c
parent340fc0d40ac03680d6f7964bc47f8c8d7fbbc57c (diff)
downloadlibgit2-5ab50417b7d51fff1c88158f0f334f42bfb5a9b7.tar.gz
Remove an unfortunate optimisation from cvar_match_section
The (rather late) early-exit code, which provides a negligible optimisation causes cvar_match_section to return false negatives when it's called with a section name instead of a full variable name. Remove this optimisation. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Diffstat (limited to 'src/config_file.c')
-rw-r--r--src/config_file.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/config_file.c b/src/config_file.c
index d76c6024d..74162d74f 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -130,7 +130,7 @@ static void cvar_list_free(cvar_t_list *list)
*/
static int cvar_match_section(const char *local, const char *input)
{
- char *first_dot, *last_dot;
+ char *first_dot;
char *local_sp = strchr(local, ' ');
int comparison_len;
@@ -159,12 +159,8 @@ static int cvar_match_section(const char *local, const char *input)
*/
first_dot = strchr(input, '.');
- last_dot = strrchr(input, '.');
comparison_len = strlen(local_sp + 2) - 1;
- if (last_dot == first_dot || last_dot - first_dot - 1 != comparison_len)
- return 0;
-
return !strncmp(local_sp + 2, first_dot + 1, comparison_len);
}