Commit: bfbf3b9558ecd808423ed4146d8d5bd5bd4adf8a
Author: Campbell Barton
Date:   Fri Feb 22 13:46:44 2019 +1100
Branches: master
https://developer.blender.org/rBbfbf3b9558ecd808423ed4146d8d5bd5bd4adf8a

Cleanup: make BHeadN private in readfile.c

Also add macro for accessing BHeadN from BHead.

===================================================================

M       source/blender/blenloader/intern/readfile.c
M       source/blender/blenloader/intern/readfile.h

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index d52111da1e0..3aee24ca758 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -251,6 +251,13 @@ static void expand_scene_collection(FileData *fd, Main 
*mainvar, SceneCollection
 static void direct_link_animdata(FileData *fd, AnimData *adt);
 static void lib_link_animdata(FileData *fd, ID *id, AnimData *adt);
 
+typedef struct BHeadN {
+       struct BHeadN *next, *prev;
+       struct BHead bhead;
+} BHeadN;
+
+#define BHEADN_FROM_BHEAD(bh) ((BHeadN *)POINTER_OFFSET(bh, -offsetof(BHeadN, 
bhead)))
+
 /* this function ensures that reports are printed,
  * in the case of libraray linking errors this is important!
  *
@@ -848,7 +855,7 @@ BHead *blo_bhead_first(FileData *fd)
 
 BHead *blo_bhead_prev(FileData *UNUSED(fd), BHead *thisblock)
 {
-       BHeadN *bheadn = (BHeadN *)POINTER_OFFSET(thisblock, -offsetof(BHeadN, 
bhead));
+       BHeadN *bheadn = BHEADN_FROM_BHEAD(thisblock);
        BHeadN *prev = bheadn->prev;
 
        return (prev) ? &prev->bhead : NULL;
@@ -862,7 +869,7 @@ BHead *blo_bhead_next(FileData *fd, BHead *thisblock)
        if (thisblock) {
                /* bhead is actually a sub part of BHeadN
                 * We calculate the BHeadN pointer from the BHead pointer below 
*/
-               new_bhead = (BHeadN *)POINTER_OFFSET(thisblock, 
-offsetof(BHeadN, bhead));
+               new_bhead = BHEADN_FROM_BHEAD(thisblock);
 
                /* get the next BHeadN. If it doesn't exist we read in the next 
one */
                new_bhead = new_bhead->next;
diff --git a/source/blender/blenloader/intern/readfile.h 
b/source/blender/blenloader/intern/readfile.h
index 2dcc65a2074..8dbab1c1363 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -108,11 +108,6 @@ typedef struct FileData {
        struct ReportList *reports;
 } FileData;
 
-typedef struct BHeadN {
-       struct BHeadN *next, *prev;
-       struct BHead bhead;
-} BHeadN;
-
 #define SIZEOFBLENDERHEADER 12
 
 /***/

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to