s3-clitar: Use ARRAY_SIZE macro.
authorAndreas Schneider <asn@samba.org>
Sat, 15 Feb 2014 16:05:18 +0000 (17:05 +0100)
committerAndreas Schneider <asn@samba.org>
Wed, 19 Feb 2014 17:22:29 +0000 (18:22 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
source3/client/clitar.c

index 37c31ac3d9e8a2cb7d0abc95b3a17c4a2dd24cc2..b8bdbdd1b92bc324771b6d0634e1c1dfaacc9073 100644 (file)
@@ -77,9 +77,6 @@
 #include <archive.h>
 #include <archive_entry.h>
 
-/* number of element in an array */
-#define LEN(x) (sizeof(x)/sizeof((x)[0]))
-
 /* prepend module name and line number to debug messages */
 #define DBG(a, b) (DEBUG(a, ("tar:%-4d ", __LINE__)), DEBUG(a, b))
 
@@ -306,14 +303,14 @@ int cmd_tarmode(void)
     };
 
     while (next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
-        for (i = 0; i < LEN(table); i++) {
+        for (i = 0; i < ARRAY_SIZE(table); i++) {
             if (strequal(table[i].cmd, buf)) {
                 *table[i].p = table[i].value;
                 break;
             }
         }
 
-        if (i == LEN(table))
+        if (i == ARRAY_SIZE(table))
             DBG(0, ("tarmode: unrecognised option %s\n", buf));
     }