From ddf2cbad1b90004de493b372d5d2f478e82a3024 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 17 Dec 2018 23:00:25 -0800 Subject: Cleaned up and normalized VFD init calls. --- src/H5FDcore.c | 6 +++--- src/H5FDdirect.c | 21 +++++++++------------ src/H5FDfamily.c | 19 ++++++++----------- src/H5FDlog.c | 6 +++--- src/H5FDmpio.c | 34 ++++++++++++++++++---------------- src/H5FDmulti.c | 22 ++++++++-------------- src/H5FDsec2.c | 6 +++--- 7 files changed, 52 insertions(+), 62 deletions(-) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 2ab04dc..391e37e 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -415,8 +415,8 @@ done: * Purpose: Initialize this driver by registering the driver with the * library. * - * Return: Success: The driver ID for the core driver. - * Failure: Negative. + * Return: Success: The driver ID for the core driver + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, July 29, 1999 @@ -428,7 +428,7 @@ H5FD_core_init(void) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) if(H5I_VFL != H5I_get_type(H5FD_CORE_g)) H5FD_CORE_g = H5FD_register(&H5FD_core_g, sizeof(H5FD_class_t), FALSE); diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 906ec28..4476654 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -206,30 +206,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_init + * Function: H5FD_direct_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the direct driver. - * - * Failure: Negative. + * Return: Success: The driver ID for the direct driver + * Failure: H5I_INVALID_HID * * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t H5FD_direct_init(void) { - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) - if (H5I_VFL!=H5I_get_type(H5FD_DIRECT_g)) + if (H5I_VFL != H5I_get_type(H5FD_DIRECT_g)) H5FD_DIRECT_g = H5FD_register(&H5FD_direct_g,sizeof(H5FD_class_t),FALSE); /* Set return value */ @@ -237,7 +234,7 @@ H5FD_direct_init(void) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_direct_init() */ /*--------------------------------------------------------------------------- diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index e52a71a..4d40cf3 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -171,28 +171,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_family_init + * Function: H5FD_family_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the family driver. + * Return: Success: The driver ID for the family driver + * Failure: H5I_INVALID_HID * - * Failure: Negative - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t H5FD_family_init(void) { - hid_t ret_value = H5FD_FAMILY_g; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) if(H5I_VFL != H5I_get_type(H5FD_FAMILY_g)) H5FD_FAMILY_g = H5FD_register(&H5FD_family_g, sizeof(H5FD_class_t), FALSE); diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 3dcd7f5..524113a 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -252,8 +252,8 @@ done: * Purpose: Initialize this driver by registering the driver with the * library. * - * Return: Success: The driver ID for the log driver. - * Failure: Negative. + * Return: Success: The driver ID for the log driver + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, July 29, 1999 @@ -265,7 +265,7 @@ H5FD_log_init(void) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) if(H5I_VFL != H5I_get_type(H5FD_LOG_g)) H5FD_LOG_g = H5FD_register(&H5FD_log_g, sizeof(H5FD_class_t), FALSE); diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 87f8b6a..f9d1032 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -187,15 +187,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_init + * Function: H5FD_mpio_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the mpio driver. - * Failure: Negative. + * Return: Success: The driver ID for the mpio driver + * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, August 5, 1999 * *------------------------------------------------------------------------- @@ -206,10 +206,10 @@ H5FD_mpio_init(void) #ifdef H5FDmpio_DEBUG static int H5FD_mpio_Debug_inited = 0; #endif /* H5FDmpio_DEBUG */ - const char *s; /* String for environment variables */ - hid_t ret_value; /* Return value */ + const char *s; /* String for environment variables */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Register the MPI-IO VFD, if it isn't already */ if(H5I_VFL != H5I_get_type(H5FD_MPIO_g)) @@ -217,8 +217,10 @@ H5FD_mpio_init(void) /* Allow MPI buf-and-file-type optimizations? */ s = HDgetenv("HDF5_MPI_OPT_TYPES"); - if(s && HDisdigit(*s)) - H5FD_mpi_opt_types_g = (hbool_t)HDstrtol(s, NULL, 0); + if(s && HDisdigit(*s)) { + long env_val = HDstrtol(s, NULL, 0); + H5FD_mpi_opt_types_g = (0 == env_val) ? FALSE : TRUE; + } #ifdef H5FDmpio_DEBUG if(!H5FD_mpio_Debug_inited) { @@ -226,12 +228,12 @@ H5FD_mpio_init(void) s = HDgetenv("H5FD_mpio_Debug"); if(s) { /* Set debug mask */ - while(*s) { - H5FD_mpio_Debug[(int)*s]++; - s++; - } /* end while */ + while(*s) { + H5FD_mpio_Debug[(int)*s]++; + s++; + } /* end while */ } /* end if */ - H5FD_mpio_Debug_inited++; + H5FD_mpio_Debug_inited++; } /* end if */ #endif /* H5FDmpio_DEBUG */ diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index aa1b118..ff41371 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -26,11 +26,6 @@ #include #include -/* Disable certain warnings in PC-Lint: */ -/*lint --emacro( {534, 830}, H5P_DEFAULT, H5P_FILE_ACCESS, H5P_DATASET_XFER) */ -/*lint --emacro( {534, 830}, H5FD_MULTI) */ -/*lint -esym( 534, H5Eclear2, H5Epush2) */ - #include "hdf5.h" @@ -211,16 +206,15 @@ my_strdup(const char *s) /*------------------------------------------------------------------------- - * Function: H5FD_multi_init - * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Function: H5FD_multi_init * - * Return: Success: The driver ID for the multi driver. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Failure: Negative + * Return: Success: The driver ID for the multi driver + * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -231,11 +225,11 @@ H5FD_multi_init(void) /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); - if(H5I_VFL!=H5Iget_type(H5FD_MULTI_g)) + if(H5I_VFL != H5Iget_type(H5FD_MULTI_g)) H5FD_MULTI_g = H5FDregister(&H5FD_multi_g); return H5FD_MULTI_g; -} +} /* end H5FD_multi_init() */ /*--------------------------------------------------------------------------- diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 06c008d..c507387 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -208,8 +208,8 @@ done: * Purpose: Initialize this driver by registering the driver with the * library. * - * Return: Success: The driver ID for the sec2 driver. - * Failure: Negative + * Return: Success: The driver ID for the sec2 driver + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, July 29, 1999 @@ -221,7 +221,7 @@ H5FD_sec2_init(void) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) if(H5I_VFL != H5I_get_type(H5FD_SEC2_g)) H5FD_SEC2_g = H5FD_register(&H5FD_sec2_g, sizeof(H5FD_class_t), FALSE); -- cgit v0.12