[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 160/254: assert: avoid, use DEBUGASSERT instead!
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 160/254: assert: avoid, use DEBUGASSERT instead! |
Date: |
Sat, 17 Jun 2017 16:53:12 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.54.1
in repository gnurl.
commit 8589e1fe30773e10c50b9a65d4f96eeb8434233c
Author: Daniel Stenberg <address@hidden>
AuthorDate: Mon May 22 13:58:17 2017 +0200
assert: avoid, use DEBUGASSERT instead!
... as it does extra checks to actually work.
Reported-by: jonrumsey at github
Fixes #1504
---
lib/http2.c | 4 ++--
lib/memdebug.c | 18 +++++++-----------
lib/mprintf.c | 6 ++----
lib/rand.c | 2 +-
4 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/lib/http2.c b/lib/http2.c
index c65305029..e123bc56c 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -784,7 +784,7 @@ static int on_begin_headers(nghttp2_session *session,
/* This is trailer HEADERS started. Allocate buffer for them. */
DEBUGF(infof(data_s, "trailer field started\n"));
- assert(stream->trailer_recvbuf == NULL);
+ DEBUGASSERT(stream->trailer_recvbuf == NULL);
stream->trailer_recvbuf = Curl_add_buffer_init();
if(!stream->trailer_recvbuf) {
@@ -1453,7 +1453,7 @@ static ssize_t http2_recv(struct connectdata *conn, int
sockindex,
infof(data, "%zu data bytes written\n", nread);
if(stream->pauselen == 0) {
DEBUGF(infof(data, "Unpaused by stream %u\n", stream->stream_id));
- assert(httpc->pause_stream_id == stream->stream_id);
+ DEBUGASSERT(httpc->pause_stream_id == stream->stream_id);
httpc->pause_stream_id = 0;
stream->pausedata = NULL;
diff --git a/lib/memdebug.c b/lib/memdebug.c
index 516f273c1..3ee16c8eb 100644
--- a/lib/memdebug.c
+++ b/lib/memdebug.c
@@ -35,10 +35,6 @@
#include "curl_memory.h"
#include "memdebug.h"
-#ifndef HAVE_ASSERT_H
-# define assert(x) Curl_nop_stmt
-#endif
-
/*
* Until 2011-08-17 libcurl's Memory Tracking feature also performed
* automatic malloc and free filling operations using 0xA5 and 0x13
@@ -167,7 +163,7 @@ void *curl_domalloc(size_t wantedsize, int line, const char
*source)
struct memdebug *mem;
size_t size;
- assert(wantedsize != 0);
+ DEBUGASSERT(wantedsize != 0);
if(countcheck("malloc", line, source))
return NULL;
@@ -196,8 +192,8 @@ void *curl_docalloc(size_t wanted_elements, size_t
wanted_size,
struct memdebug *mem;
size_t size, user_size;
- assert(wanted_elements != 0);
- assert(wanted_size != 0);
+ DEBUGASSERT(wanted_elements != 0);
+ DEBUGASSERT(wanted_size != 0);
if(countcheck("calloc", line, source))
return NULL;
@@ -223,7 +219,7 @@ char *curl_dostrdup(const char *str, int line, const char
*source)
char *mem;
size_t len;
- assert(str != NULL);
+ DEBUGASSERT(str != NULL);
if(countcheck("strdup", line, source))
return NULL;
@@ -247,7 +243,7 @@ wchar_t *curl_dowcsdup(const wchar_t *str, int line, const
char *source)
wchar_t *mem;
size_t wsiz, bsiz;
- assert(str != NULL);
+ DEBUGASSERT(str != NULL);
if(countcheck("wcsdup", line, source))
return NULL;
@@ -276,7 +272,7 @@ void *curl_dorealloc(void *ptr, size_t wantedsize,
size_t size = sizeof(struct memdebug)+wantedsize;
- assert(wantedsize != 0);
+ DEBUGASSERT(wantedsize != 0);
if(countcheck("realloc", line, source))
return NULL;
@@ -445,7 +441,7 @@ int curl_fclose(FILE *file, int line, const char *source)
{
int res;
- assert(file != NULL);
+ DEBUGDEBUGASSERT(file != NULL);
res=fclose(file);
diff --git a/lib/mprintf.c b/lib/mprintf.c
index 037132c86..eb7ee0c6b 100644
--- a/lib/mprintf.c
+++ b/lib/mprintf.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1999 - 2016, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1999 - 2017, Daniel Stenberg, <address@hidden>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -951,9 +951,7 @@ static int dprintf_formatf(
/* NOTE NOTE NOTE!! Not all sprintf implementations return number of
output characters */
(sprintf)(work, formatbuf, p->data.dnum);
-#ifdef CURLDEBUG
- assert(strlen(work) <= sizeof(work));
-#endif
+ DEBUGASSERT(strlen(work) <= sizeof(work));
for(fptr=work; *fptr; fptr++)
OUTCHAR(*fptr);
}
diff --git a/lib/rand.c b/lib/rand.c
index a61a070ee..b6f40ac0a 100644
--- a/lib/rand.c
+++ b/lib/rand.c
@@ -121,7 +121,7 @@ CURLcode Curl_rand(struct Curl_easy *data, unsigned char
*rnd, size_t num)
{
CURLcode result = CURLE_BAD_FUNCTION_ARGUMENT;
- assert(num > 0);
+ DEBUGASSERT(num > 0);
while(num) {
unsigned int r;
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 46/254: examples: fixed too long line and too long string warnings, (continued)
- [GNUnet-SVN] [gnurl] 46/254: examples: fixed too long line and too long string warnings, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 203/254: build: provide easy code coverage measuring, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 248/254: configure: update the copyright year in the output, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 139/254: CURLOPT_HTTPPROXYTUNNEL: clarify, add example, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 67/254: buffer: use data->set.buffer_size instead of BUFSIZE, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 195/254: CURLOPT_SSH_KEY*.3: typos, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 192/254: CURLOPT_FNMATCH_DATA.3: modified example to avoid fcpp issues, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 140/254: docs/libcurl/opts: added more examples in man pages, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 171/254: ssh: fix 'left' may be used uninitialized, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 84/254: curl_setup_once: use SEND_QUAL_ARG2 for swrite, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 160/254: assert: avoid, use DEBUGASSERT instead!,
gnunet <=
- [GNUnet-SVN] [gnurl] 209/254: MD(4|5): silence cast-align clang warning, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 187/254: curl-compilers.m4: enable -Wshift-sign-overflow for clang, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 247/254: BINDINGS: update SP-Forth and OCaml urls, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 219/254: travis: add coverage, distcheck and cmake builds, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 223/254: RELEASE-NOTES: synced with 65ba92650, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 186/254: CURLOPT_PROXY.3: fix test 1140 breakage, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 162/254: url: fix declaration of 'pipe' shadows a global declaration, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 214/254: updatemanpages.pl: error out on too old git version, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 148/254: mkhelp.pl: do not add current time into curl binary, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 164/254: LDAP: using ldap_bind_s on Windows with methods (#878), gnunet, 2017/06/17