misc: eliminate all those remaining gcc -Wall warnings
Reference(s): proc/readproc.c: In function 'statm2proc' proc/readproc.c:627:9: warning: variable 'num' set but not used [-Wunused-but-set-variable] ps/output.c: In function 'pr_context': ps/output.c:1273:14: warning: unused variable 'tried_load' [-Wunused-variable] ps/output.c:1272:16: warning: unused variable 'ps_is_selinux_enabled' [-Wunused-variable] ps/output.c:1272:16: warning: 'ps_is_selinux_enabled' defined but not used [-Wunused-variable] ps/output.c:1273:14: warning: 'tried_load' defined but not used [-Wunused-variable] ps/output.c:1837:18: warning: 'shortsort_array_count' defined but not used [-Wunused-const-variable=] ps/output.c:1803:18: warning: 'aix_array_count' defined but not used [-Wunused-const-variable=] ps/parser.c: In function 'arg_type': ps/parser.c:1098:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation] ps/parser.c:1099:34: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' ps/sortformat.c: In function 'format_parse': ps/sortformat.c:241:1: warning: label 'out' defined but not used [-Wunused-label] ps/stacktrace.c:176:13: warning: 'stack_trace_sigsegv' defined but not used [-Wunused-function] watch.c: In function 'process_ansi': watch.c:234:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation] watch.c:237:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
f6f859c8f3
commit
629fa81b57
1
free.c
1
free.c
@ -202,7 +202,6 @@ static void check_unit_set(int *unit_set)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int c, flags = 0, unit_set = 0;
|
int c, flags = 0, unit_set = 0;
|
||||||
char *endptr;
|
|
||||||
struct commandline_arguments args;
|
struct commandline_arguments args;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -624,11 +624,9 @@ LEAVE(0x160);
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static void statm2proc(const char* s, proc_t *restrict P) {
|
static void statm2proc(const char* s, proc_t *restrict P) {
|
||||||
int num;
|
sscanf(s, "%ld %ld %ld %ld %ld %ld %ld",
|
||||||
num = sscanf(s, "%ld %ld %ld %ld %ld %ld %ld",
|
|
||||||
&P->size, &P->resident, &P->share,
|
&P->size, &P->resident, &P->share,
|
||||||
&P->trs, &P->lrs, &P->drs, &P->dt);
|
&P->trs, &P->lrs, &P->drs, &P->dt);
|
||||||
/* fprintf(stderr, "statm2proc converted %d fields.\n",num); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int file2str(const char *directory, const char *what, struct utlbuf_s *ub) {
|
static int file2str(const char *directory, const char *what, struct utlbuf_s *ub) {
|
||||||
|
11
ps/output.c
11
ps/output.c
@ -1262,13 +1262,14 @@ static int pr_lxcname(char *restrict const outbuf, const proc_t *restrict const
|
|||||||
static int pr_context(char *restrict const outbuf, const proc_t *restrict const pp){
|
static int pr_context(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||||
static void (*ps_freecon)(char*) = 0;
|
static void (*ps_freecon)(char*) = 0;
|
||||||
static int (*ps_getpidcon)(pid_t pid, char **context) = 0;
|
static int (*ps_getpidcon)(pid_t pid, char **context) = 0;
|
||||||
static int (*ps_is_selinux_enabled)(void) = 0;
|
static int selinux_enabled = 0;;
|
||||||
static int tried_load = 0;
|
|
||||||
static int selinux_enabled = 0;
|
|
||||||
size_t len;
|
size_t len;
|
||||||
char *context;
|
char *context;
|
||||||
|
|
||||||
#if ENABLE_LIBSELINUX
|
#if ENABLE_LIBSELINUX
|
||||||
|
static int (*ps_is_selinux_enabled)(void) = 0;
|
||||||
|
static int tried_load = 0;
|
||||||
|
|
||||||
if(!ps_getpidcon && !tried_load){
|
if(!ps_getpidcon && !tried_load){
|
||||||
void *handle = dlopen("libselinux.so.1", RTLD_NOW);
|
void *handle = dlopen("libselinux.so.1", RTLD_NOW);
|
||||||
if(handle){
|
if(handle){
|
||||||
@ -1792,7 +1793,7 @@ static const aix_struct aix_array[] = {
|
|||||||
{'z', "vsz", "VSZ"},
|
{'z', "vsz", "VSZ"},
|
||||||
{'~', "~", "~"} /* NULL would ruin alphabetical order */
|
{'~', "~", "~"} /* NULL would ruin alphabetical order */
|
||||||
};
|
};
|
||||||
static const int aix_array_count = sizeof(aix_array)/sizeof(aix_struct);
|
//static const int aix_array_count = sizeof(aix_array)/sizeof(aix_struct);
|
||||||
|
|
||||||
|
|
||||||
/********************* sorting ***************************/
|
/********************* sorting ***************************/
|
||||||
@ -1826,7 +1827,7 @@ static const shortsort_struct shortsort_array[] = {
|
|||||||
{'y', "priority" }, /* nice */
|
{'y', "priority" }, /* nice */
|
||||||
{'~', "~" } /* NULL would ruin alphabetical order */
|
{'~', "~" } /* NULL would ruin alphabetical order */
|
||||||
};
|
};
|
||||||
static const int shortsort_array_count = sizeof(shortsort_array)/sizeof(shortsort_struct);
|
//static const int shortsort_array_count = sizeof(shortsort_array)/sizeof(shortsort_struct);
|
||||||
|
|
||||||
|
|
||||||
/*********** print format_array **********/
|
/*********** print format_array **********/
|
||||||
|
@ -1096,7 +1096,7 @@ static int arg_type(const char *str){
|
|||||||
if((tmp>='a') && (tmp<='z')) return ARG_GNU;
|
if((tmp>='a') && (tmp<='z')) return ARG_GNU;
|
||||||
if((tmp>='A') && (tmp<='Z')) return ARG_GNU;
|
if((tmp>='A') && (tmp<='Z')) return ARG_GNU;
|
||||||
if(tmp=='\0') return ARG_END;
|
if(tmp=='\0') return ARG_END;
|
||||||
return ARG_FAIL;
|
return ARG_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First assume sysv, because that is the POSIX and Unix98 standard. */
|
/* First assume sysv, because that is the POSIX and Unix98 standard. */
|
||||||
|
@ -238,7 +238,7 @@ static const char *format_parse(sf_node *sfn){
|
|||||||
need_item=0;
|
need_item=0;
|
||||||
}
|
}
|
||||||
} while (*++walk);
|
} while (*++walk);
|
||||||
out:
|
|
||||||
if(!items){
|
if(!items){
|
||||||
free(buf);
|
free(buf);
|
||||||
goto empty;
|
goto empty;
|
||||||
|
@ -173,10 +173,12 @@ void debug(int method, char *prog_name){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************/
|
/************/
|
||||||
|
#if 0
|
||||||
static void stack_trace_sigsegv(int signum){
|
static void stack_trace_sigsegv(int signum){
|
||||||
(void)signum;
|
(void)signum;
|
||||||
debug(STACK_TRACE, stored_prog_name);
|
debug(STACK_TRACE, stored_prog_name);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************/
|
/************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
4
watch.c
4
watch.c
@ -234,8 +234,8 @@ static void process_ansi(FILE * fp)
|
|||||||
if (buf[0] == '\0')
|
if (buf[0] == '\0')
|
||||||
set_ansi_attribute(0);
|
set_ansi_attribute(0);
|
||||||
|
|
||||||
for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) {
|
for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) {
|
||||||
if (!set_ansi_attribute(strtol(numstart, &endptr, 10)))
|
if (!set_ansi_attribute(strtol(numstart, &endptr, 10)))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user