diff options
Diffstat (limited to 'fortran/src/H5Ef.c')
-rw-r--r-- | fortran/src/H5Ef.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/fortran/src/H5Ef.c b/fortran/src/H5Ef.c index 4f9d652..c6d860c 100644 --- a/fortran/src/H5Ef.c +++ b/fortran/src/H5Ef.c @@ -62,7 +62,7 @@ nh5eprint_c1(_fcd name, int_f* namelen) FILE *file = NULL; char *c_name = NULL; int_f ret_value = 0; - + if(NULL == (c_name = (char*)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) if(NULL == (file = HDfopen(c_name, "a"))) @@ -128,19 +128,20 @@ nh5eget_major_c(int_f* error_no, _fcd name, size_t_f* namelen) size_t c_namelen = (size_t)*namelen; int_f ret_value = 0; - if(c_namelen) { - if(NULL == (c_name = (char *)HDmalloc(c_namelen + 1))) - HGOTO_DONE(FAIL) - } /* end if */ + if(c_namelen > 0) + c_name = (char *)HDmalloc(c_namelen + 1); + + if(!c_name) + HGOTO_DONE(FAIL) /* * Call H5Eget_major function. */ H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen); HD5packFstring((char*)c_name, _fcdtocp(name), c_namelen); - if(!HDstrcmp(c_name, "Invalid major error number")) + if(!HDstrcmp(c_name, "Invalid major error number")) HGOTO_DONE(FAIL) - + done: if(c_name) HDfree(c_name); @@ -166,23 +167,24 @@ nh5eget_minor_c(int_f* error_no, _fcd name, size_t_f* namelen) size_t c_namelen = (size_t)*namelen; int_f ret_value = 0; - if(c_namelen) { - if(NULL == (c_name = (char *)HDmalloc(c_namelen + 1))) - HGOTO_DONE(FAIL) - } /* end if */ + if(c_namelen > 0) + c_name = (char *)HDmalloc(c_namelen + 1); + + if(!c_name) + HGOTO_DONE(FAIL) /* * Call H5Eget_minor function. */ H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen); HD5packFstring((char *)c_name, _fcdtocp(name), c_namelen); - if(!HDstrcmp(c_name, "Invalid minor error number")) + if(!HDstrcmp(c_name, "Invalid minor error number")) HGOTO_DONE(FAIL) - + done: if(c_name) HDfree(c_name); - + return ret_value; } |