From: R. Steve McKown Date: Mon, 24 Sep 2012 14:18:34 +0000 (-0600) Subject: Remove unused code X-Git-Tag: 0.2~3 X-Git-Url: https://oss.titaniummirror.com/gitweb?p=repo_shell.git;a=commitdiff_plain;h=7f3217f5cf744b329d4e07eef2b9578c0154e87a Remove unused code --- diff --git a/repo_shell.c b/repo_shell.c index ecce7d3..f92ce6e 100644 --- a/repo_shell.c +++ b/repo_shell.c @@ -32,27 +32,7 @@ static cfg_t cfg { static cfg_t cfg; #endif -#define alloc_nr(x) (((x)+16)*3/2) - -/* - * Realloc the buffer pointed at by variable 'x' so that it can hold - * at least 'nr' entries; the number of entries currently allocated - * is 'alloc', using the standard growing factor alloc_nr() macro. - * - * DO NOT USE any expression with side-effect for 'x', 'nr', or 'alloc'. - */ -#define ALLOC_GROW(x, nr, alloc) \ - do { \ - if ((nr) > alloc) { \ - if (alloc_nr(alloc) < (nr)) \ - alloc = (nr); \ - else \ - alloc = alloc_nr(alloc); \ - x = xrealloc((x), alloc * sizeof(*(x))); \ - } \ - } while (0) - -static inline void die(const char *fmt, ...) +static void die(const char *fmt, ...) { va_list ap; @@ -84,18 +64,6 @@ void *xmalloc(size_t size) return ret; } -void *xrealloc(void *ptr, size_t size) -{ - void *ret; - - ret = realloc(ptr, size); - if (!ret && !size) - ret = realloc(ptr, 1); - if (!ret) - die("Out of memory, realloc failed"); - return ret; -} - static uid_t user_uid(char *user) { struct passwd *pw = getpwnam(user); @@ -157,6 +125,7 @@ static int git_acl(const char *user, const char *repo) * access, a return of 1 means read only, and a return of 2 means * read/write. */ +#if 0 struct passwd *pw; char *file; int len = strlen(cfg.owner) + strlen(GIT_ACL_FILE) + 8; @@ -167,8 +136,9 @@ static int git_acl(const char *user, const char *repo) len = strlen(pw->pw_dir) + strlen(GIT_ACL_FILE) + 2; file = xmalloc(sizeof(char) * len); sprintf(file, "%s/%s", pw->pw_dir, GIT_ACL_FILE); - fprintf(stderr, "[someday check %s]\n", file); + fprintf(stderr, "[someday check %s for git ACLs]\n", file); free(file); +#endif return 2; /* assume read/write for now */ }