Rework set_header_word macros
[openafs.git] / src / budb / database.h
index e192cf6..3b8f671 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
 #include <lock.h>
 #include "budb.h"
 
+#if !defined(offsetof)
+#include <stddef.h>             /* for definition of offsetof() */
+#endif
+
 typedef afs_uint32 dbadr;
 
 struct hashTable {
@@ -289,9 +293,11 @@ struct memoryDB {          /* in core copies of database structures */
 extern struct memoryDB db;
 
 #define set_header_word(ut,field,value) \
-    dbwrite ((ut), ((char *)&(db.h.field) - (char *)&db.h), \
-            ((db.h.field = (value)), (char *)&(db.h.field)), \
-            sizeof(afs_int32))
+       ( \
+           (db.h.field) = (value), \
+           dbwrite((ut), ((char *)&(db.h.field) - (char *)&db.h), \
+                   ((char *)&(db.h.field)), sizeof(afs_int32)) \
+       )
 
 #define set_word_offset(ut,a,b,offset,value)                         \
     dbwrite ((ut), (a)+(offset),                                     \
@@ -313,7 +319,7 @@ extern struct memoryDB db;
 
 struct memoryHashTable *ht_GetType(int type, int *e_sizeP);
 extern afs_uint32 ht_HashEntry(struct memoryHashTable *mht, char *e);
-extern dbadr ht_LookupBucket(struct ubik_trans *ut, 
+extern dbadr ht_LookupBucket(struct ubik_trans *ut,
                             struct memoryHashTable *mht,
                             afs_uint32 hash, int old);