From: Gerome Fournier Date: Sun, 27 Aug 2023 11:25:47 +0000 (+0200) Subject: tool_paramhlp: improve str2num(): avoid unnecessary call to strlen() X-Git-Tag: curl-8_3_0~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=458c70db6a8e51e6f47313ac91da736cfe8d3fbb;p=thirdparty%2Fcurl.git tool_paramhlp: improve str2num(): avoid unnecessary call to strlen() Closes #11742 --- diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index d2248442b1..d70e80db4b 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -138,7 +138,7 @@ static ParameterError getnum(long *val, const char *str, int base) num = strtol(str, &endptr, base); if(errno == ERANGE) return PARAM_NUMBER_TOO_LARGE; - if((endptr != str) && (endptr == str + strlen(str))) { + if((endptr != str) && (*endptr == '\0')) { *val = num; return PARAM_OK; /* Ok */ }