diff options
author | Geoff Thorpe <geoff@openssl.org> | 2001-01-09 00:02:09 +0000 |
---|---|---|
committer | Geoff Thorpe <geoff@openssl.org> | 2001-01-09 00:02:09 +0000 |
commit | 18602745de52e5869f3865245c3c72986831dae2 (patch) | |
tree | ca4bb29660efd441b1d3498ec670d1fe9191a5a3 /crypto/lhash/lhash.h | |
parent | ad2e032049d8e9460372e273eddb192c300b46dc (diff) | |
download | openssl-new-18602745de52e5869f3865245c3c72986831dae2.tar.gz |
This adds macros to implement (and/or declare) type-safe wrapper functions
around the callbacks required in the LHASH code for the "doall" functions.
Also - fix the evil function pointer casting in the two lh_doall functions
by deferring to a static utility function. Previously lh_doall() was
invoking lh_doall_arg() by casting the callback to the 2-parameter
prototype and passing in a NULL argument. This appears to have been working
thus far but it's not a hot idea. If the extra level of indirection becomes
a performance hit, we can just provide two virtually identical
implementations for each variant later on.
Diffstat (limited to 'crypto/lhash/lhash.h')
-rw-r--r-- | crypto/lhash/lhash.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crypto/lhash/lhash.h b/crypto/lhash/lhash.h index 3c5355885f..a6048a4b7d 100644 --- a/crypto/lhash/lhash.h +++ b/crypto/lhash/lhash.h @@ -115,6 +115,25 @@ typedef void (*LHASH_DOALL_ARG_FN_TYPE)(const void *, const void *); return f_name(a,b); } #define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP +/* Third: "doall" functions */ +#define DECLARE_LHASH_DOALL_FN(f_name,o_type) \ + void f_name##_LHASH_DOALL(const void *); +#define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \ + void f_name##_LHASH_DOALL(const void *arg) { \ + o_type a = (o_type)arg; \ + return f_name(a); } +#define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL + +/* Fourth: "doall_arg" functions */ +#define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \ + void f_name##_LHASH_DOALL_ARG(const void *, const void *); +#define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \ + void f_name##_LHASH_DOALL_ARG(const void *arg1, const void *arg2) { \ + o_type a = (o_type)arg1; \ + a_type b = (a_type)arg2; \ + return f_name(a,b); } +#define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG + typedef struct lhash_st { LHASH_NODE **b; |