mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-11-23 04:24:24 +03:00
Consistent style for usage of sizeof operator
The code is splattered with a mix of sizeof foo sizeof (foo) sizeof(foo) Standardize on sizeof(foo) and add a syntax check rule to enforce it Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
@@ -83,7 +83,7 @@
|
||||
|
||||
|
||||
# define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0)
|
||||
# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
|
||||
# define ARRAY_CARDINALITY(Array) (sizeof(Array) / sizeof(*(Array)))
|
||||
|
||||
/* C99 uses __func__. __FUNCTION__ is legacy. */
|
||||
# ifndef __GNUC__
|
||||
@@ -205,7 +205,7 @@
|
||||
* Use this when passing possibly-NULL strings to printf-a-likes.
|
||||
*/
|
||||
# define NULLSTR(s) \
|
||||
((void)verify_true(sizeof *(s) == sizeof (char)), \
|
||||
((void)verify_true(sizeof(*(s)) == sizeof(char)), \
|
||||
(s) ? (s) : "(null)")
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user