Merge branch 'rm/strchrnul-not-strlen'

* rm/strchrnul-not-strlen:
  use strchrnul() in place of strchr() and strlen()
This commit is contained in:
Junio C Hamano
2014-03-18 13:51:18 -07:00
9 changed files with 31 additions and 54 deletions

View File

@ -260,8 +260,8 @@ static void parse_treeish_arg(const char **argv,
/* Remotes are only allowed to fetch actual refs */
if (remote && !remote_allow_unreachable) {
char *ref = NULL;
const char *colon = strchr(name, ':');
int refnamelen = colon ? colon - name : strlen(name);
const char *colon = strchrnul(name, ':');
int refnamelen = colon - name;
if (!dwim_ref(name, refnamelen, sha1, &ref))
die("no such ref: %.*s", refnamelen, name);