path: root/setup.c
diff options
authorDmitry Ivankov <>2011-08-11 09:15:38 (GMT)
committerJunio C Hamano <>2011-08-11 19:18:02 (GMT)
commit068762846634dff73a18d71188736e0ded03a1cc (patch)
tree2baf7a0df7d044ff88549364417f35574f46c410 /setup.c
parent1f275b7c4caebf8ca5c002458f0f1b7994548a97 (diff)
Reduce parse-options.o dependencies
Currently parse-options.o pulls quite a big bunch of dependencies. his complicates it's usage in contrib/ because it pulls external dependencies and it also increases executables size. Split off less generic and more internal to git part of parse-options.c to parse-options-cb.c. Move prefix_filename function from setup.c to abspath.c. abspath.o and wrapper.o pull each other, so it's unlikely to increase the dependencies. It was a dependency of parse-options.o that pulled many others. Now parse-options.o pulls just abspath.o, ctype.o, strbuf.o, usage.o, wrapper.o, libc directly and strlcpy.o indirectly. Signed-off-by: Dmitry Ivankov <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'setup.c')
1 files changed, 0 insertions, 28 deletions
diff --git a/setup.c b/setup.c
index 5ea5502..3463819 100644
--- a/setup.c
+++ b/setup.c
@@ -40,34 +40,6 @@ char *prefix_path(const char *prefix, int len, const char *path)
return sanitized;
- * Unlike prefix_path, this should be used if the named file does
- * not have to interact with index entry; i.e. name of a random file
- * on the filesystem.
- */
-const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
- static char path[PATH_MAX];
-#ifndef WIN32
- if (!pfx_len || is_absolute_path(arg))
- return arg;
- memcpy(path, pfx, pfx_len);
- strcpy(path + pfx_len, arg);
- char *p;
- /* don't add prefix to absolute paths, but still replace '\' by '/' */
- if (is_absolute_path(arg))
- pfx_len = 0;
- else if (pfx_len)
- memcpy(path, pfx, pfx_len);
- strcpy(path + pfx_len, arg);
- for (p = path + pfx_len; *p; p++)
- if (*p == '\\')
- *p = '/';
- return path;
int check_filename(const char *prefix, const char *arg)
const char *name;