testing: remove unused variables in comedi_test program

Remove the global variable 'capabilities' which is set to 0 by the
get_capabilities() function but not used anywhere else.  Remove the
'type' and 'flags' local variables from get_capabilities() which are set
to the return values of comedi_get_subdevice_type() and
comedi_get_subdevice_flags() but never used.  Remove the 'tmp' local
variable from test_segfault(); it was involved in a volatile memory
access to test for segmentation faults.  Still do the volatile memory
access but don't use the variable.
This commit is contained in:
Ian Abbott 2013-05-07 13:15:54 +01:00
parent fdf9d2d98b
commit 82ee0c80e2
2 changed files with 3 additions and 13 deletions

View file

@ -180,19 +180,10 @@ int main(int argc, char *argv[])
return 0;
}
unsigned int capabilities;
static void get_capabilities(unsigned int subd)
{
int type;
int flags;
capabilities = 0;
type = comedi_get_subdevice_type(device,subd);
flags = comedi_get_subdevice_flags(device,subd);
comedi_get_subdevice_type(device,subd);
comedi_get_subdevice_flags(device,subd);
}
static void print_device_info(void)

View file

@ -31,7 +31,6 @@ void segv_handler(int num)
int test_segfault(void *memptr)
{
volatile char tmp;
int ret;
struct sigaction act;
struct sigaction oldact;
@ -45,7 +44,7 @@ int test_segfault(void *memptr)
return 0;
}
ret=sigsetjmp(jump_env, 1);
if(!ret) tmp = *((char *)(memptr));
if(!ret) *((volatile char *)(memptr));
sigaction(SIGSEGV,&oldact,NULL);
return ret;
}