diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-07-09 11:33:27 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-07-09 11:33:28 -0700 |
commit | e91ae32a01ffe294b8510c1d8cd7138493a0712f (patch) | |
tree | 461b9dacf6c1e8adf5f59251af093dc7c407091f /http-backend.c | |
parent | line-log: use commit_list_append() instead of duplicating its code (diff) | |
parent | http-push: refactor parsing of remote object names (diff) | |
download | tgif-e91ae32a01ffe294b8510c1d8cd7138493a0712f.tar.xz |
Merge branch 'jk/skip-prefix'
* jk/skip-prefix:
http-push: refactor parsing of remote object names
imap-send: use skip_prefix instead of using magic numbers
use skip_prefix to avoid repeated calculations
git: avoid magic number with skip_prefix
fetch-pack: refactor parsing in get_ack
fast-import: refactor parsing of spaces
stat_opt: check extra strlen call
daemon: use skip_prefix to avoid magic numbers
fast-import: use skip_prefix for parsing input
use skip_prefix to avoid repeating strings
use skip_prefix to avoid magic numbers
transport-helper: avoid reading past end-of-string
fast-import: fix read of uninitialized argv memory
apply: use skip_prefix instead of raw addition
refactor skip_prefix to return a boolean
avoid using skip_prefix as a boolean
daemon: mark some strings as const
parse_diff_color_slot: drop ofs parameter
Diffstat (limited to 'http-backend.c')
-rw-r--r-- | http-backend.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/http-backend.c b/http-backend.c index d2c0a625ce..57290d9bda 100644 --- a/http-backend.c +++ b/http-backend.c @@ -221,17 +221,19 @@ static void get_idx_file(char *name) static int http_config(const char *var, const char *value, void *cb) { + const char *p; + if (!strcmp(var, "http.getanyfile")) { getanyfile = git_config_bool(var, value); return 0; } - if (starts_with(var, "http.")) { + if (skip_prefix(var, "http.", &p)) { int i; for (i = 0; i < ARRAY_SIZE(rpc_service); i++) { struct rpc_service *svc = &rpc_service[i]; - if (!strcmp(var + 5, svc->config_name)) { + if (!strcmp(p, svc->config_name)) { svc->enabled = git_config_bool(var, value); return 0; } @@ -244,15 +246,16 @@ static int http_config(const char *var, const char *value, void *cb) static struct rpc_service *select_service(const char *name) { + const char *svc_name; struct rpc_service *svc = NULL; int i; - if (!starts_with(name, "git-")) + if (!skip_prefix(name, "git-", &svc_name)) forbidden("Unsupported service: '%s'", name); for (i = 0; i < ARRAY_SIZE(rpc_service); i++) { struct rpc_service *s = &rpc_service[i]; - if (!strcmp(s->name, name + 4)) { + if (!strcmp(s->name, svc_name)) { svc = s; break; } |