diff options
| author | Tommie Gannert | 2016-08-14 12:35:52 +0100 | 
|---|---|---|
| committer | Tommie Gannert | 2016-08-14 12:37:38 +0100 | 
| commit | eb0b6412af16fe00ce38faa31bd50c238f4e7098 (patch) | |
| tree | c4c745f17954aa1f54dd8b6ec28e40e6d124b648 | |
| parent | Simplify string comparisons in slurp_battery_info for NetBSD. (diff) | |
Fix warnings about using a char array index on NetBSD.
The isspace macro is just a table lookup.
| -rw-r--r-- | src/print_battery_info.c | 16 | 
1 files changed, 8 insertions, 8 deletions
| diff --git a/src/print_battery_info.c b/src/print_battery_info.c index 3e97528..a97bdea 100644 --- a/src/print_battery_info.c +++ b/src/print_battery_info.c @@ -404,14 +404,14 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char          }      } -#define EAT_SPACE_FROM_OUTPUT_IF_NO_OUTPUT()              \ -    do {                                                  \ -        if (outwalk == prevoutwalk) {                     \ -            if (outwalk > buffer && isspace(outwalk[-1])) \ -                outwalk--;                                \ -            else if (isspace(*(walk + 1)))                \ -                walk++;                                   \ -        }                                                 \ +#define EAT_SPACE_FROM_OUTPUT_IF_NO_OUTPUT()                   \ +    do {                                                       \ +        if (outwalk == prevoutwalk) {                          \ +            if (outwalk > buffer && isspace((int)outwalk[-1])) \ +                outwalk--;                                     \ +            else if (isspace((int)*(walk + 1)))                \ +                walk++;                                        \ +        }                                                      \      } while (0)      for (walk = format; *walk != '\0'; walk++) { | 
