Skip to content

Commit aede812

Browse files
blairstevencarlgsmith
authored andcommitted
Strip temporary NULL values from apteryx_query tree
1 parent 204d80a commit aede812

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

apteryx.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,9 +1663,6 @@ apteryx_query_full (GNode *root)
16631663
rpc_msg_encode_uint8 (&msg, MODE_QUERY);
16641664
rpc_msg_encode_tree (&msg, root);
16651665

1666-
/* Now that the node has been encoded, strip the NULL nodes back off again */
1667-
g_node_traverse (root, G_IN_ORDER, G_TRAVERSE_LEAVES, -1, remove_null_data, NULL);
1668-
16691666
if (!rpc_msg_send (rpc_client, &msg))
16701667
{
16711668
ERROR ("QUERY: No response Path(%s)\n", path);
@@ -1740,13 +1737,19 @@ apteryx_query_full (GNode *root)
17401737
GNode *
17411738
apteryx_query (GNode *root)
17421739
{
1740+
GNode *query_result;
17431741
/* the g_node tree that gets passed in here it different from an apteryx tree
17441742
* used for get / set tree operations - value leaf nodes don't get created.
17451743
* We need them for the encode tree, so add them now.
17461744
*/
17471745
ASSERT (root, return NULL, "QUERY: Invalid parameters\n");
17481746
g_node_traverse (root, G_IN_ORDER, G_TRAVERSE_LEAVES, -1, add_null_data, NULL);
1749-
return apteryx_query_full (root);
1747+
1748+
query_result = apteryx_query_full (root);
1749+
1750+
/* Now that the node has been encoded, strip the NULL nodes back off again */
1751+
g_node_traverse (root, G_IN_ORDER, G_TRAVERSE_LEAVES, -1, remove_null_data, NULL);
1752+
return query_result;
17501753
}
17511754

17521755
GList *

0 commit comments

Comments
 (0)