diff options
Diffstat (limited to 'fortran/src/H5Pf.c')
-rw-r--r-- | fortran/src/H5Pf.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index dba2aa4..262ce55 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -3370,14 +3370,15 @@ nh5pclose_class_c(hid_t_f *cls) ret_value = 0; return ret_value; } + /****if* H5Pf/h5pget_class_name_c * NAME * h5pget_class_name_c * PURPOSE * Call H5Pget_class_name to get property class name * INPUTS - * cls - identifier of property class - * name - ibuffer to retrieve name in + * cls - identifier of property class + * name - buffer to retrieve name in * name_len - length of the "name" buffer * RETURNS * 0 on success, -1 on failure @@ -3393,30 +3394,25 @@ nh5pget_class_name_c(hid_t_f *cls, _fcd name, int_f *name_len) /******/ { int_f ret_value = -1; - char *c_name = NULL; /* Buffer to hold C string */ - size_t c_size; - c_size = (size_t)*name_len + 1; - - /* - * Allocate buffer to hold name - */ - if(NULL == (c_name = (char *)HDmalloc(c_size))) - goto DONE; + /* Buffer to return name by C function */ + char *c_name; /* - * Call H5Pget_class_name function. + * Call H5Pget_class_name function. c_name is allocated by the library, + * has to be freed by application. */ - c_name = H5Pget_class_name((hid_t)*cls); - if(c_name == NULL) goto DONE; + if(NULL == (c_name = H5Pget_class_name((hid_t)*cls))) + goto DONE; HD5packFstring(c_name, _fcdtocp(name), (size_t)*name_len); ret_value = (int_f)HDstrlen(c_name); + HDfree(c_name); DONE: - HDfree(c_name); return ret_value; } + /****if* H5Pf/h5psetc_c * NAME * h5psetc_c |