[SSSD] [PATCHES] Three minor cosmetic fixes

Sumit Bose sbose at redhat.com
Thu Oct 7 11:32:23 UTC 2010


Hi,

the three attached patches fixes some compiler warnings, which might
occur with a high warning level like -Wextra.

bye,
Sumit
-------------- next part --------------
From 0d444f1bff11b3837611988f4226b86f9ce34d0d Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Tue, 5 Oct 2010 14:46:14 +0200
Subject: [PATCH 1/3] Use POPT_TABLEEND to close option table

---
 src/tests/auth-tests.c          |    2 +-
 src/tests/krb5_utils-tests.c    |    2 +-
 src/tests/simple_access-tests.c |    2 +-
 src/tests/stress-tests.c        |    4 ++--
 src/tests/strtonum-tests.c      |    2 +-
 src/tests/sysdb-tests.c         |    2 +-
 src/tests/util-tests.c          |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/tests/auth-tests.c b/src/tests/auth-tests.c
index bae0794..abdc874 100644
--- a/src/tests/auth-tests.c
+++ b/src/tests/auth-tests.c
@@ -305,7 +305,7 @@ int main(int argc, const char *argv[])
     struct poptOption long_options[] = {
         POPT_AUTOHELP
         SSSD_MAIN_OPTS
-        { NULL }
+        POPT_TABLEEND
     };
 
     pc = poptGetContext(argv[0], argc, argv, long_options, 0);
diff --git a/src/tests/krb5_utils-tests.c b/src/tests/krb5_utils-tests.c
index 54b18cb..d5d1f09 100644
--- a/src/tests/krb5_utils-tests.c
+++ b/src/tests/krb5_utils-tests.c
@@ -639,7 +639,7 @@ int main(int argc, const char *argv[])
     struct poptOption long_options[] = {
         POPT_AUTOHELP
         SSSD_MAIN_OPTS
-        { NULL }
+        POPT_TABLEEND
     };
 
     pc = poptGetContext(argv[0], argc, argv, long_options, 0);
diff --git a/src/tests/simple_access-tests.c b/src/tests/simple_access-tests.c
index f1d3775..c9bf4ea 100644
--- a/src/tests/simple_access-tests.c
+++ b/src/tests/simple_access-tests.c
@@ -147,7 +147,7 @@ int main(int argc, const char *argv[])
     struct poptOption long_options[] = {
         POPT_AUTOHELP
         SSSD_MAIN_OPTS
-        { NULL }
+        POPT_TABLEEND
     };
 
     pc = poptGetContext(argv[0], argc, argv, long_options, 0);
diff --git a/src/tests/stress-tests.c b/src/tests/stress-tests.c
index 3b53735..b645c25 100644
--- a/src/tests/stress-tests.c
+++ b/src/tests/stress-tests.c
@@ -214,7 +214,7 @@ int main(int argc, const char *argv[])
     struct poptOption long_options[] = {
         POPT_AUTOHELP
         { "groups", 'g', POPT_ARG_NONE, &pc_groups, 0,
-                    "Lookup in groups instead of users" },
+                    "Lookup in groups instead of users", NULL },
         { "prefix", '\0', POPT_ARG_STRING, &pc_prefix, 0,
                     "The username prefix", NULL },
         { "start",  '\0', POPT_ARG_INT | POPT_ARGFLAG_SHOW_DEFAULT,
@@ -227,7 +227,7 @@ int main(int argc, const char *argv[])
                     "Fail on not getting the requested NSS data (default: No)",
                     NULL },
         { "verbose", 'v', POPT_ARG_NONE, 0, 'v',
-                    "Be verbose" },
+                    "Be verbose", NULL },
         POPT_TABLEEND
     };
 
diff --git a/src/tests/strtonum-tests.c b/src/tests/strtonum-tests.c
index a7131c1..6c26018 100644
--- a/src/tests/strtonum-tests.c
+++ b/src/tests/strtonum-tests.c
@@ -431,7 +431,7 @@ int main(int argc, const char *argv[]) {
     struct poptOption long_options[] = {
         POPT_AUTOHELP
         SSSD_MAIN_OPTS
-        { NULL }
+        POPT_TABLEEND
     };
 
     pc = poptGetContext(argv[0], argc, argv, long_options, 0);
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index c2e800b..51eda8f 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -2876,7 +2876,7 @@ int main(int argc, const char *argv[]) {
         SSSD_MAIN_OPTS
         {"no-cleanup", 'n', POPT_ARG_NONE, &no_cleanup, 0,
          _("Do not delete the test database after a test run"), NULL },
-        { NULL }
+        POPT_TABLEEND
     };
 
     pc = poptGetContext(argv[0], argc, argv, long_options, 0);
diff --git a/src/tests/util-tests.c b/src/tests/util-tests.c
index d8d3800..bfc48bb 100644
--- a/src/tests/util-tests.c
+++ b/src/tests/util-tests.c
@@ -200,7 +200,7 @@ int main(int argc, const char *argv[])
     struct poptOption long_options[] = {
         POPT_AUTOHELP
         SSSD_MAIN_OPTS
-        { NULL }
+        POPT_TABLEEND
     };
 
     pc = poptGetContext(argv[0], argc, argv, long_options, 0);
-- 
1.7.2.3

-------------- next part --------------
From bb19c976752a6d68cdd74e961485aee24f67d057 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Thu, 7 Oct 2010 13:10:08 +0200
Subject: [PATCH 2/3] Add a missing include file

strcasecmp() is defined in strings.h which might not be included under
certain conditions.
---
 src/util/util.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/util/util.h b/src/util/util.h
index 2aa4147..fc30e91 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -26,6 +26,7 @@
 #include <stdbool.h>
 #include <unistd.h>
 #include <string.h>
+#include <strings.h>
 #include <errno.h>
 #include <libintl.h>
 #include <limits.h>
-- 
1.7.2.3

-------------- next part --------------
From a7200fafb3910d6d64ee7b06e73a495d4dbf9f58 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Thu, 7 Oct 2010 13:13:53 +0200
Subject: [PATCH 3/3] Rename index to idx

This patch suppresses a 'shadows a global declaration' warning.
---
 src/providers/ipa/ipa_timerules.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/providers/ipa/ipa_timerules.c b/src/providers/ipa/ipa_timerules.c
index 8ac074a..857107d 100644
--- a/src/providers/ipa/ipa_timerules.c
+++ b/src/providers/ipa/ipa_timerules.c
@@ -263,18 +263,18 @@ static int test_bit(unsigned char *bitmap, unsigned int bit)
  */
 static int name_index(const char **name_array, const char *key, int min)
 {
-    int index = 0;
+    int idx = 0;
     const char *one;
 
     if (name_array == NULL) {
         return -1;
     }
 
-    while ((one = name_array[index]) != NULL) {
+    while ((one = name_array[idx]) != NULL) {
         if (strcmp(key,one) == 0) {
-            return index+min;
+            return idx+min;
         }
-        index++;
+        idx++;
     }
 
     return -1;
-- 
1.7.2.3



More information about the sssd-devel mailing list