Fix clang warnings
Hello!
On latest master, clang
throws these warnings:
disk.c:112:59: warning: '&&' within '||' [-Wlogical-op-parentheses]
else if ((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "lvm") == 0) ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
disk.c:112:59: note: place parentheses around the '&&' expression to silence this warning
else if ((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "lvm") == 0) ||
^
( )
disk.c:113:52: warning: '&&' within '||' [-Wlogical-op-parentheses]
(strcmp (primary_part[n-1].type, "raid") == 0) && (strncmp (type, "raid", 4) == 0)) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:113:52: note: place parentheses around the '&&' expression to silence this warning
(strcmp (primary_part[n-1].type, "raid") == 0) && (strncmp (type, "raid", 4) == 0)) {
^
( )
disk.c:118:59: warning: '&&' within '||' [-Wlogical-op-parentheses]
else if ((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "part") == 0) ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
disk.c:118:59: note: place parentheses around the '&&' expression to silence this warning
else if ((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "part") == 0) ||
^
( )
disk.c:119:52: warning: '&&' within '||' [-Wlogical-op-parentheses]
(strcmp (primary_part[n-1].type, "raid") == 0) && (strcmp (type, "part") == 0)) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:119:52: note: place parentheses around the '&&' expression to silence this warning
(strcmp (primary_part[n-1].type, "raid") == 0) && (strcmp (type, "part") == 0)) {
^
( )
disk.c:51:1: warning: no previous prototype for function 'find_primary_part' [-Wmissing-prototypes]
find_primary_part (partition_info *primary_part, const char *m)
^
disk.c:50:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void
^
static
disk.c:179:1: warning: no previous prototype for function 'is_virtual_drive' [-Wmissing-prototypes]
is_virtual_drive (partition_info *primary_part, const char *p)
^
disk.c:178:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int
^
static
disk.c:211:1: warning: no previous prototype for function 'max_lines' [-Wmissing-prototypes]
max_lines (const char *p)
^
disk.c:210:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int
^
static
main.c:53:4: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
sizeof (glibtop_command), sizeof (glibtop_response),
^~~~~~~~~~~~~~~~~~~~~~~~
main.c:53:30: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
sizeof (glibtop_command), sizeof (glibtop_response),
^~~~~~~~~~~~~~~~~~~~~~~~~
main.c:54:4: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
sizeof (glibtop_mountentry), sizeof (glibtop_union),
^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:54:33: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
sizeof (glibtop_mountentry), sizeof (glibtop_union),
^~~~~~~~~~~~~~~~~~~~~~
main.c:55:4: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
sizeof (glibtop_sysdeps),
^~~~~~~~~~~~~~~~~~~~~~~~
main.c:56:4: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
sizeof (glibtop_response_union));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:62:19: warning: format specifies type 'unsigned long long' but the argument has type 'guint64' (aka 'unsigned long') [-Wformat]
getpid (), cmnd->command);
^~~~~~~~~~~~~
main.c:67:8: warning: format specifies type 'unsigned long long' but the argument has type 'guint64' (aka 'unsigned long') [-Wformat]
cmnd->data_size, (unsigned long)BUFSIZ);
^~~~~~~~~~~~~~~
main.c:78:5: warning: format specifies type 'unsigned long long' but the argument has type 'guint64' (aka 'unsigned long') [-Wformat]
cmnd->data_size);
^~~~~~~~~~~~~~~
Thanks!