summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-01-03 09:23:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-01-03 09:23:12 (GMT)
commit698a68be7b0df6dd8d0880e0e2167cad8688a6ad (patch)
tree8cb9dc608f12b52288524e4f20c59faa1d131157 /git-compat-util.h
parent257f3020f69f3222cdefc1d84b148fb35b2c4f5b (diff)
downloadgit-698a68be7b0df6dd8d0880e0e2167cad8688a6ad.zip
git-698a68be7b0df6dd8d0880e0e2167cad8688a6ad.tar.gz
git-698a68be7b0df6dd8d0880e0e2167cad8688a6ad.tar.bz2
Uninline prefixcmp()
Now the routine is an open-coded loop that avoids an extra strlen() in the previous implementation, it got a bit too big to be inlined. Uninlining it makes code footprint smaller but the result still retains the avoidance of strlen() cost. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 7059cbd..b6ef544 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -122,6 +122,8 @@ extern void set_die_routine(void (*routine)(const char *err, va_list params) NOR
extern void set_error_routine(void (*routine)(const char *err, va_list params));
extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
+extern int prefixcmp(const char *str, const char *prefix);
+
#ifdef NO_MMAP
#ifndef PROT_READ
@@ -396,15 +398,6 @@ static inline int sane_case(int x, int high)
return x;
}
-static inline int prefixcmp(const char *str, const char *prefix)
-{
- for (; ; str++, prefix++)
- if (!*prefix)
- return 0;
- else if (*str != *prefix)
- return (unsigned char)*prefix - (unsigned char)*str;
-}
-
static inline int strtoul_ui(char const *s, int base, unsigned int *result)
{
unsigned long ul;