aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-21 00:54:49 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-21 00:54:49 +0200
commit30361fe0e89a72e2dd248a93824b06d858e4e81a (patch)
tree5cd5b9917bf1fb6899587683ab1680472c29194a /src/include
parent172d6b0c471cd6512b8074d78f59ae9bb8cad9e7 (diff)
downloadgnunet-30361fe0e89a72e2dd248a93824b06d858e4e81a.tar.gz
gnunet-30361fe0e89a72e2dd248a93824b06d858e4e81a.zip
make GNUNET_freez default, have GNUNET_free_nz for cases where that does not work
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_common.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 78aeb3de7..9e7c77786 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -1284,23 +1284,23 @@ GNUNET_is_zero_ (const void *a,
1284 * @ingroup memory 1284 * @ingroup memory
1285 * Wrapper around free. Frees the memory referred to by ptr. 1285 * Wrapper around free. Frees the memory referred to by ptr.
1286 * Note that it is generally better to free memory that was 1286 * Note that it is generally better to free memory that was
1287 * allocated with #GNUNET_array_grow using #GNUNET_array_grow(mem, size, 0) instead of #GNUNET_free. 1287 * allocated with #GNUNET_array_grow using #GNUNET_array_grow(mem, size, 0) instead of #GNUNET_free_nz.
1288 * 1288 *
1289 * @param ptr location where to free the memory. ptr must have 1289 * @param ptr location where to free the memory. ptr must have
1290 * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier. 1290 * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier.
1291 */ 1291 */
1292#define GNUNET_free(ptr) GNUNET_xfree_ (ptr, __FILE__, __LINE__) 1292#define GNUNET_free_nz(ptr) GNUNET_xfree_ (ptr, __FILE__, __LINE__)
1293 1293
1294/** 1294/**
1295 * @ingroup memory 1295 * @ingroup memory
1296 * Wrapper around free. Frees the memory referred to by ptr and sets ptr to NULL. 1296 * Wrapper around free. Frees the memory referred to by ptr and sets ptr to NULL.
1297 * Note that it is generally better to free memory that was 1297 * Note that it is generally better to free memory that was
1298 * allocated with #GNUNET_array_grow using #GNUNET_array_grow(mem, size, 0) instead of #GNUNET_freez. 1298 * allocated with #GNUNET_array_grow using #GNUNET_array_grow(mem, size, 0) instead of #GNUNET_free.
1299 * 1299 *
1300 * @param ptr location where to free the memory. ptr must have 1300 * @param ptr location where to free the memory. ptr must have
1301 * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier. 1301 * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier.
1302 */ 1302 */
1303#define GNUNET_freez(ptr) do { \ 1303#define GNUNET_free(ptr) do { \
1304 GNUNET_xfree_ (ptr, __FILE__, __LINE__); \ 1304 GNUNET_xfree_ (ptr, __FILE__, __LINE__); \
1305 ptr = NULL; \ 1305 ptr = NULL; \
1306} while (0) 1306} while (0)