X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin-fetch--tool.c;h=ed60847d9fcd0ad8803c432af8d0bc2dd3567768;hb=d577bc58a3424f4d0d7f7c8094753b92cb7cb823;hp=e26817de219588e680340be8c0faf6b65417c465;hpb=6e863d6d129a1b6a13c66d0bb03f3d43db6c51fe;p=git.git diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c index e26817de2..ed60847d9 100644 --- a/builtin-fetch--tool.c +++ b/builtin-fetch--tool.c @@ -25,7 +25,7 @@ static int update_ref_env(const char *action, unsigned char *oldval) { char msg[1024]; - char *rla = getenv("GIT_REFLOG_ACTION"); + const char *rla = getenv("GIT_REFLOG_ACTION"); if (!rla) rla = "(reflog update)"; @@ -61,7 +61,7 @@ static int update_local_ref(const char *name, } if (get_sha1(name, sha1_old)) { - char *msg; + const char *msg; just_store: /* new ref */ if (!strncmp(name, "refs/tags/", 10)) @@ -435,9 +435,7 @@ static int pick_rref(int sha1_only, const char *rref, const char *ls_remote_resu cp++; if (!*cp) break; - np = strchr(cp, '\n'); - if (!np) - np = cp + strlen(cp); + np = strchrnul(cp, '\n'); if (pass) { lrr_list[i].line = cp; lrr_list[i].name = cp + 41; @@ -461,9 +459,7 @@ static int pick_rref(int sha1_only, const char *rref, const char *ls_remote_resu rref++; if (!*rref) break; - next = strchr(rref, '\n'); - if (!next) - next = rref + strlen(rref); + next = strchrnul(rref, '\n'); rreflen = next - rref; for (i = 0; i < lrr_count; i++) {