From: Massimiliano Pala <[EMAIL PROTECTED]>

madwolf> Yes, I though it too, but why I don't get that error when compiling the
madwolf> 
madwolf>        openssl-SNAP-20010104
madwolf> 
madwolf> instead of the latest (20010110) ??? I am updating the gcc, anyway I can't 
find
madwolf> the problem....

There's been a change since 2000-01-04, perhaps it caused some
undesired effects?  With this knowledge, perhaps you can find out what
happens...:

Index: lhash.c
===================================================================
RCS file: /e/openssl/cvs/openssl/crypto/lhash/lhash.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- lhash.c     2000/12/13 17:14:52     1.20
+++ lhash.c     2001/01/09 00:02:09     1.21
@@ -267,20 +267,9 @@
        return((void *)ret);
        }
 
-void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func)
+static void doall_util_fn(LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
+                       LHASH_DOALL_ARG_FN_TYPE func_arg, const void *arg)
        {
-       /* Yikes that's bad - we're accepting a function that accepts 2
-        * parameters (albeit we have to waive type-safety here) and then
-        * forcibly calling that callback with *3* parameters leaving the 3rd
-        * NULL. Obviously this "works" otherwise it wouldn't have survived so
-        * long, but is it "good"??
-        * FIXME: Use an internal function from this and the "_arg" version that
-        * doesn't assume the ability to mutate function prototypes so badly. */
-       lh_doall_arg(lh, (LHASH_DOALL_ARG_FN_TYPE)func, NULL);
-       }
-
-void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, const void *arg)
-       {
        int i;
        LHASH_NODE *a,*n;
 
@@ -294,10 +283,23 @@
                        /* 28/05/91 - eay - n added so items can be deleted
                         * via lh_doall */
                        n=a->next;
-                       func(a->data,arg);
+                       if(use_arg)
+                               func_arg(a->data,arg);
+                       else
+                               func(a->data);
                        a=n;
                        }
                }
+       }
+
+void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func)
+       {
+       doall_util_fn(lh, 0, func, (LHASH_DOALL_ARG_FN_TYPE)NULL, NULL);
+       }
+
+void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, const void *arg)
+       {
+       doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)NULL, func, arg);
        }
 
 static void expand(LHASH *lh)
Index: lhash.h
===================================================================
RCS file: /e/openssl/cvs/openssl/crypto/lhash/lhash.h,v
retrieving revision 1.13
retrieving revision 1.15
diff -u -r1.13 -r1.15
--- lhash.h     2000/12/13 17:14:52     1.13
+++ lhash.h     2001/01/09 16:59:56     1.15
@@ -115,6 +115,25 @@
                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; \
+               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; \
+               f_name(a,b); }
+#define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG
+
 typedef struct lhash_st
        {
        LHASH_NODE **b;


-- 
Richard Levitte   \ Spannvägen 38, II \ [EMAIL PROTECTED]
Chairman@Stacken   \ S-168 35  BROMMA  \ T: +46-8-26 52 47
Redakteur@Stacken   \      SWEDEN       \ or +46-709-50 36 10
Procurator Odiosus Ex Infernis                -- [EMAIL PROTECTED]
Member of the OpenSSL development team: http://www.openssl.org/
Software Engineer, Celo Communications: http://www.celocom.com/

Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.stacken.kth.se/~levitte/mail/> for more info.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to