(iOS) Style nits - menu/disp/ios.c

This commit is contained in:
twinaphex 2014-11-09 14:43:10 +01:00
parent 47b014d3cd
commit 7f1fb3e0cd
2 changed files with 35 additions and 31 deletions

View File

@ -19,47 +19,46 @@
#include "../../general.h"
#include "ios.h"
static void* ios_init () {
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
if (menu == NULL) {
return NULL;
}
static void *ios_init(void)
{
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
if (!menu)
return NULL;
menu->userdata = (ios_handle_t*)calloc(1, sizeof(ios_handle_t));
if (menu->userdata == NULL) {
free(menu);
return NULL;
}
menu->userdata = (ios_handle_t*)calloc(1, sizeof(ios_handle_t));
if (!menu->userdata)
{
free(menu);
return NULL;
}
return menu;
return menu;
}
static void ios_free ( void* data ) {
menu_handle_t *menu = (menu_handle_t*)data;
if (menu == NULL) {
return;
}
static void ios_free(void *data)
{
menu_handle_t *menu = (menu_handle_t*)data;
if (!menu)
return;
if (menu->userdata != NULL) {
free(menu->userdata);
}
if (menu->userdata)
free(menu->userdata);
free(menu);
return;
free(menu);
return;
}
static int menu_ios_iterate(unsigned action) {
ios_handle_t *ih = NULL;
if (driver.menu == NULL) {
return 0;
}
static int menu_ios_iterate(unsigned action)
{
ios_handle_t *ih = NULL;
if (!driver.menu)
return 0;
ih = (ios_handle_t*)driver.menu->userdata;
if ( ih->switch_to_ios != NULL ) {
ih->switch_to_ios();
}
ih = (ios_handle_t*)driver.menu->userdata;
if (ih->switch_to_ios)
ih->switch_to_ios();
return 0;
return 0;
}
menu_ctx_driver_backend_t menu_ctx_backend_ios = {

View File

@ -13,6 +13,11 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _MENU_DISP_IOS_H
#define _MENU_DISP_IOS_H
typedef struct ios_handle {
void (*switch_to_ios)(void);
} ios_handle_t;
#endif