aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2011-10-06 11:03:16 +0200
committerSverker Eriksson <[email protected]>2011-10-06 12:00:10 +0200
commit4e3771807535516c970b210272c89a71c34511e6 (patch)
tree05482709c54b52c4c340ff336ac7bf3518442321 /erts/emulator
parentf3d4ed5a10fea88b596ffa52f7b5b1f835f54fba (diff)
downloadotp-4e3771807535516c970b210272c89a71c34511e6.tar.gz
otp-4e3771807535516c970b210272c89a71c34511e6.tar.bz2
otp-4e3771807535516c970b210272c89a71c34511e6.zip
ETS: Fix faulty size calculation SIZEOF_EXTSEG
Probably not a bug in reallity, but it's simpler and safer to use offsetof for dynamic sizeof calculations.
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/erl_db_hash.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_db_hash.c b/erts/emulator/beam/erl_db_hash.c
index 2428ba655a..038a667b06 100644
--- a/erts/emulator/beam/erl_db_hash.c
+++ b/erts/emulator/beam/erl_db_hash.c
@@ -312,10 +312,9 @@ struct ext_segment {
struct segment* segtab[1]; /* The segment table */
};
#define SIZEOF_EXTSEG(NSEGS) \
- (sizeof(struct ext_segment) - sizeof(struct segment*) + sizeof(struct segment*)*(NSEGS))
+ (offsetof(struct ext_segment,segtab) + sizeof(struct segment*)*(NSEGS))
#if defined(DEBUG) || defined(VALGRIND)
-# include <stddef.h> /* offsetof */
# define EXTSEG(SEGTAB_PTR) \
((struct ext_segment*) (((char*)(SEGTAB_PTR)) - offsetof(struct ext_segment,segtab)))
#endif