summaryrefslogtreecommitdiffstats
path: root/src/H5C.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-02-03 17:29:54 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-02-03 17:29:54 (GMT)
commit519b33c5b00b7cb81e7d1d6d808b0923ff16d18c (patch)
tree08585cfd99d214d18c0dd142c8a0d2290b134b2b /src/H5C.c
parent137bc83f7a8f1f552b53a97d21d89269c844a051 (diff)
downloadhdf5-519b33c5b00b7cb81e7d1d6d808b0923ff16d18c.zip
hdf5-519b33c5b00b7cb81e7d1d6d808b0923ff16d18c.tar.gz
hdf5-519b33c5b00b7cb81e7d1d6d808b0923ff16d18c.tar.bz2
[svn-r214] Changes since 19980203
---------------------- ./src/H5C.c ./src/H5Cprivate.h ./src/H5D.c ./src/H5Dpublic.h Added H5Dget_create_parms(), trying to stay one step ahead of Elena ;-)
Diffstat (limited to 'src/H5C.c')
-rw-r--r--src/H5C.c56
1 files changed, 45 insertions, 11 deletions
diff --git a/src/H5C.c b/src/H5C.c
index dde8411..4c4f4fe 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -883,7 +883,6 @@ H5Ccopy(hid_t tid)
const void *tmpl = NULL;
void *new_tmpl = NULL;
H5C_class_t type;
- size_t size;
hid_t ret_value = FAIL;
group_t group;
@@ -896,6 +895,46 @@ H5Ccopy(hid_t tid)
HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL,
"can't unatomize template");
}
+
+ /* Copy it */
+ if (NULL==(new_tmpl=H5C_copy (type, tmpl))) {
+ HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL,
+ "unable to copy template");
+ }
+
+ /* Register the atom for the new template */
+ if ((ret_value = H5A_register(group, new_tmpl)) < 0) {
+ HRETURN_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL,
+ "unable to atomize template pointer");
+ }
+ FUNC_LEAVE(ret_value);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_copy
+ *
+ * Purpose: Creates a new template and initializes it with some other
+ * template.
+ *
+ * Return: Success: Ptr to new template
+ *
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, February 3, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5C_copy (H5C_class_t type, const void *src)
+{
+ size_t size;
+ void *dst = NULL;
+
+ FUNC_ENTER (H5C_copy, NULL);
+
/* How big is the template */
switch (type) {
case H5C_FILE_CREATE:
@@ -903,7 +942,7 @@ H5Ccopy(hid_t tid)
break;
case H5C_FILE_ACCESS:
- HRETURN_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL,
+ HRETURN_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL,
"file access properties are not implemented yet");
case H5C_DATASET_CREATE:
@@ -915,18 +954,13 @@ H5Ccopy(hid_t tid)
break;
default:
- HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL,
+ HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, NULL,
"unknown template class");
}
/* Create the new template */
- new_tmpl = H5MM_xmalloc(size);
- HDmemcpy(new_tmpl, tmpl, size);
+ dst = H5MM_xmalloc(size);
+ HDmemcpy(dst, src, size);
- /* Register the atom for the new template */
- if ((ret_value = H5A_register(group, new_tmpl)) < 0) {
- HRETURN_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL,
- "unable to atomize template pointer");
- }
- FUNC_LEAVE(ret_value);
+ FUNC_LEAVE (dst);
}