summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMAntoniak <47522782+MAntoniak@users.noreply.github.com>2022-02-20 15:16:07 +0100
committerDaniel Stenberg <daniel@haxx.se>2022-02-21 08:18:59 +0100
commit9fff7feb826fd912dd59e582b6e5f175e9bf4ba5 (patch)
tree199628d684d90376c65381e81bce56ecd9c75b2f /lib
parentd60fa59b916d96603857180fb88a53678f539d6c (diff)
downloadcurl-9fff7feb826fd912dd59e582b6e5f175e9bf4ba5.tar.gz
checkprefix: remove strlen calls
Closes #8481
Diffstat (limited to 'lib')
-rw-r--r--lib/strcase.h4
-rw-r--r--lib/tftp.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/strcase.h b/lib/strcase.h
index bbd6cd85d..b628656b9 100644
--- a/lib/strcase.h
+++ b/lib/strcase.h
@@ -41,8 +41,8 @@ int Curl_strncasecompare(const char *first, const char *second, size_t max);
char Curl_raw_toupper(char in);
/* checkprefix() is a shorter version of the above, used when the first
- argument is zero-byte terminated */
-#define checkprefix(a,b) curl_strnequal(a,b,strlen(a))
+ argument is the string literal */
+#define checkprefix(a,b) curl_strnequal(b, STRCONST(a))
void Curl_strntoupper(char *dest, const char *src, size_t n);
void Curl_strntolower(char *dest, const char *src, size_t n);
diff --git a/lib/tftp.c b/lib/tftp.c
index d2d802565..7f2c88b71 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -327,7 +327,7 @@ static CURLcode tftp_parse_option_ack(struct tftp_state_data *state,
infof(data, "got option=(%s) value=(%s)", option, value);
- if(checkprefix(option, TFTP_OPTION_BLKSIZE)) {
+ if(checkprefix(TFTP_OPTION_BLKSIZE, option)) {
long blksize;
blksize = strtol(value, NULL, 10);
@@ -359,7 +359,7 @@ static CURLcode tftp_parse_option_ack(struct tftp_state_data *state,
infof(data, "%s (%d) %s (%d)", "blksize parsed from OACK",
state->blksize, "requested", state->requested_blksize);
}
- else if(checkprefix(option, TFTP_OPTION_TSIZE)) {
+ else if(checkprefix(TFTP_OPTION_TSIZE, option)) {
long tsize = 0;
tsize = strtol(value, NULL, 10);