[evolution-ews] ESoapResponse: Allow NULL for some traversal functions
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] ESoapResponse: Allow NULL for some traversal functions
- Date: Tue, 4 Oct 2022 09:03:36 +0000 (UTC)
commit e5acd97cc1ebb266a956b170c973c25e90dbb6f1
Author: Milan Crha <mcrha redhat com>
Date: Tue Oct 4 11:00:32 2022 +0200
ESoapResponse: Allow NULL for some traversal functions
This way the caller can safely pass any node and the function will
return proper value, NULL or non-NULL. It can make the caller's code
simpler.
src/EWS/common/e-soap-response.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/EWS/common/e-soap-response.c b/src/EWS/common/e-soap-response.c
index 269d9d08..4919e630 100644
--- a/src/EWS/common/e-soap-response.c
+++ b/src/EWS/common/e-soap-response.c
@@ -681,7 +681,7 @@ e_soap_parameter_get_string_value (ESoapParameter *param)
/**
* e_soap_parameter_get_first_child:
- * @param: An #ESoapParameter.
+ * @param: (nullable): An #ESoapParameter.
*
* Gets the first child of the given #ESoapParameter. This is used
* for compound data types, which can contain several parameters
@@ -692,14 +692,15 @@ e_soap_parameter_get_string_value (ESoapParameter *param)
ESoapParameter *
e_soap_parameter_get_first_child (ESoapParameter *param)
{
- g_return_val_if_fail (param != NULL, NULL);
+ if (!param)
+ return NULL;
return soup_xml_real_node (param->children);
}
/**
* e_soap_parameter_get_first_child_by_name:
- * @param: An #ESoapParameter.
+ * @param: (nullable): An #ESoapParameter.
* @name: The name of the child parameter to look for.
*
* Gets the first child of the given #ESoapParameter whose name is
@@ -714,7 +715,6 @@ e_soap_parameter_get_first_child_by_name (ESoapParameter *param,
{
ESoapParameter *tmp;
- g_return_val_if_fail (param != NULL, NULL);
g_return_val_if_fail (name != NULL, NULL);
for (tmp = e_soap_parameter_get_first_child (param);
@@ -729,7 +729,7 @@ e_soap_parameter_get_first_child_by_name (ESoapParameter *param,
/**
* e_soap_parameter_get_next_child:
- * @param: An #ESoapParameter.
+ * @param: (nullable): An #ESoapParameter, or %NULL.
*
* Gets the next sibling of the given #ESoapParameter. This is used
* for compound data types, which can contain several parameters
@@ -743,14 +743,15 @@ e_soap_parameter_get_first_child_by_name (ESoapParameter *param,
ESoapParameter *
e_soap_parameter_get_next_child (ESoapParameter *param)
{
- g_return_val_if_fail (param != NULL, NULL);
+ if (!param)
+ return NULL;
return soup_xml_real_node (param->next);
}
/**
* e_soap_parameter_get_next_child_by_name:
- * @param: An #ESoapParameter.
+ * @param: (nullable): An #ESoapParameter.
* @name: The name of the sibling parameter to look for.
*
* Gets the next sibling of the given #ESoapParameter whose name is
@@ -766,7 +767,6 @@ e_soap_parameter_get_next_child_by_name (ESoapParameter *param,
{
ESoapParameter *tmp;
- g_return_val_if_fail (param != NULL, NULL);
g_return_val_if_fail (name != NULL, NULL);
for (tmp = e_soap_parameter_get_next_child (param);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]