summaryrefslogtreecommitdiffstats
path: root/src/H5Lexternal.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-11-02 21:37:24 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-11-02 21:37:24 (GMT)
commit1ed3d8d77ec680b8ced982b1afdac94fd00c8a84 (patch)
treecb190fb2bb62da0c6fb06566636688c3163b144d /src/H5Lexternal.c
parenta993ec82fd294da1123a6d5934b98eb77d69e921 (diff)
downloadhdf5-1ed3d8d77ec680b8ced982b1afdac94fd00c8a84.zip
hdf5-1ed3d8d77ec680b8ced982b1afdac94fd00c8a84.tar.gz
hdf5-1ed3d8d77ec680b8ced982b1afdac94fd00c8a84.tar.bz2
[svn-r12848] Description:
Change H5Pset_elink_prefix to be more similar to rest of library and make a copy of the string passed in. Change H5Pget_elink_prefix to be link rest of library routines that query a string. Tested on: FreeBSD/32 4.11 (sleipnir) w/threadsafe & debugging turned on Linux/32 2.4 (heping) w/FORTRAN & C++ Linux/64 2.4 (mir) w/build-all & 1.6 compat enabled AIX/32 5.x (copper) w/FORTRAN & parallel
Diffstat (limited to 'src/H5Lexternal.c')
-rw-r--r--src/H5Lexternal.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 094bde3..9b53c14 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -94,7 +94,7 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group,
hid_t fid;
char *file_name;
char *obj_name;
- char *prefix;
+ ssize_t prefix_len; /* External link prefix length */
size_t fname_len;
hbool_t fname_alloc = FALSE;
unsigned intent;
@@ -106,22 +106,21 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group,
obj_name = ((char *) udata) + fname_len + 1;
/* See if the external link prefix property is set */
- if(H5Pget_elink_prefix(lapl_id, &prefix) < 0)
+ if((prefix_len = H5Pget_elink_prefix(lapl_id, NULL, (size_t)0)) < 0)
goto error;
/* If so, prepend it to the filename */
- if(prefix != NULL)
+ if(prefix_len > 0)
{
- size_t buf_size;
-
- buf_size = HDstrlen(prefix);
-
/* Allocate a buffer to hold the filename plus prefix */
- file_name = H5MM_malloc(buf_size + fname_len + 1);
+ file_name = H5MM_malloc(prefix_len + fname_len + 1);
fname_alloc = TRUE;
+ /* Copy the prefix into the buffer */
+ if(H5Pget_elink_prefix(lapl_id, file_name, (size_t)(prefix_len + 1)) < 0)
+ goto error;
+
/* Add the external link's filename to the prefix supplied */
- HDstrcpy(file_name, prefix);
HDstrcat(file_name, udata);
}