summaryrefslogtreecommitdiffstats
path: root/test/ttsafe_error.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-09-09 02:37:02 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-09-09 02:37:02 (GMT)
commiteb3e9ccd8ac3e1a69d0f9bc2c9e9f1c2b5108f21 (patch)
tree5a15644f3f46cb73b22605f3d03b36918bbbd065 /test/ttsafe_error.c
parent4389b976a5af4d4ca755f4ddab2e2e9ed861ea1e (diff)
downloadhdf5-eb3e9ccd8ac3e1a69d0f9bc2c9e9f1c2b5108f21.zip
hdf5-eb3e9ccd8ac3e1a69d0f9bc2c9e9f1c2b5108f21.tar.gz
hdf5-eb3e9ccd8ac3e1a69d0f9bc2c9e9f1c2b5108f21.tar.bz2
[svn-r9234] Purpose:
Code cleanup Description: Tweak recent "forward compatibility" changes to the H5E* API (which allowed for the old H5E API functions to remain unchanged) by allowing for the error stack callback function (H5E_auto_t) to also remain unchanged from the 1.6 branch. This required changing the H5E{get|set}_auto routines to have the old style H5E_auto_t type (which didn't have a stack ID parameter) and the new H5E{get|set}_auto_stack routines to have a newer "H5E_auto_stack_t" type (which has a stack ID parameter). This should make the H5E API changes as forwardly compatible as possible. One side-affect of this change was that it was impossible to determine if the current auto error callback was the old style (H5E_auto_t) or the new style (H5E_auto_stack_t) of callback, so a new API function (H5Eauto_is_stack) was adde to query this. Platforms tested: FreeBSD 4.10 (sleipnir) IRIX64 6.5 (modi4) h5committest
Diffstat (limited to 'test/ttsafe_error.c')
-rw-r--r--test/ttsafe_error.c38
1 files changed, 2 insertions, 36 deletions
diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c
index 7e5eb64..62d7277 100644
--- a/test/ttsafe_error.c
+++ b/test/ttsafe_error.c
@@ -54,13 +54,8 @@
#define EXPECTED_ERROR_DEPTH 8
#define WRITE_NUMBER 37
-#ifdef H5_WANT_H5_V1_6_COMPAT
static herr_t error_callback(void *);
-static herr_t walk_error_callback(int, H5E_error_t *, void *);
-#else /*H5_WANT_H5_V1_6_COMPAT*/
-static herr_t error_callback(hid_t, void *);
static herr_t walk_error_callback(unsigned, const H5E_error_t *, void *);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
static void *tts_error_thread(void *);
/* Global variables */
@@ -154,23 +149,15 @@ void *tts_error_thread(void UNUSED *arg)
{
hid_t dataspace, datatype, dataset;
hsize_t dimsf[1]; /* dataset dimensions */
- H5E_auto_t old_error_cb;
+ H5E_auto_stack_t old_error_cb;
void *old_error_client_data;
int value;
-#ifdef H5_WANT_H5_V1_6_COMPAT
- /* preserve previous error stack handler */
- H5Eget_auto(&old_error_cb, &old_error_client_data);
-
- /* set each thread's error stack handler */
- H5Eset_auto(error_callback, NULL);
-#else /*H5_WANT_H5_V1_6_COMPAT*/
/* preserve previous error stack handler */
H5Eget_auto_stack(H5E_DEFAULT, &old_error_cb, &old_error_client_data);
/* set each thread's error stack handler */
- H5Eset_auto_stack(H5E_DEFAULT, error_callback, NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
+ H5Eset_auto(error_callback, NULL);
/* define dataspace for dataset */
dimsf[0] = 1;
@@ -192,16 +179,11 @@ void *tts_error_thread(void UNUSED *arg)
H5Sclose(dataspace);
/* turn our error stack handler off */
-#ifdef H5_WANT_H5_V1_6_COMPAT
- H5Eset_auto(old_error_cb, old_error_client_data);
-#else /*H5_WANT_H5_V1_6_COMPAT*/
H5Eset_auto_stack(H5E_DEFAULT, old_error_cb, old_error_client_data);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
return NULL;
}
-#ifdef H5_WANT_H5_V1_6_COMPAT
static
herr_t error_callback(void *client_data)
{
@@ -210,25 +192,9 @@ herr_t error_callback(void *client_data)
pthread_mutex_unlock(&error_mutex);
return H5Ewalk(H5E_WALK_DOWNWARD, walk_error_callback, client_data);
}
-#else /*H5_WANT_H5_V1_6_COMPAT*/
static
-herr_t error_callback(hid_t estack, void *client_data)
-{
- pthread_mutex_lock(&error_mutex);
- error_count++;
- pthread_mutex_unlock(&error_mutex);
- return H5Ewalk_stack(estack, H5E_WALK_DOWNWARD, walk_error_callback, client_data);
-}
-#endif /* H5_WANT_H5_V1_6_COMPAT */
-
-#ifdef H5_WANT_H5_V1_6_COMPAT
-static
-herr_t walk_error_callback(int n, H5E_error_t *err_desc, void UNUSED *client_data)
-#else /* H5_WANT_H5_V1_6_COMPAT */
-static
herr_t walk_error_callback(unsigned n, const H5E_error_t *err_desc, void UNUSED *client_data)
-#endif /* H5_WANT_H5_V1_6_COMPAT */
{
hid_t maj_num, min_num;