Cleanup: make BHeadN private in readfile.c

Also add macro for accessing BHeadN from BHead.
This commit is contained in:
Campbell Barton 2019-02-22 13:46:44 +11:00
parent 9541ce2c26
commit bfbf3b9558
2 changed files with 9 additions and 7 deletions

View File

@ -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;

View File

@ -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
/***/