diff options
author | Ben Straub <bs@github.com> | 2013-11-05 10:37:50 -0800 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2013-11-05 10:37:50 -0800 |
commit | fe294b95d1f04ceb4d279b312d3f88375dbe0dc9 (patch) | |
tree | b2f93ce8e4f0087f37e32fedfb942130a2de1a27 | |
parent | ac72051afa619446818adf286cf3cdbd13991b38 (diff) | |
download | libgit2-fe294b95d1f04ceb4d279b312d3f88375dbe0dc9.tar.gz |
Incorporate feedback
-rw-r--r-- | src/netops.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/netops.c b/src/netops.c index 72172f39b..1a0d102d7 100644 --- a/src/netops.c +++ b/src/netops.c @@ -703,24 +703,24 @@ int gitno_extract_url_parts( _path = url+u.field_data[UF_PATH].off; _userinfo = url+u.field_data[UF_USERINFO].off; - if (u.field_data[UF_HOST].len) { + if (u.field_set & (1 << UF_HOST)) { *host = git__substrdup(_host, u.field_data[UF_HOST].len); GITERR_CHECK_ALLOC(*host); } - if (u.field_data[UF_PORT].len) + if (u.field_set & (1 << UF_PORT)) *port = git__substrdup(_port, u.field_data[UF_PORT].len); else *port = git__strdup(default_port); GITERR_CHECK_ALLOC(*port); - if (u.field_data[UF_PATH].len) { + if (u.field_set & (1 << UF_PATH)) { *path = git__substrdup(_path, u.field_data[UF_PATH].len); GITERR_CHECK_ALLOC(*path); } - if (u.field_data[UF_USERINFO].len) { - const char *colon = strchr(_userinfo, ':'); + if (u.field_set & (1 << UF_USERINFO)) { + const char *colon = memchr(_userinfo, ':', u.field_data[UF_USERINFO].len); if (colon && (colon - _userinfo) < u.field_data[UF_USERINFO].len) { *username = unescape(git__substrdup(_userinfo, colon - _userinfo)); *password = unescape(git__substrdup(colon+1, u.field_data[UF_USERINFO].len - (colon+1-_userinfo))); |