From 693c43cd95326da7ecb5ee82ed56c39272080d8e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 1 Aug 2012 15:21:39 +0000 Subject: [PATCH] replace 'GET_INT_FROM_POINTER( &((BHeadN*)0)->bhead) )' with 'offsetof(BHeadN, bhead))' --- source/blender/blenloader/intern/readfile.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index dee882c6737..4ab0076d000 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -761,7 +761,7 @@ BHead *blo_firstbhead(FileData *fd) BHead *blo_prevbhead(FileData *UNUSED(fd), BHead *thisblock) { - BHeadN *bheadn = (BHeadN *) (((char *) thisblock) - GET_INT_FROM_POINTER( &((BHeadN*)0)->bhead) ); + BHeadN *bheadn = (BHeadN *) (((char *) thisblock) - offsetof(BHeadN, bhead)); BHeadN *prev = bheadn->prev; return (prev) ? &prev->bhead : NULL; @@ -773,11 +773,11 @@ BHead *blo_nextbhead(FileData *fd, BHead *thisblock) BHead *bhead = NULL; if (thisblock) { - // bhead is actually a sub part of BHeadN - // We calculate the BHeadN pointer from the BHead pointer below - new_bhead = (BHeadN *) (((char *) thisblock) - GET_INT_FROM_POINTER( &((BHeadN*)0)->bhead) ); + /* bhead is actually a sub part of BHeadN + * We calculate the BHeadN pointer from the BHead pointer below */ + new_bhead = (BHeadN *) (((char *) thisblock) - offsetof(BHeadN, bhead)); - // get the next BHeadN. If it doesn't exist we read in the next one + /* get the next BHeadN. If it doesn't exist we read in the next one */ new_bhead = new_bhead->next; if (new_bhead == NULL) { new_bhead = get_bhead(fd); @@ -785,8 +785,8 @@ BHead *blo_nextbhead(FileData *fd, BHead *thisblock) } if (new_bhead) { - // here we do the reverse: - // go from the BHeadN pointer to the BHead pointer + /* here we do the reverse: + * go from the BHeadN pointer to the BHead pointer */ bhead = &new_bhead->bhead; }