mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 05:27:44 +00:00
Rework set_header_word macros
Rework the set_header_word macros so that all compilers are happy: - the use of offsetof() is avoided, as it has an issue on IRIX when the result is not constant - the assignment within the macro is explicitely sequenced before the function call to avoid a gcc sequence-point warning Reviewed-on: http://gerrit.openafs.org/8816 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com> Reviewed-by: Derrick Brashear <shadow@your-file-system.com> (cherry picked from commit 7f96084969d3082842a9575ee8ff7da8c52a0796) Change-Id: Iefdf7f6dbb60ffc569b67b3c89893fb43527eb02 Reviewed-on: http://gerrit.openafs.org/8818 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com> Reviewed-by: Derrick Brashear <shadow@your-file-system.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit is contained in:
parent
e8307ef10c
commit
1c811f9fdd
@ -293,9 +293,11 @@ struct memoryDB { /* in core copies of database structures */
|
||||
extern struct memoryDB db;
|
||||
|
||||
#define set_header_word(ut,field,value) \
|
||||
dbwrite ((ut), (offsetof(struct dbHeader, field)), \
|
||||
((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), \
|
||||
|
@ -32,7 +32,12 @@
|
||||
|
||||
extern Date cheaderReadTime; /* time cheader last read in */
|
||||
|
||||
#define set_header_word(tt,field,value) kawrite ((tt), (offsetof(struct kaheader, field)), ((cheader.field = (value)), (char *)&(cheader.field)), sizeof(afs_int32))
|
||||
#define set_header_word(tt,field,value) \
|
||||
( \
|
||||
(cheader.field) = (value), \
|
||||
kawrite((tt), ((char *)&(cheader.field) - (char *)&cheader), \
|
||||
(char *)&(cheader.field), sizeof(afs_int32)) \
|
||||
)
|
||||
|
||||
#define inc_header_word(tt,field) kawrite ((tt), (offsetof(struct kaheader, field)), ((cheader.field = (htonl(ntohl(cheader.field)+1))), (char *)&(cheader.field)), sizeof(afs_int32))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user