change extract_int function's return type
This commit is contained in:
parent
f2ff952624
commit
5a5d790715
|
@ -17,23 +17,21 @@ int call_bound_function(Key keycode, int type) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void extract_int(SCM data, int *dest, int hi) {
|
||||
assert(dest != NULL);
|
||||
static int extract_int(SCM data, int hi) {
|
||||
assert(data != NULL);
|
||||
/* guile handles conversion errors, but an assert may help */
|
||||
assert(scm_is_unsigned_integer(data, 0, hi));
|
||||
/* between the limits, all integer types work except char */
|
||||
*dest = scm_to_signed_integer(data, 0, hi);
|
||||
return scm_to_signed_integer(data, 0, hi);
|
||||
}
|
||||
|
||||
/* bind a function to a key */
|
||||
static SCM bind(SCM key, SCM fun) {
|
||||
int temp;
|
||||
Key keycode;
|
||||
assert(scm_is_true(scm_procedure_p(fun)));
|
||||
/* I think we cannot check for arity from C */
|
||||
|
||||
extract_int(key, &temp, maxkey);
|
||||
keycode = (Key) temp;
|
||||
keycode = (Key) extract_int(key, maxkey);
|
||||
/* we don't bother clearing it first, but an assert won't hurt */
|
||||
assert(bindings[keycode] == NULL);
|
||||
|
||||
|
@ -48,9 +46,7 @@ static SCM bind(SCM key, SCM fun) {
|
|||
|
||||
/* either grab or ungrab the device */
|
||||
static SCM grab_wrapper(SCM data) {
|
||||
int grab;
|
||||
extract_int(data, &grab, 1);
|
||||
return scm_from_bool(set_grab(grab));
|
||||
return scm_from_bool(set_grab(extract_int(data, 1)));
|
||||
}
|
||||
|
||||
/* is the device currently grabbed? */
|
||||
|
@ -64,12 +60,12 @@ static SCM grabbed_p(void) {
|
|||
static SCM led_wrapper(SCM led, SCM on) {
|
||||
/* we will convert this on use because we only use it once, unlike with key
|
||||
in bind() */
|
||||
int ledcode;
|
||||
Led ledcode;
|
||||
int state;
|
||||
/* asserts handle invalid values */
|
||||
extract_int(led, &ledcode, maxled);
|
||||
extract_int(on, &state, 1);
|
||||
return scm_from_bool(set_led((Led)ledcode, state));
|
||||
ledcode = (Led) extract_int(led, maxled);
|
||||
state = extract_int(on, 1);
|
||||
return scm_from_bool(set_led(ledcode, state));
|
||||
}
|
||||
|
||||
/* setup boilerplate */
|
||||
|
|
Loading…
Reference in New Issue