summaryrefslogtreecommitdiffstats
path: root/src/H5I.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-02-27 20:51:49 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-02-27 20:51:49 (GMT)
commitc3e5a191940ab521fad2c917e852622cbebd67c8 (patch)
tree3cafb70c78389ee106a78eb60fd28b7bef98c1ad /src/H5I.c
parentc56a7d4ee29dc2ae89e76c8915bc142bd62485b1 (diff)
downloadhdf5-c3e5a191940ab521fad2c917e852622cbebd67c8.zip
hdf5-c3e5a191940ab521fad2c917e852622cbebd67c8.tar.gz
hdf5-c3e5a191940ab521fad2c917e852622cbebd67c8.tar.bz2
[svn-r18348] Description:
Bring r18346 from trunk to 1.8 branch: Bring Coverity fixes back from branch to trunk: r18336: Fix coverity issues 275, 276, 277, 323, 432, 433, and 434 r18337: Fix Coverity issue #106: release free space section node on error r18338: Fixed Coverity #94 - In H5P_register, new_class wasn't closed when there's an error after it's created. r18339: Fix Coverity #185 - In test_conv_str_1, BUF wasn't freed when there's an error in this function. r18340: Correct error in r18337 that wasn't releasing indirect fractal heap block early enough. r18341: Close nodes if any failed in the middle of allocating new nodes. Coverity 140 and 141 r18342: Correct [another] problem w/r18337. r18343: Fix coverity items 185, 20, and 21. r18344: Fix Coverity 213 - In H5FD_family_close, the double pointer file->memb was dereferenced without NULL checking (We believe). r18345: Fix Coverity issue # 210; removed NULL check after pointer dereferenced in H5HFdblock.c. Also assigned NULL to pointer in H5Pint.c to fix segmentation fault. Tested on: FreeBSD/32 6.3 (duty) w/debug) (h5committested on trunk)
Diffstat (limited to 'src/H5I.c')
-rw-r--r--src/H5I.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/H5I.c b/src/H5I.c
index cf78d3b..db3cf6c 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -924,6 +924,44 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5I_subst
+ *
+ * Purpose: Substitute a new object pointer for the specified ID.
+ *
+ * Return: Success: Non-null previsou object pointer associated
+ * with the specified ID.
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, February 27, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5I_subst(hid_t id, const void *new_object)
+{
+ H5I_id_info_t *id_ptr; /* Ptr to the atom */
+ void *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_subst, NULL)
+
+ /* General lookup of the ID */
+ if(NULL == (id_ptr = H5I_find_id(id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count")
+
+ /* Get the old object pointer to return */
+ /* (Casting away const OK -QAK) */
+ ret_value = (void *)id_ptr->obj_ptr;
+
+ /* Set the new object pointer for the ID */
+ id_ptr->obj_ptr = new_object;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end if */
+
+
+/*-------------------------------------------------------------------------
* Function: H5I_object
*
* Purpose: Find an object pointer for the specified ID.