s3-printing: use ARRAY_SIZE() macro in forms functions.
authorGünther Deschner <gd@samba.org>
Fri, 17 Apr 2009 22:58:12 +0000 (00:58 +0200)
committerGünther Deschner <gd@samba.org>
Sun, 19 Apr 2009 23:06:01 +0000 (01:06 +0200)
Guenther

source3/printing/nt_printing.c

index b96d64b4bebdcad6bb18f6ad4fe79a7fa9e9b50c..d6fead11c2dd7d9ee9f487d9f5b9a03170b969bb 100644 (file)
@@ -745,7 +745,7 @@ int get_builtin_ntforms(nt_forms_struct **list)
        if (!*list) {
                return 0;
        }
-       return sizeof(default_forms) / sizeof(default_forms[0]);
+       return ARRAY_SIZE(default_forms);
 }
 
 /****************************************************************************
@@ -754,18 +754,17 @@ int get_builtin_ntforms(nt_forms_struct **list)
 
 bool get_a_builtin_ntform_by_string(const char *form_name, nt_forms_struct *form)
 {
-       int i,count;
+       int i;
        DEBUGADD(6,("Looking for builtin form %s \n", form_name));
-       count = sizeof(default_forms) / sizeof(default_forms[0]);
-       for (i=0;i<count;i++) {
+       for (i=0; i<ARRAY_SIZE(default_forms); i++) {
                if (strequal(form_name,default_forms[i].name)) {
                        DEBUGADD(6,("Found builtin form %s \n", form_name));
                        memcpy(form,&default_forms[i],sizeof(*form));
-                       break;
+                       return true;
                }
        }
 
-       return (i !=count);
+       return false;
 }
 
 /****************************************************************************