]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: i_zero*() - Update comment, especially about arrays
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 13 May 2019 13:03:27 +0000 (16:03 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 25 Jun 2019 13:13:03 +0000 (16:13 +0300)
src/lib/macros.h

index be1d3265aef6ad020d3aad0e92d04f577c6e019f..a89b10c18aaf99a4a2df5e5be85b10d50ee2ec48 100644 (file)
 #  define STATIC_ARRAY
 #endif
 
-/* Convenience wrappers for initializing a struct */
+/* Convenience wrappers for initializing a struct with zeros, although it can
+   be used for replacing other memset()s also.
+
+   // NOTE: This is the correct way to zero the whole array
+   char arr[5]; i_zero(&arr);
+   // This will give compiler error (or zero only the first element):
+   char arr[5]; i_zero(arr);
+*/
 #define i_zero(p) \
        memset(p, 0 + COMPILE_ERROR_IF_TRUE(sizeof(p) > sizeof(void *)), sizeof(*(p)))
 #define i_zero_safe(p) \