Re: [PATCH 7/9] struct option long_options doesn't need to be global

2014-06-01 Thread Amit Kucheria
Thank for the review. I've made the requested change and pushed all
these fixes with your Ack.

On Fri, May 30, 2014 at 1:13 PM, Daniel Lezcano
 wrote:
> 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 
>> ---
>>   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",
>>
>
>
> --
>   Linaro.org │ Open source software for ARM SoCs
>
> Follow Linaro:   Facebook |
>  Twitter |
>  Blog
>

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


Re: [PATCH 7/9] struct option long_options doesn't need to be global

2014-05-30 Thread Daniel Lezcano

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 
---
  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",




--
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog


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


[PATCH 7/9] struct option long_options doesn't need to be global

2014-05-28 Thread Amit Kucheria
Change the flag field to NULL while we're at it

Signed-off-by: Amit Kucheria 
---
 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 }
+   };
int optindex = 0;
 
c = getopt_long(argc, argv, ":dhi:mo:t:V",
-- 
1.9.1


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