From cb529b713f4882ac65a074ae8d87faa41d19168e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 11 May 2018 23:40:58 +0200 Subject: checksrc: make sure sizeof() is used *with* parentheses ... and unify the source code to adhere. Closes #2563 --- src/tool_formparse.c | 8 ++++---- src/tool_metalink.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/tool_formparse.c b/src/tool_formparse.c index 5313b3441..9fcf014b8 100644 --- a/src/tool_formparse.c +++ b/src/tool_formparse.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -168,12 +168,12 @@ static int read_field_headers(struct OperationConfig *config, pos++; if(!incomment) { - if(hdrlen == sizeof hdrbuf - 1) { + if(hdrlen == sizeof(hdrbuf) - 1) { warnf(config->global, "File %s line %d: header too long (truncated)\n", filename, lineno); c = ' '; } - if(hdrlen <= sizeof hdrbuf - 1) + if(hdrlen <= sizeof(hdrbuf) - 1) hdrbuf[hdrlen++] = (char) c; } } @@ -451,7 +451,7 @@ static CURLcode file_or_stdin(curl_mimepart *part, const char *file) if(strcmp(file, "-")) return curl_mime_filedata(part, file); - sip = (standard_input *) calloc(1, sizeof *sip); + sip = (standard_input *) calloc(1, sizeof(*sip)); if(!sip) return CURLE_OUT_OF_MEMORY; diff --git a/src/tool_metalink.c b/src/tool_metalink.c index 03f159745..f8effd374 100644 --- a/src/tool_metalink.c +++ b/src/tool_metalink.c @@ -246,7 +246,7 @@ static int nss_hash_init(void **pctx, SECOidTag hash_alg) /* we have to initialize NSS if not initialized already */ if(!NSS_IsInitialized() && !nss_context) { static NSSInitParameters params; - params.length = sizeof params; + params.length = sizeof(params); nss_context = NSS_InitContext("", "", "", "", ¶ms, NSS_INIT_READONLY | NSS_INIT_NOCERTDB | NSS_INIT_NOMODDB | NSS_INIT_FORCEOPEN | NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE | NSS_INIT_PK11RELOAD); @@ -529,7 +529,7 @@ digest_context *Curl_digest_init(const digest_params *dparams) digest_context *ctxt; /* Create digest context */ - ctxt = malloc(sizeof *ctxt); + ctxt = malloc(sizeof(*ctxt)); if(!ctxt) return ctxt; -- cgit v1.2.3