summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 309be81)
raw | patch | inline | side by side (parent: 309be81)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Thu, 11 Nov 2010 14:08:03 +0000 (21:08 +0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 7 Dec 2010 22:25:46 +0000 (14:25 -0800) |
prefix_path() allocates new buffer. There's no reason for it to keep
the buffer for itself and waste memory.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
the buffer for itself and waste memory.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h | patch | blob | history | |
setup.c | patch | blob | history |
index 222d9cf3a746b86de37d0a04fb22d784d2739d8e..bd181c6e78b3e1d6ff5fa49ae8cc0d82eb4774db 100644 (file)
--- a/cache.h
+++ b/cache.h
extern void setup_work_tree(void);
extern const char *setup_git_directory_gently(int *);
extern const char *setup_git_directory(void);
-extern const char *prefix_path(const char *prefix, int len, const char *path);
+extern char *prefix_path(const char *prefix, int len, const char *path);
extern const char *prefix_filename(const char *prefix, int len, const char *path);
extern int check_filename(const char *prefix, const char *name);
extern void verify_filename(const char *prefix, const char *name);
index 833db12bc4591c97f66998da96b23de48d319603..f930dc09631f454a2d268dc03beb6eaeb960b142 100644 (file)
--- a/setup.c
+++ b/setup.c
static int inside_git_dir = -1;
static int inside_work_tree = -1;
-const char *prefix_path(const char *prefix, int len, const char *path)
+char *prefix_path(const char *prefix, int len, const char *path)
{
const char *orig = path;
char *sanitized = xmalloc(len + strlen(path) + 1);