summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Willmore <Frank.Willmore@hdfgroup.org>2018-01-10 01:09:23 (GMT)
committerFrank Willmore <Frank.Willmore@hdfgroup.org>2018-01-10 01:09:23 (GMT)
commit247b91b3d850689e4091dcc26d1021683c73b9cf (patch)
tree046952937bc9683b89e8d0cc68a5c30d712dbb17
parent6718c8fe74b9e93fd560c6aa92b02657210bd9d4 (diff)
downloadhdf5-247b91b3d850689e4091dcc26d1021683c73b9cf.zip
hdf5-247b91b3d850689e4091dcc26d1021683c73b9cf.tar.gz
hdf5-247b91b3d850689e4091dcc26d1021683c73b9cf.tar.bz2
extracted object reference count management to link insert/delete helper functions
-rw-r--r--src/H5VLjson.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/H5VLjson.c b/src/H5VLjson.c
index 5dbafde..41f00c5 100644
--- a/src/H5VLjson.c
+++ b/src/H5VLjson.c
@@ -6002,11 +6002,28 @@ static herr_t
H5VL_json_delete_link_from_containing_group(H5VL_json_object_t* domain, h5json_uuid_t containing_group_uuid, json_t* link)
{
herr_t ret_value = FAIL;
+char* object_collection_name;
+h5json_uuid_t object_uuid;
FUNC_ENTER_NOAPI_NOINIT
printf("Deleting link %s from group %s\n", json_dumps(link, JSON_INDENT(4)), containing_group_uuid);
+
+/* manage reference count */
+object_collection_name = json_string_value(json_object_get(link, "collection"));
+printf("got collection = %s\n", object_collection_name);
+
+strncpy(object_uuid, json_string_value(json_object_get(link, "id")), sizeof(h5json_uuid_t));
+printf("got object_uuid = %s\n", object_uuid);
+
+json_t* object_collection = json_object_get(domain->object_json, object_collection_name);
+printf("got object_collection = %s\n", json_dumps(object_collection, JSON_INDENT(4)));
+json_t* object_of_interest = json_object_get(object_collection, object_uuid);
+printf("got object_of_interest = %s\n", json_dumps(object_of_interest, JSON_INDENT(4)));
+
+json_decref(object_of_interest);
+
json_t* groups_in_file = json_object_get(domain->object_json, "groups");
json_t* group_of_interest = json_object_get(groups_in_file, containing_group_uuid);
json_t* links_in_group = json_object_get(group_of_interest, "links");
@@ -6043,11 +6060,28 @@ static herr_t
H5VL_json_insert_link_into_group(H5VL_json_object_t* domain, h5json_uuid_t containing_group_uuid, json_t* link)
{
herr_t ret_value = FAIL;
+char* object_collection_name;
+h5json_uuid_t object_uuid;
FUNC_ENTER_NOAPI_NOINIT
printf("Inserting link %s into group %s\n", json_dumps(link, JSON_INDENT(4)), containing_group_uuid);
+/* manage reference count */
+object_collection_name = json_string_value(json_object_get(link, "collection"));
+printf("got collection = %s\n", object_collection_name);
+
+strncpy(object_uuid, json_string_value(json_object_get(link, "id")), sizeof(h5json_uuid_t));
+printf("got object_uuid = %s\n", object_uuid);
+
+json_t* object_collection = json_object_get(domain->object_json, object_collection_name);
+printf("got object_collection = %s\n", json_dumps(object_collection, JSON_INDENT(4)));
+json_t* object_of_interest = json_object_get(object_collection, object_uuid);
+printf("got object_of_interest = %s\n", json_dumps(object_of_interest, JSON_INDENT(4)));
+
+json_incref(object_of_interest);
+
+
json_t* groups_in_file = json_object_get(domain->object_json, "groups");
json_t* group_of_interest = json_object_get(groups_in_file, containing_group_uuid);
json_t* links_in_group = json_object_get(group_of_interest, "links");