From d24e929fd95760f84c556b6385d97d503c9335ef Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Mon, 12 Jun 2017 15:16:50 +0200 Subject: [PATCH] Added private function ZakForm::get_module_new. --- src/form.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/form.c b/src/form.c index 226ca90..bdf2104 100644 --- a/src/form.c +++ b/src/form.c @@ -279,37 +279,52 @@ zak_form_form_element_xml_parsing (ZakFormForm *zakform, ZakFormElement *element } /** - * zak_form_get_form_validator: + * _zak_form_get_module_new: * @zakform: * @namespace: * - * Returns: + * Returns: the constructor (_new) function for the module. */ -ZakFormElementValidatorConstructorFunc -zak_form_get_form_element_validator (ZakFormForm *zakform, const gchar *namespace) +static gpointer +_zak_form_get_module_new (ZakFormForm *zakform, const gchar *namespace) { - ZakFormFormPrivate *priv; + gpointer ret; - ZakFormElementValidatorConstructorFunc validator_constructor; + ZakFormFormPrivate *priv; guint i; - g_return_val_if_fail (ZAK_FORM_IS_FORM (zakform), NULL); - priv = zak_form_form_get_instance_private (zakform); - validator_constructor = NULL; - for (i = 0; i < priv->ar_modules->len; i++) { if (g_module_symbol ((GModule *)g_ptr_array_index (priv->ar_modules, i), g_strconcat (namespace, "_new", NULL), - (gpointer *)&validator_constructor)) + (gpointer *)&ret)) { break; } } + return ret; +} + +/** + * zak_form_get_form_element_validator: + * @zakform: + * @namespace: + * + * Returns: + */ +ZakFormElementValidatorConstructorFunc +zak_form_get_form_element_validator (ZakFormForm *zakform, const gchar *namespace) +{ + ZakFormElementValidatorConstructorFunc validator_constructor; + + g_return_val_if_fail (ZAK_FORM_IS_FORM (zakform), NULL); + + validator_constructor = (ZakFormElementValidatorConstructorFunc)_zak_form_get_module_new (zakform, namespace); + return validator_constructor; } -- 2.49.0