summaryrefslogtreecommitdiffstats
path: root/remote-testsvn.c
diff options
context:
space:
mode:
authorRohit Mani <rohit.mani@outlook.com>2014-03-08 07:48:31 +0100
committerJunio C Hamano <gitster@pobox.com>2014-03-10 16:35:30 +0100
commit2c5495f7b60d6ddcd6a411b48d2f6dbc4a24717a (patch)
tree9900454e2b547e2fee8e9e67b39ced68ea0c650e /remote-testsvn.c
parentGit 1.9.0 (diff)
downloadgit-2c5495f7b60d6ddcd6a411b48d2f6dbc4a24717a.tar.xz
git-2c5495f7b60d6ddcd6a411b48d2f6dbc4a24717a.zip
use strchrnul() in place of strchr() and strlen()
Avoid scanning strings twice, once with strchr() and then with strlen(), by using strchrnul(). Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Rohit Mani <rohit.mani@outlook.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-testsvn.c')
-rw-r--r--remote-testsvn.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/remote-testsvn.c b/remote-testsvn.c
index 078f1ffa41..6be55cbe9e 100644
--- a/remote-testsvn.c
+++ b/remote-testsvn.c
@@ -78,8 +78,8 @@ static int parse_rev_note(const char *msg, struct rev_note *res)
size_t len;
while (*msg) {
- end = strchr(msg, '\n');
- len = end ? end - msg : strlen(msg);
+ end = strchrnul(msg, '\n');
+ len = end - msg;
key = "Revision-number: ";
if (starts_with(msg, key)) {