]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Please older compilers.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 9 Mar 2007 14:31:48 +0000 (14:31 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 9 Mar 2007 14:31:48 +0000 (14:31 +0000)
git-svn-id: file:///svn/unbound/trunk@170 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
testcode/checklocks.c
testcode/checklocks.h
testcode/testbed.sh

index 8e3666bfe1e0f0f0893be5265d3d722c0ab4d59f..a62fa5dc812e65cfbef7355b7ac07f70b19f4371 100644 (file)
@@ -5,6 +5,7 @@
        - log_hex function to dump hex strings to the logfile.
        - checklocks zeroes its destroyed lock after checking memory areas.
        - unit test for alloc.
+       - identifier for union in checklocks to please older compilers.
 
 8 March 2007: Wouter
        - Reviewed checklock code.
index 2e8de0f203df4260aa8dd1edad04ce77270334c6..e07ca67b51340aa89a0f5f56d819742e76b50688 100644 (file)
@@ -184,13 +184,13 @@ checklock_init(enum check_lock_type type, struct checked_lock** lock,
        LOCKRET(pthread_mutex_init(&e->lock, NULL));
        switch(e->type) {
                case check_lock_mutex:
-                       LOCKRET(pthread_mutex_init(&e->mutex, NULL));
+                       LOCKRET(pthread_mutex_init(&e->u.mutex, NULL));
                        break;
                case check_lock_spinlock:
-                       LOCKRET(pthread_spin_init(&e->spinlock, PTHREAD_PROCESS_PRIVATE));
+                       LOCKRET(pthread_spin_init(&e->u.spinlock, PTHREAD_PROCESS_PRIVATE));
                        break;
                case check_lock_rwlock:
-                       LOCKRET(pthread_rwlock_init(&e->rwlock, NULL));
+                       LOCKRET(pthread_rwlock_init(&e->u.rwlock, NULL));
                        break;
                default:
                        log_assert(0);
@@ -261,13 +261,13 @@ checklock_destroy(enum check_lock_type type, struct checked_lock** lock,
         * from the thread-held locks list. */
        switch(e->type) {
                case check_lock_mutex:
-                       LOCKRET(pthread_mutex_destroy(&e->mutex));
+                       LOCKRET(pthread_mutex_destroy(&e->u.mutex));
                        break;
                case check_lock_spinlock:
-                       LOCKRET(pthread_spin_destroy(&e->spinlock));
+                       LOCKRET(pthread_spin_destroy(&e->u.spinlock));
                        break;
                case check_lock_rwlock:
-                       LOCKRET(pthread_rwlock_destroy(&e->rwlock));
+                       LOCKRET(pthread_rwlock_destroy(&e->u.rwlock));
                        break;
                default:
                        log_assert(0);
@@ -386,7 +386,7 @@ checklock_rdlock(enum check_lock_type type, struct checked_lock* lock,
 
        log_assert(type == check_lock_rwlock);
        checklock_lockit(type, lock, func, file, line,
-               try_rd, timed_rd, &lock->rwlock, 0, 0);
+               try_rd, timed_rd, &lock->u.rwlock, 0, 0);
 }
 
 /** helper for wrlock: try */
@@ -403,7 +403,7 @@ checklock_wrlock(enum check_lock_type type, struct checked_lock* lock,
 {
        log_assert(type == check_lock_rwlock);
        checklock_lockit(type, lock, func, file, line,
-               try_wr, timed_wr, &lock->rwlock, 0, 1);
+               try_wr, timed_wr, &lock->u.rwlock, 0, 1);
 }
 
 /** helper for lock mutex: try */
@@ -439,13 +439,13 @@ checklock_lock(enum check_lock_type type, struct checked_lock* lock,
        switch(type) {
                case check_lock_mutex:
                        checklock_lockit(type, lock, func, file, line,
-                               try_mutex, timed_mutex, &lock->mutex, 1, 0);
+                               try_mutex, timed_mutex, &lock->u.mutex, 1, 0);
                        break;
                case check_lock_spinlock:
                        /* void* cast needed because 'volatile' on some OS */
                        checklock_lockit(type, lock, func, file, line,
                                try_spinlock, timed_spinlock, 
-                               (void*)&lock->spinlock, 1, 0);
+                               (void*)&lock->u.spinlock, 1, 0);
                        break;
                default:
                        log_assert(0);
@@ -507,13 +507,13 @@ checklock_unlock(enum check_lock_type type, struct checked_lock* lock,
        /* unlock it */
        switch(type) {
                case check_lock_mutex:
-                       LOCKRET(pthread_mutex_unlock(&lock->mutex));
+                       LOCKRET(pthread_mutex_unlock(&lock->u.mutex));
                        break;
                case check_lock_spinlock:
-                       LOCKRET(pthread_spin_unlock(&lock->spinlock));
+                       LOCKRET(pthread_spin_unlock(&lock->u.spinlock));
                        break;
                case check_lock_rwlock:
-                       LOCKRET(pthread_rwlock_unlock(&lock->rwlock));
+                       LOCKRET(pthread_rwlock_unlock(&lock->u.rwlock));
                        break;
                default:
                        log_assert(0);
index 8170e1333ba08a8b117fdb77bb3ab20261c46e5b..05d494468e80e6eff708a6886f0492c5713303a5 100644 (file)
@@ -165,7 +165,7 @@ struct checked_lock {
                pthread_spinlock_t spinlock;
                /** rwlock */
                pthread_rwlock_t rwlock;
-       };
+       } u;
 };
 
 /**
index 7bd5d30896cd0fa03b15da3ec45ad8f56ab22a74..f338964435897dff11142e30d245a357b59219a8 100755 (executable)
@@ -46,7 +46,7 @@ function dotest()
 configure:     configure.ac
        $AC_CMD
        touch configure
-Makefile:      configure
+Makefile:      configure Makefile.in
        ./configure $CONFIGURE_FLAGS $DISABLE
        touch Makefile 
 EOF