aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.c
diff options
context:
space:
mode:
authorChristian Hesse2014-05-29 17:35:46 +0200
committerJason A. Donenfeld2014-06-28 15:14:56 +0200
commit79c985e13c10b498c3ea62f4607c2e2a460c3b10 (patch)
treed06ca41cfe2ebb5ff80ae747e38aeaad35734e35 /cgit.c
parentb431282c91deea24916578395d88084261410968 (diff)
downloadcgit-79c985e13c10b498c3ea62f4607c2e2a460c3b10.tar.gz
cgit-79c985e13c10b498c3ea62f4607c2e2a460c3b10.tar.bz2
cgit-79c985e13c10b498c3ea62f4607c2e2a460c3b10.zip
git: update for git 2.0
prefixcmp() and suffixcmp() have been remove, functionality is now provided by starts_with() and ends_with(). Retrurn values have been changed, so instead of just renaming we have to fix logic. Everything else looks just fine.
Diffstat (limited to 'cgit.c')
-rw-r--r--cgit.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/cgit.c b/cgit.c
index f488ebf..20f6e27 100644
--- a/cgit.c
+++ b/cgit.c
@@ -69,7 +69,7 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va
69 repo->max_stats = cgit_find_stats_period(value, NULL); 69 repo->max_stats = cgit_find_stats_period(value, NULL);
70 else if (!strcmp(name, "module-link")) 70 else if (!strcmp(name, "module-link"))
71 repo->module_link= xstrdup(value); 71 repo->module_link= xstrdup(value);
72 else if (!prefixcmp(name, "module-link.")) { 72 else if (starts_with(name, "module-link.")) {
73 item = string_list_append(&repo->submodules, xstrdup(name + 12)); 73 item = string_list_append(&repo->submodules, xstrdup(name + 12));
74 item->util = xstrdup(value); 74 item->util = xstrdup(value);
75 } else if (!strcmp(name, "section")) 75 } else if (!strcmp(name, "section"))
@@ -102,7 +102,7 @@ static void config_cb(const char *name, const char *value)
102 ctx.repo = cgit_add_repo(value); 102 ctx.repo = cgit_add_repo(value);
103 else if (ctx.repo && !strcmp(name, "repo.path")) 103 else if (ctx.repo && !strcmp(name, "repo.path"))
104 ctx.repo->path = trim_end(value, '/'); 104 ctx.repo->path = trim_end(value, '/');
105 else if (ctx.repo && !prefixcmp(name, "repo.")) 105 else if (ctx.repo && starts_with(name, "repo."))
106 repo_config(ctx.repo, name + 5, value); 106 repo_config(ctx.repo, name + 5, value);
107 else if (!strcmp(name, "readme") && value != NULL) 107 else if (!strcmp(name, "readme") && value != NULL)
108 string_list_append(&ctx.cfg.readme, xstrdup(value)); 108 string_list_append(&ctx.cfg.readme, xstrdup(value));
@@ -264,7 +264,7 @@ static void config_cb(const char *name, const char *value)
264 ctx.cfg.branch_sort = 1; 264 ctx.cfg.branch_sort = 1;
265 if (!strcmp(value, "name")) 265 if (!strcmp(value, "name"))
266 ctx.cfg.branch_sort = 0; 266 ctx.cfg.branch_sort = 0;
267 } else if (!prefixcmp(name, "mimetype.")) 267 } else if (starts_with(name, "mimetype."))
268 add_mimetype(name + 9, value); 268 add_mimetype(name + 9, value);
269 else if (!strcmp(name, "include")) 269 else if (!strcmp(name, "include"))
270 parse_configfile(expand_macros(value), config_cb); 270 parse_configfile(expand_macros(value), config_cb);
@@ -454,7 +454,7 @@ static char *guess_defbranch(void)
454 unsigned char sha1[20]; 454 unsigned char sha1[20];
455 455
456 ref = resolve_ref_unsafe("HEAD", sha1, 0, NULL); 456 ref = resolve_ref_unsafe("HEAD", sha1, 0, NULL);
457 if (!ref || prefixcmp(ref, "refs/heads/")) 457 if (!ref || !starts_with(ref, "refs/heads/"))
458 return "master"; 458 return "master";
459 return xstrdup(ref + 11); 459 return xstrdup(ref + 11);
460} 460}
@@ -941,28 +941,28 @@ static void cgit_parse_args(int argc, const char **argv)
941 941
942 exit(0); 942 exit(0);
943 } 943 }
944 if (!prefixcmp(argv[i], "--cache=")) { 944 if (starts_with(argv[i], "--cache=")) {
945 ctx.cfg.cache_root = xstrdup(argv[i] + 8); 945 ctx.cfg.cache_root = xstrdup(argv[i] + 8);
946 } else if (!strcmp(argv[i], "--nocache")) { 946 } else if (!strcmp(argv[i], "--nocache")) {
947 ctx.cfg.nocache = 1; 947 ctx.cfg.nocache = 1;
948 } else if (!strcmp(argv[i], "--nohttp")) { 948 } else if (!strcmp(argv[i], "--nohttp")) {
949 ctx.env.no_http = "1"; 949 ctx.env.no_http = "1";
950 } else if (!prefixcmp(argv[i], "--query=")) { 950 } else if (starts_with(argv[i], "--query=")) {
951 ctx.qry.raw = xstrdup(argv[i] + 8); 951 ctx.qry.raw = xstrdup(argv[i] + 8);
952 } else if (!prefixcmp(argv[i], "--repo=")) { 952 } else if (starts_with(argv[i], "--repo=")) {
953 ctx.qry.repo = xstrdup(argv[i] + 7); 953 ctx.qry.repo = xstrdup(argv[i] + 7);
954 } else if (!prefixcmp(argv[i], "--page=")) { 954 } else if (starts_with(argv[i], "--page=")) {
955 ctx.qry.page = xstrdup(argv[i] + 7); 955 ctx.qry.page = xstrdup(argv[i] + 7);
956 } else if (!prefixcmp(argv[i], "--head=")) { 956 } else if (starts_with(argv[i], "--head=")) {
957 ctx.qry.head = xstrdup(argv[i] + 7); 957 ctx.qry.head = xstrdup(argv[i] + 7);
958 ctx.qry.has_symref = 1; 958 ctx.qry.has_symref = 1;
959 } else if (!prefixcmp(argv[i], "--sha1=")) { 959 } else if (starts_with(argv[i], "--sha1=")) {
960 ctx.qry.sha1 = xstrdup(argv[i] + 7); 960 ctx.qry.sha1 = xstrdup(argv[i] + 7);
961 ctx.qry.has_sha1 = 1; 961 ctx.qry.has_sha1 = 1;
962 } else if (!prefixcmp(argv[i], "--ofs=")) { 962 } else if (starts_with(argv[i], "--ofs=")) {
963 ctx.qry.ofs = atoi(argv[i] + 6); 963 ctx.qry.ofs = atoi(argv[i] + 6);
964 } else if (!prefixcmp(argv[i], "--scan-tree=") || 964 } else if (starts_with(argv[i], "--scan-tree=") ||
965 !prefixcmp(argv[i], "--scan-path=")) { 965 starts_with(argv[i], "--scan-path=")) {
966 /* 966 /*
967 * HACK: The global snapshot bit mask defines the set 967 * HACK: The global snapshot bit mask defines the set
968 * of allowed snapshot formats, but the config file 968 * of allowed snapshot formats, but the config file