* err_handle.c (krb5_err_key): Variable deleted.
authorKen Raeburn <raeburn@mit.edu>
Sat, 2 Jul 2005 03:00:13 +0000 (03:00 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 2 Jul 2005 03:00:13 +0000 (03:00 +0000)
(init_err_handling, krb5_set_err, krb5_get_err_string, krb5_clr_error): Use k5_
macros for thread-specific data instead of pthread versions.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17288 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kadm5/clnt/ChangeLog
src/lib/kadm5/clnt/err_handle.c
src/lib/kdb/ChangeLog
src/lib/kdb/err_handle.c

index a296c1e7d38ec32ea79e62f79fd046a3c5a35eda..578acba3cbaffc1d4fd6f6b0362532ec3d8653c9 100644 (file)
@@ -1,3 +1,10 @@
+2005-07-01  Ken Raeburn  <raeburn@mit.edu>
+
+       * err_handle.c (krb5_err_key): Variable deleted.
+       (init_err_handling, krb5_set_err, krb5_get_err_string,
+       krb5_clr_error): Use k5_ macros for thread-specific data instead
+       of pthread versions.
+
 2005-06-20  Ken Raeburn  <raeburn@mit.edu>
 
        Novell merge.
index 99d8c9423f9bb9440b3b841104251189b044ef1e..24bf2912ebf3476052a348391bc86f08fbeaf788 100644 (file)
@@ -41,12 +41,10 @@ tsd_key_destructor(void *data)
     free(data);
 }
 
-static pthread_key_t krb5_err_key;
-
 static void
 init_err_handling(void)
 {
-    assert(!pthread_key_create(&krb5_err_key, tsd_key_destructor));
+    assert(!k5_key_register(K5_KEY_KADM_CLNT_ERR_HANDLER, tsd_key_destructor));
 #ifdef NOVELL
     old_error_2_string = error_message;
     error_message = krb5_get_err_string;
@@ -63,13 +61,13 @@ krb5_set_err(krb5_context kcontext, krb5_err_subsystem subsystem,
     krb5_err_struct_t *err_struct;
     pthread_once(&krb5_key_create, init_err_handling);
 
-    err_struct = (krb5_err_struct_t *) pthread_getspecific(krb5_err_key);
+    err_struct = (krb5_err_struct_t *) k5_getspecific(K5_KEY_KADM_CLNT_ERR_HANDLER);
     if (err_struct == NULL) {
        err_struct = calloc(sizeof(krb5_err_struct_t), 1);
        if (err_struct == NULL)
            return ENOMEM;
 
-       if ((ret = pthread_setspecific(krb5_err_key, err_struct))) {
+       if ((ret = k5_setspecific(K5_KEY_KADM_CLNT_ERR_HANDLER, err_struct))) {
            free(err_struct);
            return ret;
        }
@@ -93,7 +91,7 @@ krb5_get_err_string(long err_code)
     krb5_err_struct_t *err_struct;
     pthread_once(&krb5_key_create, init_err_handling);
 
-    err_struct = (krb5_err_struct_t *) pthread_getspecific(krb5_err_key);
+    err_struct = (krb5_err_struct_t *) k5_getspecific(K5_KEY_KADM_CLNT_ERR_HANDLER);
     if (err_struct && (err_struct->subsystem == krb5_err_have_str)
        && (err_code == err_struct->err_code)) {
        /* checking error code is for safety.
@@ -119,7 +117,7 @@ krb5_clr_error()
     krb5_err_struct_t *err_struct;
     pthread_once(&krb5_key_create, init_err_handling);
 
-    err_struct = (krb5_err_struct_t *) pthread_getspecific(krb5_err_key);
+    err_struct = (krb5_err_struct_t *) k5_getspecific(K5_KEY_KADM_CLNT_ERR_HANDLER);
     if (err_struct)
        err_struct->subsystem = krb5_err_unknown;
 }
index ddeb00f548e64853bab250436f6007e7416543ec..b17d580d553651786c2e60c95c25a62fcd98ccb5 100644 (file)
@@ -1,3 +1,10 @@
+2005-07-01  Ken Raeburn  <raeburn@mit.edu>
+
+       * err_handle.c (krb5_err_key): Variable deleted.
+       (init_err_handling, krb5_set_err, krb5_get_err_string,
+       krb5_clr_error): Use k5_ macros for thread-specific data instead
+       of pthread versions.
+
 2005-06-29  Ken Raeburn  <raeburn@mit.edu>
 
        * Makefile.in (t_kdb, check, clean): Delete t_kdb references.
index 3130587fdb39f8a330dd051c03f276c65aaa360f..bfd3c752c169c57c3abed1f6fb7a18c9af08a164 100644 (file)
@@ -41,12 +41,10 @@ tsd_key_destructor(void *data)
     free(data);
 }
 
-static pthread_key_t krb5_err_key;
-
 static void
 init_err_handling(void)
 {
-    assert(!pthread_key_create(&krb5_err_key, tsd_key_destructor));
+    assert(!k5_key_register(K5_KEY_KDB_ERR_HANDLER, tsd_key_destructor));
 #ifdef NOVELL
     old_error_2_string = error_message;
     error_message = krb5_get_err_string;
@@ -63,13 +61,13 @@ krb5_set_err(krb5_context kcontext, krb5_err_subsystem subsystem,
     krb5_err_struct_t *err_struct;
     pthread_once(&krb5_key_create, init_err_handling);
 
-    err_struct = (krb5_err_struct_t *) pthread_getspecific(krb5_err_key);
+    err_struct = (krb5_err_struct_t *) k5_getspecific(K5_KEY_KDB_ERR_HANDLER);
     if (err_struct == NULL) {
        err_struct = calloc(sizeof(krb5_err_struct_t), 1);
        if (err_struct == NULL)
            return ENOMEM;
 
-       if ((ret = pthread_setspecific(krb5_err_key, err_struct))) {
+       if ((ret = k5_setspecific(K5_KEY_KDB_ERR_HANDLER, err_struct))) {
            free(err_struct);
            return ret;
        }
@@ -93,7 +91,7 @@ krb5_get_err_string(long err_code)
     krb5_err_struct_t *err_struct;
     pthread_once(&krb5_key_create, init_err_handling);
 
-    err_struct = (krb5_err_struct_t *) pthread_getspecific(krb5_err_key);
+    err_struct = (krb5_err_struct_t *) k5_getspecific(K5_KEY_KDB_ERR_HANDLER);
     if (err_struct && (err_struct->subsystem == krb5_err_have_str)
        && (err_code == err_struct->err_code)) {
        /* Checking error code is for safety.
@@ -125,7 +123,7 @@ krb5_clr_error()
     krb5_err_struct_t *err_struct;
     pthread_once(&krb5_key_create, init_err_handling);
 
-    err_struct = (krb5_err_struct_t *) pthread_getspecific(krb5_err_key);
+    err_struct = (krb5_err_struct_t *) k5_getspecific(K5_KEY_KDB_ERR_HANDLER);
     if (err_struct)
        err_struct->subsystem = krb5_err_unknown;
 }