diff options
author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2009-04-26 02:26:14 -0300 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2009-04-26 02:26:14 -0300 |
commit | 0289538420139e59e7c96d33c5856dd11a63f743 (patch) | |
tree | 5b889538fcb05659c4358db22f2458fc082f7f36 | |
parent | e0ae0a16020fe9d2550ca11469f83ee10d2bd23c (diff) |
More cleanups
-rw-r--r-- | hardinfo2/xmlrpc-server.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/hardinfo2/xmlrpc-server.c b/hardinfo2/xmlrpc-server.c index fd326d23..ae045b67 100644 --- a/hardinfo2/xmlrpc-server.c +++ b/hardinfo2/xmlrpc-server.c @@ -84,28 +84,6 @@ struct _MethodParameter { void *variable; }; -static gboolean validate_parameters(SoupMessage *msg, GValueArray *params, - ModuleParameter *module_params, gint n_params) -{ - int i; - - if (params->n_values != n_params) { - args_error(msg, params, n_params); - return FALSE; - } - - for (i = 0; i < n_params; i++) { - if (!soup_value_array_get_nth(params, i, - module_params[i].param_type, - module_params[i].variable)) { - type_error(msg, module_params[i].param_type, params, i); - return FALSE; - } - } - - return TRUE; -} - static void args_error(SoupMessage * msg, GValueArray * params, int expected) { @@ -127,6 +105,28 @@ type_error(SoupMessage * msg, GType expected, GValueArray * params, (¶ms->values[bad_value]))); } +static gboolean validate_parameters(SoupMessage *msg, GValueArray *params, + MethodParameter *method_params, gint n_params) +{ + int i; + + if (params->n_values != n_params) { + args_error(msg, params, n_params); + return FALSE; + } + + for (i = 0; i < n_params; i++) { + if (!soup_value_array_get_nth(params, i, + method_params[i].param_type, + method_params[i].variable)) { + type_error(msg, method_params[i].param_type, params, i); + return FALSE; + } + } + + return TRUE; +} + static void method_get_module_list(SoupMessage * msg, GValueArray * params) { GValueArray *out; @@ -152,7 +152,7 @@ static void method_get_entry_list(SoupMessage * msg, GValueArray * params) GValueArray *out; gboolean found = FALSE; gchar *module_name; - MethodParam method_params[] = { + MethodParameter method_params[] = { { G_TYPE_STRING, &module_name } }; @@ -198,7 +198,7 @@ static void method_entry_get_field(SoupMessage * msg, GValueArray * params) gchar *module_name, *field_name, *answer = NULL; gint entry_number; gboolean found = FALSE; - MethodParam method_params[] = { + MethodParameter method_params[] = { { G_TYPE_STRING, &module_name }, { G_TYPE_INT, &entry_number }, { G_TYPE_STRING, &field_name } @@ -241,7 +241,7 @@ static void method_entry_get_moreinfo(SoupMessage * msg, gchar *module_name, *field_name, *answer = NULL; gint entry_number; gboolean found = FALSE; - MethodParam method_params[] = { + MethodParameter method_params[] = { { G_TYPE_STRING, &module_name }, { G_TYPE_INT, &entry_number }, }; @@ -282,7 +282,7 @@ static void method_entry_reload(SoupMessage * msg, GValueArray * params) gchar *module_name, *field_name; gint entry_number; gboolean found = FALSE, answer = FALSE; - MethodParam method_params[] = { + MethodParameter method_params[] = { { G_TYPE_STRING, &module_name }, { G_TYPE_INT, &entry_number }, { G_TYPE_STRING, &field_name }, @@ -321,7 +321,7 @@ static void method_entry_scan(SoupMessage * msg, GValueArray * params) gchar *module_name; gint entry_number; gboolean found = FALSE, answer = FALSE; - MethodParam method_params[] = { + MethodParameter method_params[] = { { G_TYPE_STRING, &module_name }, { G_TYPE_INT, &entry_number }, }; @@ -359,7 +359,7 @@ static void method_entry_function(SoupMessage * msg, GValueArray * params) gchar *module_name, *answer = NULL; gboolean found = FALSE; gint entry_number; - MethodParam method_params[] = { + MethodParameter method_params[] = { { G_TYPE_STRING, &module_name }, { G_TYPE_INT, &entry_number }, }; |