misc: compiler warning fixes
Fix few compiler warnings. Some of these warnings appeared multiple times, and the listing bellow is more about which sort of errors where fixed. devname.c:87:12: warning: comparison of integers of different signs: 'int' and 'unsigned long' output.c:389:36: warning: passing 'char **const' to parameter of type 'const char *const restrict *' discards qualifiers in nested pointer types output.c:611:31: warning: comparison of integers of different signs: 'const unsigned long' and 'int' stacktrace.c:33:37: warning: unused parameter 'signum' Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
1ef14f4bf9
commit
c1fa3bfce8
@ -70,7 +70,7 @@ static void load_drivers(void){
|
||||
p = buf;
|
||||
while(( p = strstr(p, " /dev/") )){ // " /dev/" is the second column
|
||||
tty_map_node *tmn;
|
||||
int len;
|
||||
size_t len;
|
||||
char *end;
|
||||
p += 6;
|
||||
end = strchr(p, ' ');
|
||||
|
@ -153,7 +153,7 @@ int escape_str(char *restrict dst, const char *restrict src, int bufsize, int *m
|
||||
// escape an argv or environment string array
|
||||
//
|
||||
// bytes arg means sizeof(buf)
|
||||
int escape_strlist(char *restrict dst, const char *restrict const *restrict src, size_t bytes, int *cells){
|
||||
int escape_strlist(char *restrict dst, char *restrict const *restrict src, size_t bytes, int *cells){
|
||||
size_t i = 0;
|
||||
|
||||
for(;;){
|
||||
@ -175,7 +175,7 @@ int escape_command(char *restrict const outbuf, const proc_t *restrict const pp,
|
||||
int end = 0;
|
||||
|
||||
if(flags & ESC_ARGS){
|
||||
const char **lc = (const char**)pp->cmdline;
|
||||
char **lc = (char**)pp->cmdline;
|
||||
if(lc && *lc) return escape_strlist(outbuf, lc, bytes, cells);
|
||||
}
|
||||
if(flags & ESC_BRACKETS){
|
||||
|
@ -14,7 +14,7 @@ EXTERN_C_BEGIN
|
||||
#define ESC_BRACKETS 0x2 // if using cmd, put '[' and ']' around it
|
||||
#define ESC_DEFUNCT 0x4 // mark zombies with " <defunct>"
|
||||
|
||||
extern int escape_strlist(char *restrict dst, const char *restrict const *restrict src, size_t n, int *cells);
|
||||
extern int escape_strlist(char *restrict dst, char *restrict const *restrict src, size_t n, int *cells);
|
||||
extern int escape_str(char *restrict dst, const char *restrict src, int bufsize, int *maxcells);
|
||||
extern int escape_command(char *restrict const outbuf, const proc_t *restrict const pp, int bytes, int *cells, unsigned flags);
|
||||
extern int escaped_copy(char *restrict dst, const char *restrict src, int bufsize, int *maxroom);
|
||||
|
@ -77,7 +77,6 @@ static unsigned max_leftward = 0x12345678; /* space for LEFT stuff */
|
||||
static int wide_signals; /* true if we have room */
|
||||
|
||||
static time_t seconds_since_1970;
|
||||
static time_t time_of_boot;
|
||||
static unsigned long page_shift;
|
||||
|
||||
|
||||
@ -625,7 +624,7 @@ static int pr_pri_api(char *restrict const outbuf, const proc_t *restrict const
|
||||
}
|
||||
|
||||
static int pr_nice(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
if(pp->sched!=0 && pp->sched!=-1) return snprintf(outbuf, COLWID, "-");
|
||||
if(pp->sched!=0 && pp->sched!=(unsigned long)-1) return snprintf(outbuf, COLWID, "-");
|
||||
return snprintf(outbuf, COLWID, "%ld", pp->nice);
|
||||
}
|
||||
|
||||
@ -662,11 +661,11 @@ static int pr_class(char *restrict const outbuf, const proc_t *restrict const pp
|
||||
// default "%u:%u", type, prio
|
||||
// We just print the priority, and have other keywords for type.
|
||||
static int pr_rtprio(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
if(pp->sched==0 || pp->sched==-1) return snprintf(outbuf, COLWID, "-");
|
||||
if(pp->sched==0 || pp->sched==(unsigned long)-1) return snprintf(outbuf, COLWID, "-");
|
||||
return snprintf(outbuf, COLWID, "%ld", pp->rtprio);
|
||||
}
|
||||
static int pr_sched(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
if(pp->sched==-1) return snprintf(outbuf, COLWID, "-");
|
||||
if(pp->sched==(unsigned long)-1) return snprintf(outbuf, COLWID, "-");
|
||||
return snprintf(outbuf, COLWID, "%ld", pp->sched);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ static void debug_stop(char **args){
|
||||
}
|
||||
|
||||
/***********/
|
||||
static void stack_trace_sigchld(int signum){
|
||||
static void stack_trace_sigchld(int signum __attribute__ ((__unused__))){
|
||||
stack_trace_done = 1;
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ void debug(int method, char *prog_name){
|
||||
}
|
||||
|
||||
/************/
|
||||
static void stack_trace_sigsegv(int signum){
|
||||
static void stack_trace_sigsegv(int signum __attribute__ ((__unused__))){
|
||||
debug(STACK_TRACE, stored_prog_name);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user