[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49464] trunk/blender/source/blender/ blenloader/intern/readfile.c: replace 'GET_INT_FROM_POINTER( &((BHeadN*)0)- >bhead) )' with 'offsetof(BHeadN, bhead))'
Campbell Barton
ideasman42 at gmail.com
Wed Aug 1 17:21:40 CEST 2012
Revision: 49464
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49464
Author: campbellbarton
Date: 2012-08-01 15:21:39 +0000 (Wed, 01 Aug 2012)
Log Message:
-----------
replace 'GET_INT_FROM_POINTER( &((BHeadN*)0)->bhead) )' with 'offsetof(BHeadN, bhead))'
Modified Paths:
--------------
trunk/blender/source/blender/blenloader/intern/readfile.c
Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c 2012-08-01 15:05:42 UTC (rev 49463)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c 2012-08-01 15:21:39 UTC (rev 49464)
@@ -761,7 +761,7 @@
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 *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 @@
}
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;
}
More information about the Bf-blender-cvs
mailing list