@matheusbsbs / matheus-bagliano / commits / ef9e58c826
Fork 0

Replace index() with strchr().

strchr() is more portable than index() and is used everywhere in git already. Signed-off-by: Junio C Hamano <junkio@cox.net>

Dennis Stosberg committed Apr 11, 2006 at 18:37 UTC ef9e58c826a4fcaa13457cd8177518163f82972a
2 files changed +7 -7
http-fetch.c
+4 -4
@@ -597,7 +597,7 @@ static void process_alternates_response(void *callback_data)
597 newalt->packs = NULL;
598 path = strstr(target, "//");
599 if (path) {
600 - path = index(path+2, '/');
600 + path = strchr(path+2, '/');
601 if (path)
602 newalt->path_len = strlen(path);
603 }
@@ -678,7 +678,7 @@ static void
678 xml_start_tag(void *userData, const char *name, const char **atts)
679 {
680 struct xml_ctx *ctx = (struct xml_ctx *)userData;
681 - const char *c = index(name, ':');
681 + const char *c = strchr(name, ':');
682 int new_len;
683
684 if (c == NULL)
@@ -707,7 +707,7 @@ static void
707 xml_end_tag(void *userData, const char *name)
708 {
709 struct xml_ctx *ctx = (struct xml_ctx *)userData;
710 - const char *c = index(name, ':');
710 + const char *c = strchr(name, ':');
711 char *ep;
712
713 ctx->userFunc(ctx, 1);
@@ -1261,7 +1261,7 @@ int main(int argc, char **argv)
1261 alt->next = NULL;
1262 path = strstr(url, "//");
1263 if (path) {
1264 - path = index(path+2, '/');
1264 + path = strchr(path+2, '/');
1265 if (path)
1266 alt->path_len = strlen(path);
1267 }
http-push.c
+3 -3
@@ -1211,7 +1211,7 @@ static void
1211 xml_start_tag(void *userData, const char *name, const char **atts)
1212 {
1213 struct xml_ctx *ctx = (struct xml_ctx *)userData;
1214 - const char *c = index(name, ':');
1214 + const char *c = strchr(name, ':');
1215 int new_len;
1216
1217 if (c == NULL)
@@ -1240,7 +1240,7 @@ static void
1240 xml_end_tag(void *userData, const char *name)
1241 {
1242 struct xml_ctx *ctx = (struct xml_ctx *)userData;
1243 - const char *c = index(name, ':');
1243 + const char *c = strchr(name, ':');
1244 char *ep;
1245
1246 ctx->userFunc(ctx, 1);
@@ -2350,7 +2350,7 @@ int main(int argc, char **argv)
2350 char *path = strstr(arg, "//");
2351 remote->url = arg;
2352 if (path) {
2353 - path = index(path+2, '/');
2353 + path = strchr(path+2, '/');
2354 if (path)
2355 remote->path_len = strlen(path);
2356 }