summaryrefslogtreecommitdiff
path: root/json-glib/json-node.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2009-04-14 00:09:35 +0100
committerEmmanuele Bassi <ebassi@linux.intel.com>2009-04-14 00:09:35 +0100
commitf9956b4eadcfc9bbd5c0bc4b861ff782779e8a9a (patch)
tree8e91d6459d912058c497bc1a75888a8a3e6f72ae /json-glib/json-node.c
parente2c65a75d68aafa26f2084928e732961e48beb99 (diff)
downloadjson-glib-f9956b4eadcfc9bbd5c0bc4b861ff782779e8a9a.tar.gz
[node] Do not overwrite when copying
Bug 1353 - Copying JSON_NODE_VALUE nodes unreliable at best When copying a JsonNode to another we do an implicit memcpy using: *copy = *src Which works well enough with pointers, but makes a mess out of the value-based nodes. We should just copy the type of the original JsonNode and leave the rest to the switch() block. In order to catch potential regressions, we also need a more thorough test unit for the JsonNode copy operation.
Diffstat (limited to 'json-glib/json-node.c')
-rw-r--r--json-glib/json-node.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/json-glib/json-node.c b/json-glib/json-node.c
index b0f6bef..7043de3 100644
--- a/json-glib/json-node.c
+++ b/json-glib/json-node.c
@@ -131,7 +131,7 @@ json_node_copy (JsonNode *node)
g_return_val_if_fail (node != NULL, NULL);
copy = g_slice_new0 (JsonNode);
- *copy = *node;
+ copy->type = node->type;
switch (copy->type)
{