On 05/29/2014 12:17 AM, Amit Kucheria wrote:
Change the flag field to NULL while we're at it

Signed-off-by: Amit Kucheria <amit.kuche...@linaro.org>
---
  idlestat.c | 21 ++++++++++-----------
  1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/idlestat.c b/idlestat.c
index 96fc1f2..c4a405a 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -955,17 +955,6 @@ static void version(const char *cmd)
        printf("%s version %s\n", basename(cmd), IDLESTAT_VERSION);
  }

-static struct option long_options[] = {
-       { "debug",       no_argument,       0, 'd' },
-       { "help",        no_argument,       0, 'h' },
-       { "iterations",  required_argument, 0, 'i' },
-       { "dump",        no_argument,       0, 'm' },
-       { "output-file", required_argument, 0, 'o' },
-       { "duration",    required_argument, 0, 't' },
-       { "version",     no_argument,       0, 'V' },
-       { 0, 0, 0, 0 }
-};
-
  struct idledebug_options {
        bool debug;
        bool dump;
@@ -983,6 +972,16 @@ int getoptions(int argc, char *argv[], struct 
idledebug_options *options)

        while (1) {

+               static struct option long_options[] = {
+                       { "debug",       no_argument,       NULL, 'd' },
+                       { "help",        no_argument,       NULL, 'h' },
+                       { "iterations",  required_argument, NULL, 'i' },
+                       { "dump",        no_argument,       NULL, 'm' },
+                       { "output-file", required_argument, NULL, 'o' },
+                       { "duration",    required_argument, NULL, 't' },
+                       { "version",     no_argument,       NULL, 'V' },
+                       { 0, 0, 0, 0 }
+               };


Why not move this declaration at the beginning of the function and remove the 'static' ?

                int optindex = 0;

                c = getopt_long(argc, argv, ":dhi:mo:t:V",



--
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to