Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-02-22 05:46:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-02-22 05:47:04 +0300
commitbfbf3b9558ecd808423ed4146d8d5bd5bd4adf8a (patch)
tree63aaa825572957424cb755fff96dbbb4f14baed2 /source
parent9541ce2c261b4d97f1359c930bfe39059f37577e (diff)
Cleanup: make BHeadN private in readfile.c
Also add macro for accessing BHeadN from BHead.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenloader/intern/readfile.c11
-rw-r--r--source/blender/blenloader/intern/readfile.h5
2 files changed, 9 insertions, 7 deletions
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
/***/