From ebab52f8e03782cf34b9c5e89c1591b66572dff9 Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 20 Jan 2007 14:05:38 +0000 Subject: keypad widget cleanup git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@752 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- widget_gpo.c | 14 ++++++-------- widget_keypad.c | 24 ++++++++++-------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/widget_gpo.c b/widget_gpo.c index 3ac7a4e..2b8ed98 100644 --- a/widget_gpo.c +++ b/widget_gpo.c @@ -106,14 +106,12 @@ int widget_gpo_init(WIDGET * Self) int widget_gpo_quit(WIDGET * Self) { - if (Self) { - if (Self->data) { - WIDGET_GPO *GPO = Self->data; - property_free(&GPO->expression); - property_free(&GPO->update); - free(Self->data); - Self->data = NULL; - } + if (Self && Self->data) { + WIDGET_GPO *GPO = Self->data; + property_free(&GPO->expression); + property_free(&GPO->update); + free(Self->data); + Self->data = NULL; } return 0; } diff --git a/widget_keypad.c b/widget_keypad.c index 6714091..687630d 100644 --- a/widget_keypad.c +++ b/widget_keypad.c @@ -110,14 +110,12 @@ int widget_keypad_init(WIDGET * Self) int widget_keypad_find(WIDGET * Self, void *needle) { WIDGET_KEYPAD *keypad; - unsigned int *n = needle; - - if (Self) { - if (Self->data) { - keypad = Self->data; - if (keypad->key == *n) - return 0; - } + KEYPADKEY key = *(KEYPADKEY *) needle; + + if (Self && Self->data) { + keypad = Self->data; + if (keypad->key == key) + return 0; } return -1; @@ -125,12 +123,10 @@ int widget_keypad_find(WIDGET * Self, void *needle) int widget_keypad_quit(WIDGET * Self) { - if (Self) { - if (Self->data) { - WIDGET_KEYPAD *keypad = Self->data; - property_free(&keypad->expression); - free(Self->data); - } + if (Self && Self->data) { + WIDGET_KEYPAD *keypad = Self->data; + property_free(&keypad->expression); + free(Self->data); Self->data = NULL; } return 0; -- cgit v1.2.3