No longer require wrapping return values in Variables

This commit is contained in:
Pierre Pronchery 2014-04-25 19:37:41 +08:00
parent 5c465ed0bd
commit 7dec2e7e3b
3 changed files with 15 additions and 5 deletions

View File

@ -114,8 +114,8 @@ char const * appclient_get_app(AppClient * appclient)
/* useful */ /* useful */
/* appclient_call */ /* appclient_call */
int appclient_call(AppClient * appclient, Variable ** result, int appclient_call(AppClient * appclient,
char const * function, ...) void ** result, char const * function, ...)
{ {
int ret; int ret;
size_t cnt; size_t cnt;

View File

@ -387,16 +387,26 @@ int appinterface_get_args_count(AppInterface * appinterface, size_t * count,
/* useful */ /* useful */
/* appinterface_callv */ /* appinterface_callv */
int appinterface_callv(AppInterface * appinterface, Variable ** result, int appinterface_callv(AppInterface * appinterface, void ** result,
char const * method, size_t argc, Variable ** argv) char const * method, size_t argc, Variable ** argv)
{ {
int ret;
AppInterfaceCall * call; AppInterfaceCall * call;
Variable * r = NULL;
if((call = _appinterface_get_call(appinterface, method)) == NULL) if((call = _appinterface_get_call(appinterface, method)) == NULL)
return -1; return -1;
if(argc != call->args_cnt) if(argc != call->args_cnt)
return -1; return -1;
return marshall_call(call->type.type, result, call->func, argc, argv); if((ret = marshall_call(call->type.type, &r, call->func, argc, argv))
== 0 && r != NULL)
{
if(result != NULL)
/* XXX return 0 anyway? */
ret = variable_get_as(r, call->type.type, *result);
variable_delete(r);
}
return ret;
} }

View File

@ -41,7 +41,7 @@ int appinterface_get_args_count(AppInterface * appinterface, size_t * count,
char const * function); char const * function);
/* useful */ /* useful */
int appinterface_callv(AppInterface * appinterface, Variable ** result, int appinterface_callv(AppInterface * appinterface, void ** result,
char const * method, size_t argc, Variable ** argv); char const * method, size_t argc, Variable ** argv);
#endif /* !LIBAPP_APPINTERFACE_H */ #endif /* !LIBAPP_APPINTERFACE_H */