summaryrefslogtreecommitdiffstats
path: root/src/H5Adeprec.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-02-20 16:00:24 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-02-20 16:00:24 (GMT)
commit4486398a983615ef2561b331027e59ba75552304 (patch)
treebc4c021dde5dde827b12c0a8f871ca21d32c6e41 /src/H5Adeprec.c
parent19257978d9ad35ae430e462524ba4b15f181e85f (diff)
downloadhdf5-4486398a983615ef2561b331027e59ba75552304.zip
hdf5-4486398a983615ef2561b331027e59ba75552304.tar.gz
hdf5-4486398a983615ef2561b331027e59ba75552304.tar.bz2
[svn-r13347] Description:
Deprecate H5Adelete in favor of H5Adelete2, which corresponds to the new pattern of specifying an object's location. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5Adeprec.c')
-rw-r--r--src/H5Adeprec.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index d1d7740..0e1d264 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -165,3 +165,43 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_num_attrs() */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Adelete
+ PURPOSE
+ Deletes an attribute from a location
+ USAGE
+ herr_t H5Adelete (loc_id, name)
+ hid_t loc_id; IN: Object (dataset or group) to have attribute deleted from
+ const char *name; IN: Name of attribute to delete
+ RETURNS
+ Non-negative on success/Negative on failure
+ DESCRIPTION
+ This function removes the named attribute from a dataset or group.
+--------------------------------------------------------------------------*/
+herr_t
+H5Adelete(hid_t loc_id, const char *name)
+{
+ H5G_loc_t loc; /* Object location */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Adelete, FAIL)
+ H5TRACE2("e", "is", loc_id, name);
+
+ /* check arguments */
+ if(H5I_ATTR == H5I_get_type(loc_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!name || !*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+
+ /* Delete the attribute from the location */
+ if(H5O_attr_remove(loc.oloc, name, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Adelete() */
+