[devel] [PATCH 6/8] set.c: use function-like syntax for sizeof.

Kirill A. Shutsemov kirill на shutemov.name
Вт Ноя 16 15:56:40 UTC 2010


From: Kirill A. Shutemov <kirill на shutemov.name>

Signed-off-by: Kirill A. Shutemov <kirill на shutemov.name>
---
 lib/set.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/set.c b/lib/set.c
index 2a8d8b3..b4ed87d 100644
--- a/lib/set.c
+++ b/lib/set.c
@@ -219,7 +219,7 @@ void test_base62(void)
 	/* trigger some 'Z' */
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     };
-    const int rnd_bitc = sizeof rnd_bitv;
+    const int rnd_bitc = sizeof(rnd_bitv);
     /* encode */
     char base62[encode_base62_size(rnd_bitc)];
     int len = encode_base62(rnd_bitc, rnd_bitv, base62);
@@ -407,7 +407,7 @@ void test_golomb(void)
 	/* koshka sela na taksi */
 	7, 6, 5, 4, 3, 2, 1,
     };
-    const int rnd_c = sizeof rnd_v / sizeof *rnd_v;
+    const int rnd_c = sizeof(rnd_v) / sizeof(*rnd_v);
     int bpp = 10;
     int Mshift = encode_golomb_Mshift(rnd_c, bpp);
     fprintf(stderr, "rnd_c=%d bpp=%d Mshift=%d\n", rnd_c, bpp, Mshift);
@@ -522,7 +522,7 @@ int cmpv(const void *arg1, const void *arg2)
 static
 void sortv(int c, unsigned *v)
 {
-    qsort(v, c, sizeof *v, cmpv);
+    qsort(v, c, sizeof(*v), cmpv);
 }
 
 static
@@ -545,7 +545,7 @@ static
 void test_aux(void)
 {
     unsigned v[] = { 2, 3, 1, 2, 7, 6, 5 };
-    int c = sizeof v / sizeof *v;
+    int c = sizeof(v) / sizeof(*v);
     maskv(c, v, 4 - 1);
     sortv(c, v);
     c = uniqv(c, v);
@@ -710,7 +710,7 @@ void test_set(void)
 	0x82ae, 0x8415, 0xa3e7, 0xb07e,
 	0xb584, 0xb89f, 0xbb40, 0xf39e,
     };
-    int rnd_c = sizeof rnd_v / sizeof *rnd_v;
+    int rnd_c = sizeof(rnd_v) / sizeof(*rnd_v);
     /* encode */
     int bpp = 16;
     char base62[encode_set_size(rnd_c, bpp)];
@@ -833,7 +833,7 @@ struct set {
 
 struct set *set_new()
 {
-    struct set *set = xmalloc(sizeof *set);
+    struct set *set = xmalloc(sizeof(*set));
 
     set->c = 0;
     set->sv = NULL;
@@ -923,7 +923,7 @@ const char *set_fini(struct set *set, int bpp)
 	set->sv[i].v = jenkins_hash(set->sv[i].s) & mask;
 
     /* sort by hash value */
-    qsort(set->sv, set->c, sizeof *set->sv, cmp_sv);
+    qsort(set->sv, set->c, sizeof(*set->sv), cmp_sv);
 
     /* warn on hash collisions */
     for (i = 0; i < set->c - 1; i++) {
-- 
1.7.3.2



Подробная информация о списке рассылки Devel