Code cleanup

This commit is contained in:
Pierre Pronchery 2014-04-17 02:35:58 +02:00
parent a8d343f3bb
commit e87b1cd21d

View File

@ -144,8 +144,10 @@ StringEnum _string_type[] =
/* prototypes */
static int _string_enum(String const * string, StringEnum * se);
/* accessors */
static AppInterfaceCall * _appinterface_get_call(AppInterface * appinterface,
char const * call);
char const * method);
/* functions */
@ -165,25 +167,6 @@ static int _string_enum(String const * string, StringEnum * se)
}
/* appinterface_get_call */
static AppInterfaceCall * _appinterface_get_call(AppInterface * appinterface,
String const * call)
{
size_t i;
for(i = 0; i < appinterface->calls_cnt; i++)
if(string_compare(appinterface->calls[i].name, call) == 0)
break;
if(i == appinterface->calls_cnt)
{
error_set_code(1, "%s%s%s%s", "Unknown call ", call,
" for interface ", appinterface->name);
return NULL;
}
return &appinterface->calls[i];
}
/* public */
/* functions */
/* appinterface_new */
@ -422,8 +405,28 @@ int appinterface_get_args_count(AppInterface * appinterface, size_t * count,
/* useful */
/* appinterface_callv */
int appinterface_callv(AppInterface * appinterface, Variable ** result,
char const * function, size_t argc, Variable ** argv)
char const * method, size_t argc, Variable ** argv)
{
AppInterfaceCall * call;
if((call = _appinterface_get_call(appinterface, method)) == NULL)
return -1;
/* FIXME implement */
return -1;
}
/* private */
/* appinterface_get_call */
static AppInterfaceCall * _appinterface_get_call(AppInterface * appinterface,
String const * method)
{
size_t i;
for(i = 0; i < appinterface->calls_cnt; i++)
if(string_compare(appinterface->calls[i].name, method) == 0)
return &appinterface->calls[i];
error_set_code(1, "%s%s%s%s", "Unknown call \"", method,
"\" for interface ", appinterface->name);
return NULL;
}