diff options
author | Bastien Montagne <b.mont29@gmail.com> | 2020-02-13 14:56:10 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-02-13 18:23:42 +0300 |
commit | f28bb6992fa9773fb1e7918d569f4c88427f4c96 (patch) | |
tree | e69240c9ab26ba00bf4ca1f54636e4e837b8f465 /source/blender/blenkernel/intern/lib_remap.c | |
parent | 0d750d7c064bbb1e1fb5fe2ae14a8496863a890b (diff) |
Refactor libquery ID looper callback to take a single parameter.
Using a struct here allows to change given parameters to the callbacks
without having to edit all callbacks functions, which is always noisy
and time consuming.
Diffstat (limited to 'source/blender/blenkernel/intern/lib_remap.c')
-rw-r--r-- | source/blender/blenkernel/intern/lib_remap.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/lib_remap.c b/source/blender/blenkernel/intern/lib_remap.c index 9b6d62a87aa..d8b32b6e04c 100644 --- a/source/blender/blenkernel/intern/lib_remap.c +++ b/source/blender/blenkernel/intern/lib_remap.c @@ -97,13 +97,17 @@ enum { ID_REMAP_IS_USER_ONE_SKIPPED = 1 << 1, /* There was some skipped 'user_one' usages of old_id. */ }; -static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id_p, int cb_flag) +static int foreach_libblock_remap_callback(LibraryIDLinkCallbackData *cb_data) { + const int cb_flag = cb_data->cb_flag; + if (cb_flag & IDWALK_CB_PRIVATE) { return IDWALK_RET_NOP; } - IDRemap *id_remap_data = user_data; + ID *id_self = cb_data->id_self; + ID **id_p = cb_data->id_pointer; + IDRemap *id_remap_data = cb_data->user_data; ID *old_id = id_remap_data->old_id; ID *new_id = id_remap_data->new_id; ID *id = id_remap_data->id; @@ -642,15 +646,14 @@ void BKE_libblock_relink_ex( DEG_relations_tag_update(bmain); } -static int id_relink_to_newid_looper(void *UNUSED(user_data), - ID *UNUSED(self_id), - ID **id_pointer, - const int cb_flag) +static int id_relink_to_newid_looper(LibraryIDLinkCallbackData *cb_data) { + const int cb_flag = cb_data->cb_flag; if (cb_flag & IDWALK_CB_PRIVATE) { return IDWALK_RET_NOP; } + ID **id_pointer = cb_data->id_pointer; ID *id = *id_pointer; if (id) { /* See: NEW_ID macro */ |