From: jbj Date: Mon, 12 May 2003 00:36:05 +0000 (+0000) Subject: Use bc_lock_t to hide type of locking. X-Git-Tag: rpm-4.4-release~524 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e77ef01a5f41a71b9846985e588d21ba9b289679;p=platform%2Fupstream%2Frpm.git Use bc_lock_t to hide type of locking. CVS patchset: 6835 CVS date: 2003/05/12 00:36:05 --- diff --git a/beecrypt/configure.ac b/beecrypt/configure.ac index 4e58cde..e1fd1f6 100644 --- a/beecrypt/configure.ac +++ b/beecrypt/configure.ac @@ -357,14 +357,17 @@ fi # Checks for libraries. # XXX Insert "typedef foo bc_lock_t" into types.h. +include_pthread_h= typedef_bc_lock_t= if test "$ac_enable_threads" = yes; then if test "$ac_cv_header_thread_h" = yes; then AC_SEARCH_LIBS([mutex_lock],[thread],[ AC_DEFINE([ENABLE_THREADS],1) if test "$ac_cv_header_sync_h" = yes; then + include_pthread_h='#include ' typedef_bc_lock_t='typedef mutex_t bc_lock_t;' else + include_pthread_h='#include ' typedef_bc_lock_t='typedef pthread_mutex_t bc_lock_t;' fi ]) @@ -372,6 +375,7 @@ if test "$ac_enable_threads" = yes; then AC_SEARCH_LIBS([pthread_mutex_lock],[pthread],[ AC_DEFINE([ENABLE_THREADS],1) if test "$ac_cv_header_pthread_h" = yes; then + include_pthread_h='#include ' typedef_bc_lock_t='typedef pthread_mutex_t bc_lock_t;' fi ]) @@ -379,6 +383,7 @@ if test "$ac_enable_threads" = yes; then AC_MSG_WARN([Don't know which thread library to check for]) fi fi +AC_SUBST(include_pthread_h) AC_SUBST(typedef_bc_lock_t) if test "$ac_enable_aio" = yes; then diff --git a/beecrypt/fips186.h b/beecrypt/fips186.h index 5295864..974d665 100644 --- a/beecrypt/fips186.h +++ b/beecrypt/fips186.h @@ -27,22 +27,6 @@ #define _FIPS186_H #include "beecrypt.h" - -#ifdef _REENTRANT -# if WIN32 -# include -# include -# else -# if HAVE_THREAD_H && HAVE_SYNCH_H -# include -# elif HAVE_PTHREAD_H -# include -# else -# error need locking mechanism -# endif -# endif -#endif - #include "sha1.h" #if (MP_WBITS == 64) @@ -59,21 +43,14 @@ typedef struct { #ifdef _REENTRANT # if WIN32 - HANDLE lock; + HANDLE lock; # else - # if HAVE_THREAD_H && HAVE_SYNCH_H - mutex_t lock; - # elif HAVE_PTHREAD_H - pthread_mutex_t lock; - # else - # error need locking mechanism - # endif - # endif + bc_lock_t lock; #endif sha1Param param; - mpw state[FIPS186_STATE_SIZE]; + mpw state[FIPS186_STATE_SIZE]; byte digest[20]; - int digestremain; + int digestremain; } fips186Param; #ifdef __cplusplus diff --git a/beecrypt/mtprng.h b/beecrypt/mtprng.h index baf3dc8..25a84d4 100644 --- a/beecrypt/mtprng.h +++ b/beecrypt/mtprng.h @@ -38,16 +38,9 @@ typedef struct { #ifdef _REENTRANT # if WIN32 - HANDLE lock; + HANDLE lock; # else - # if HAVE_THREAD_H && HAVE_SYNCH_H - mutex_t lock; - # elif HAVE_PTHREAD_H - pthread_mutex_t lock; - # else - # error need locking mechanism - # endif - # endif + bc_lock_t lock; #endif uint32_t state[N+1]; uint32_t left; diff --git a/beecrypt/types.h.in b/beecrypt/types.h.in index 05f53a0..61574b0 100644 --- a/beecrypt/types.h.in +++ b/beecrypt/types.h.in @@ -95,6 +95,9 @@ typedef uint16_t mphw; # error #endif +#if defined(_REENTRANT) +@include_pthread_h@ @typedef_bc_lock_t@ +#endif #endif /* _TYPES_H */