summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2008-06-27 18:21:56 +0200
committerJunio C Hamano <gitster@pobox.com>2008-06-30 22:45:50 -0700
commitfbca58373291afa07c5b30ab562d36ce0f6174e0 (patch)
treeda36ce421480e799cec1624b8ea30ff56ef95ad9 /git-compat-util.h
parent653194758ee338b7c87d011007c532ed5cf68d45 (diff)
downloadgit-fbca58373291afa07c5b30ab562d36ce0f6174e0.tar.gz
Move parse-options's skip_prefix() to git-compat-util.h
builtin-remote.c and parse-options.c both have a skip_prefix() function, for the same purpose. Move parse-options's one to git-compat-util.h and let builtin-remote use it as well. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 6f94a8197f..31edc98f30 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -127,6 +127,12 @@ extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
extern int prefixcmp(const char *str, const char *prefix);
+static inline const char *skip_prefix(const char *str, const char *prefix)
+{
+ size_t len = strlen(prefix);
+ return strncmp(str, prefix, len) ? NULL : str + len;
+}
+
#ifdef NO_MMAP
#ifndef PROT_READ