Clean up code in preparation for using gcc warnings.
This commit is contained in:
parent
0937d6c367
commit
5df6b80093
19 changed files with 22 additions and 44 deletions
|
@ -17,8 +17,7 @@ _PROTOTYPE(double cabs, (struct complex p_compl ));
|
|||
/* $Header$ */
|
||||
|
||||
double
|
||||
hypot(x, y)
|
||||
double x, y;
|
||||
hypot(double x, double y)
|
||||
{
|
||||
/* Computes sqrt(x*x+y*y), avoiding overflow */
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ int sys_umap_data_fb(endpoint_t ep, vir_bytes buf, vir_bytes len, phys_bytes *ph
|
|||
|
||||
void *alloc_contig(size_t len, int flags, phys_bytes *phys)
|
||||
{
|
||||
int r;
|
||||
vir_bytes buf;
|
||||
int mmapflags = MAP_PREALLOC|MAP_CONTIG|MAP_ANON;
|
||||
|
||||
|
|
|
@ -181,8 +181,8 @@ int ds_retrieve_map(const char *ds_name, char *vaddr, size_t *length,
|
|||
return r;
|
||||
|
||||
/* Do the safemap. */
|
||||
if(*length > m.DS_VAL_LEN)
|
||||
*length = m.DS_VAL_LEN;
|
||||
if(*length > (size_t) m.DS_VAL_LEN)
|
||||
*length = (size_t) m.DS_VAL_LEN;
|
||||
*length = (size_t) CLICK_FLOOR(*length);
|
||||
r = sys_safemap(DS_PROC_NR, m.DS_VAL, 0,
|
||||
(vir_bytes)vaddr, *length, D, 0);
|
||||
|
|
|
@ -28,7 +28,8 @@ int max_len; /* maximum length of value */
|
|||
message m;
|
||||
static char mon_params[128*sizeof(char *)]; /* copy parameters here */
|
||||
char *key_value;
|
||||
int i, s, keylen;
|
||||
int i, s;
|
||||
size_t keylen;
|
||||
|
||||
if (key == NULL)
|
||||
return EINVAL;
|
||||
|
@ -43,7 +44,7 @@ int max_len; /* maximum length of value */
|
|||
if (env_argv[i][keylen] != '=')
|
||||
continue;
|
||||
key_value= env_argv[i]+keylen+1;
|
||||
if (strlen(key_value)+1 > max_len)
|
||||
if (strlen(key_value)+1 > (size_t) max_len)
|
||||
return(E2BIG);
|
||||
strcpy(value, key_value);
|
||||
return OK;
|
||||
|
@ -67,7 +68,7 @@ int max_len; /* maximum length of value */
|
|||
/* Value found, see if it fits in the client's buffer. Callers assume that
|
||||
* their buffer is unchanged on error, so don't make a partial copy.
|
||||
*/
|
||||
if ((strlen(key_value)+1) > max_len) return(E2BIG);
|
||||
if ((strlen(key_value)+1) > (size_t) max_len) return(E2BIG);
|
||||
|
||||
/* Make the actual copy. */
|
||||
strcpy(value, key_value);
|
||||
|
|
|
@ -118,7 +118,7 @@ int maxchunks; /* how many were found */
|
|||
return -1;
|
||||
s = memstr;
|
||||
for (i = 0; i < maxchunks && !done; i++) {
|
||||
phys_bytes base = 0, size = 0, limit;
|
||||
phys_bytes base = 0, size = 0;
|
||||
memp = &mem_chunks[i]; /* next mem chunk is stored here */
|
||||
if (*s != 0) { /* get fresh data, unless at end */
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ static double make_double(u64_t d)
|
|||
* This whole thing should be replaced by something better eventually.
|
||||
*/
|
||||
double value;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
value = (double) ex64hi(d);
|
||||
for (i = 0; i < sizeof(unsigned long); i += 2)
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
PUBLIC int _kernel_call(int syscallnr, message *msgptr)
|
||||
{
|
||||
int status;
|
||||
|
||||
msgptr->m_type = syscallnr;
|
||||
_do_kernel_call(msgptr);
|
||||
return(msgptr->m_type);
|
||||
|
|
|
@ -14,12 +14,10 @@ static char print_buf[DIAG_BUFSIZE]; /* output is buffered here */
|
|||
/*===========================================================================*
|
||||
* kputc *
|
||||
*===========================================================================*/
|
||||
void kputc(c)
|
||||
int c;
|
||||
void kputc(int c)
|
||||
{
|
||||
/* Accumulate another character. If 0 or buffer full, print it. */
|
||||
static int buf_count; /* # characters in the buffer */
|
||||
message m;
|
||||
|
||||
if ((c == 0 && buf_count > 0) || buf_count == sizeof(print_buf)) {
|
||||
sys_sysctl(SYSCTL_CODE_DIAG, print_buf, buf_count);
|
||||
|
|
|
@ -15,7 +15,6 @@ PUBLIC void panic(const char *fmt, ...)
|
|||
* inconsistency is detected, e.g., a programming error or illegal
|
||||
* value of a defined constant.
|
||||
*/
|
||||
message m;
|
||||
endpoint_t me = NONE;
|
||||
char name[20];
|
||||
void (*suicide)(void);
|
||||
|
|
|
@ -29,10 +29,8 @@ int devind;
|
|||
/*===========================================================================*
|
||||
* pci_reserve_ok *
|
||||
*===========================================================================*/
|
||||
PUBLIC int pci_reserve_ok(devind)
|
||||
int devind;
|
||||
PUBLIC int pci_reserve_ok(int devind)
|
||||
{
|
||||
int r;
|
||||
message m;
|
||||
|
||||
m.m1_i1= devind;
|
||||
|
|
|
@ -39,20 +39,16 @@ PRIVATE int cprof_announce; /* announce on n-th execution
|
|||
* of procentry */
|
||||
PRIVATE int cprof_locked; /* for reentrancy */
|
||||
|
||||
_PROTOTYPE(void procentry, (char *name) );
|
||||
_PROTOTYPE(void procexit, (char *name) );
|
||||
|
||||
FORWARD _PROTOTYPE(void cprof_init, (void) );
|
||||
FORWARD _PROTOTYPE(void reset, (void) );
|
||||
FORWARD _PROTOTYPE(void clear_tbl, (void) );
|
||||
|
||||
|
||||
PUBLIC void procentry (name)
|
||||
char *name;
|
||||
PUBLIC void procentry (char *name)
|
||||
{
|
||||
static int init = 0;
|
||||
unsigned hash = 0, i = 0, x = 0;
|
||||
unsigned long hi, lo;
|
||||
unsigned hash = 0, x = 0;
|
||||
int i = 0;
|
||||
struct cprof_tbl_s *last;
|
||||
char c;
|
||||
u64_t start;
|
||||
|
@ -171,8 +167,7 @@ char *name;
|
|||
}
|
||||
|
||||
|
||||
PUBLIC void procexit (name)
|
||||
char *name;
|
||||
PUBLIC void procexit (char *name)
|
||||
{
|
||||
u64_t stop, spent;
|
||||
|
||||
|
@ -227,8 +222,8 @@ char *name;
|
|||
}
|
||||
|
||||
|
||||
PRIVATE void cprof_init() {
|
||||
message m;
|
||||
PRIVATE void cprof_init()
|
||||
{
|
||||
int i;
|
||||
|
||||
cpath[0] = '\0';
|
||||
|
|
|
@ -249,11 +249,8 @@ cpf_lookup(cp_grant_id_t g, endpoint_t *granter, endpoint_t *grantee)
|
|||
}
|
||||
|
||||
PUBLIC int
|
||||
cpf_getgrants(grant_ids, n)
|
||||
cp_grant_id_t *grant_ids;
|
||||
int n;
|
||||
cpf_getgrants(cp_grant_id_t *grant_ids, int n)
|
||||
{
|
||||
cp_grant_id_t g;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < n; i++) {
|
||||
|
|
|
@ -124,7 +124,6 @@ PRIVATE void sef_debug_refresh_params(void)
|
|||
{
|
||||
/* Refresh SEF debug params. */
|
||||
clock_t uptime;
|
||||
endpoint_t endpoint;
|
||||
int r;
|
||||
|
||||
/* Get boottime the first time. */
|
||||
|
@ -174,7 +173,7 @@ PUBLIC char* sef_debug_header(void)
|
|||
/* Build and return a SEF debug header. */
|
||||
sef_debug_refresh_params();
|
||||
sprintf(sef_debug_header_buff, "%s: time = %ds %06dus",
|
||||
sef_self_name, sef_debug_time_sec, sef_debug_time_us);
|
||||
sef_self_name, (int) sef_debug_time_sec, (int) sef_debug_time_us);
|
||||
|
||||
return sef_debug_header_buff;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ PUBLIC int sys_whoami(endpoint_t *who_ep, char *who_name, int len)
|
|||
if((r = _kernel_call(SYS_GETINFO, &m)) != OK)
|
||||
return r;
|
||||
|
||||
lenmin = MIN(len, sizeof(m.GIWHO_NAME)) - 1;
|
||||
lenmin = MIN((size_t) len, sizeof(m.GIWHO_NAME)) - 1;
|
||||
|
||||
strncpy(who_name, m.GIWHO_NAME, lenmin);
|
||||
who_name[lenmin] = '\0';
|
||||
|
|
|
@ -12,7 +12,6 @@ int count; /* number of elements */
|
|||
vir_bytes offset; /* offset from grant */
|
||||
{
|
||||
message m_io;
|
||||
int result;
|
||||
|
||||
m_io.DIO_REQUEST = req;
|
||||
m_io.DIO_PORT = port;
|
||||
|
|
|
@ -97,7 +97,6 @@ PUBLIC int sys_vmctl_get_mapping(int index,
|
|||
|
||||
PUBLIC int sys_vmctl_reply_mapping(int index, vir_bytes addr)
|
||||
{
|
||||
int r;
|
||||
message m;
|
||||
|
||||
m.SVMCTL_WHO = SELF;
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
|
||||
void util_timer_start(util_timingdata_t *timingdata, char *name)
|
||||
{
|
||||
unsigned long h, l;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
if(timingdata->names[0] == '\0') {
|
||||
for(i = 0; i < sizeof(timingdata->names) && *name; i++)
|
||||
|
@ -32,7 +31,7 @@ void util_timer_start(util_timingdata_t *timingdata, char *name)
|
|||
|
||||
void util_timer_end(util_timingdata_t *timingdata)
|
||||
{
|
||||
unsigned long h, l, d = 0, binsize;
|
||||
unsigned long h, l, d = 0;
|
||||
int bin;
|
||||
|
||||
read_tsc(&h, &l);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
PUBLIC int vm_brk(endpoint_t ep, char *addr)
|
||||
{
|
||||
message m;
|
||||
int result;
|
||||
|
||||
m.VMB_ENDPOINT = ep;
|
||||
m.VMB_ADDR = (void *) addr;
|
||||
|
|
|
@ -26,7 +26,6 @@ PUBLIC void *vm_map_phys(endpoint_t who, void *phaddr, size_t len)
|
|||
PUBLIC int vm_unmap_phys(endpoint_t who, void *vaddr, size_t len)
|
||||
{
|
||||
message m;
|
||||
int r;
|
||||
|
||||
m.VMUP_EP = who;
|
||||
m.VMUP_VADDR = vaddr;
|
||||
|
|
Loading…
Reference in a new issue