From 2c5495f7b60d6ddcd6a411b48d2f6dbc4a24717a Mon Sep 17 00:00:00 2001 From: Rohit Mani Date: Fri, 7 Mar 2014 22:48:31 -0800 Subject: 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 Signed-off-by: Rohit Mani Signed-off-by: Junio C Hamano --- remote-testsvn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'remote-testsvn.c') diff --git a/remote-testsvn.c b/remote-testsvn.c index 078f1ffa4..6be55cbe9 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)) { -- cgit v1.2.1