Cleanup: remove BKE_utildefines
authorCampbell Barton <ideasman42@gmail.com>
Sun, 19 Nov 2017 14:35:49 +0000 (01:35 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 19 Nov 2017 14:47:31 +0000 (01:47 +1100)
This was meant to be used for less general macros but was never used.

Rename BKE_BIT_TEST_SET to SET_FLAG_FROM_TEST

source/blender/blenkernel/BKE_utildefines.h [deleted file]
source/blender/blenkernel/CMakeLists.txt
source/blender/blenlib/BLI_utildefines.h
source/blender/editors/mesh/editface.c
source/blender/editors/object/object_lattice.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/transform/transform_generics.c
source/blender/freestyle/intern/system/StringUtils.h
source/blender/windowmanager/intern/wm_files.c

diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h
deleted file mode 100644 (file)
index 7c1e0e9..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file BKE_utildefines.h
- *  \ingroup bke
- *  \brief blender format specific macros
- *  \note generic defines should go in BLI_utildefines.h
- */
-
-
-#ifndef __BKE_UTILDEFINES_H__
-#define __BKE_UTILDEFINES_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BKE_BIT_TEST_SET(value, test, flag) \
-{                                           \
-       if (test) (value) |=  flag;             \
-       else      (value) &= ~flag;             \
-} (void)0
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* __BKE_UTILDEFINES_H__ */
index 74c69c5aeb901c51a3ee2c5ebd9199f9268a2522..96c653dee23e0bd28cc05abed20eb9bb4b8f84cf 100644 (file)
@@ -292,7 +292,6 @@ set(SRC
        BKE_texture.h
        BKE_tracking.h
        BKE_unit.h
-       BKE_utildefines.h
        BKE_world.h
        BKE_writeavi.h
        BKE_writeframeserver.h
index b13d5e368ec4bd4f8cb5dc78f16f9460383df935..8f8d7cc3b7fd4933b08a6cee42a3ae7c8eef7790 100644 (file)
@@ -509,6 +509,16 @@ extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size);
 #define SET_UINT_IN_POINTER(i)    ((void *)(uintptr_t)(i))
 #define GET_UINT_FROM_POINTER(i)  ((void)0, ((unsigned int)(uintptr_t)(i)))
 
+/* Set flag from a single test */
+#define SET_FLAG_FROM_TEST(value, test, flag) \
+{ \
+       if (test) { \
+               (value) |=  (flag); \
+       } \
+       else { \
+               (value) &= ~(flag); \
+       } \
+} ((void)0)
 
 /* Macro to convert a value to string in the preprocessor
  * STRINGIFY_ARG: gives the argument as a string
index 6c6c106b19a78c20f6eedd4b2b716683ed43e09e..4336fff45d59e441492e19c550dfa1ad44e21fed 100644 (file)
@@ -42,7 +42,6 @@
 #include "BKE_mesh.h"
 #include "BKE_context.h"
 #include "BKE_editmesh.h"
-#include "BKE_utildefines.h"
 
 #include "BIF_gl.h"
 
@@ -231,7 +230,7 @@ static void select_linked_tfaces_with_seams(Mesh *me, const unsigned int index,
 
        for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++) {
                if (BLI_BITMAP_TEST(poly_tag, a)) {
-                       BKE_BIT_TEST_SET(mp->flag, select, ME_FACE_SEL);
+                       SET_FLAG_FROM_TEST(mp->flag, select, ME_FACE_SEL);
                }
        }
 
index ac8d438d9e6b6043b57df2bf3f68b565356a41b9..57053ddc020adc8edcd73fd133a9b1be5ee278b4 100644 (file)
@@ -57,7 +57,6 @@
 #include "BKE_lattice.h"
 #include "BKE_deform.h"
 #include "BKE_report.h"
-#include "BKE_utildefines.h"
 
 #include "ED_lattice.h"
 #include "ED_object.h"
@@ -369,7 +368,7 @@ static int lattice_select_more_less(bContext *C, const bool select)
                                            lattice_test_bitmap_uvw(lt, selpoints, u, v, w + 1, select) ||
                                            lattice_test_bitmap_uvw(lt, selpoints, u, v, w - 1, select))
                                        {
-                                               BKE_BIT_TEST_SET(bp->f1, select, SELECT);
+                                               SET_FLAG_FROM_TEST(bp->f1, select, SELECT);
                                        }
                                }
                                bp++;
index 67597729d154cbe2cbe316e9c0aa817a1b5a28de..05cf552e5ccacc6114a338ace97c5cbcf1a8a226 100644 (file)
@@ -70,8 +70,6 @@
 #include "BKE_paint.h"
 #include "BKE_editmesh.h"
 #include "BKE_tracking.h"
-#include "BKE_utildefines.h"
-
 
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
@@ -726,7 +724,7 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv,
        if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co) &&
            BLI_lasso_is_point_inside(data->mcords, data->moves, screen_co[0], screen_co[1], IS_CLIPPED))
        {
-               BKE_BIT_TEST_SET(mv->flag, data->select, SELECT);
+               SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT);
        }
 }
 static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
@@ -1672,7 +1670,7 @@ static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, con
        BoxSelectUserData *data = userData;
 
        if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co)) {
-               BKE_BIT_TEST_SET(mv->flag, data->select, SELECT);
+               SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT);
        }
 }
 static int do_paintvert_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
@@ -2498,7 +2496,7 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv,
        CircleSelectUserData *data = userData;
 
        if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
-               BKE_BIT_TEST_SET(mv->flag, data->select, SELECT);
+               SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT);
        }
 }
 static void paint_vertsel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
index 179b68dd270e143ceb4f0d9df1d2aa90492e1047..277e01d1e2bd74e9a8919a93b3318cff8ede8006 100644 (file)
@@ -82,7 +82,6 @@
 #include "BKE_editmesh.h"
 #include "BKE_tracking.h"
 #include "BKE_mask.h"
-#include "BKE_utildefines.h"
 
 #include "ED_anim_api.h"
 #include "ED_armature.h"
@@ -1208,7 +1207,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
                if (prop_id && (prop = RNA_struct_find_property(op->ptr, prop_id)) &&
                    RNA_property_is_set(op->ptr, prop))
                {
-                       BKE_BIT_TEST_SET(t->flag, RNA_property_boolean_get(op->ptr, prop), T_ALT_TRANSFORM);
+                       SET_FLAG_FROM_TEST(t->flag, RNA_property_boolean_get(op->ptr, prop), T_ALT_TRANSFORM);
                }
        }
 
index e11798762e4773425ac56fa9e7ccced3c9af789e..10748c45c1919e6499cdca54403f2d6edee049e0 100644 (file)
@@ -35,7 +35,6 @@
 #include <vector>
 
 extern "C" {
-#include "BKE_utildefines.h"
 #include "BLI_string.h"
 #include "BLI_path_util.h"
 }
index 637ace9cd823470df7562d569691cec474dcd72b..e991e901bb1140da6db487058d060c89e41f3905 100644 (file)
@@ -71,7 +71,6 @@
 #include "DNA_windowmanager_types.h"
 
 #include "BKE_appdir.h"
-#include "BKE_utildefines.h"
 #include "BKE_autoexec.h"
 #include "BKE_blender.h"
 #include "BKE_blendfile.h"
@@ -327,12 +326,12 @@ static void wm_init_userdef(bContext *C, const bool read_userdef_from_memory)
        BKE_sound_init(bmain);
 
        /* needed so loading a file from the command line respects user-pref [#26156] */
-       BKE_BIT_TEST_SET(G.fileflags, U.flag & USER_FILENOUI, G_FILE_NO_UI);
+       SET_FLAG_FROM_TEST(G.fileflags, U.flag & USER_FILENOUI, G_FILE_NO_UI);
 
        /* set the python auto-execute setting from user prefs */
        /* enabled by default, unless explicitly enabled in the command line which overrides */
        if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
-               BKE_BIT_TEST_SET(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC);
+               SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC);
        }
 
        /* avoid re-saving for every small change to our prefs, allow overrides */
@@ -675,7 +674,7 @@ int wm_homefile_read(
        BLI_assert((use_factory_settings && filepath_startup_override) == 0);
 
        if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
-               BKE_BIT_TEST_SET(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC);
+               SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC);
        }
 
        BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE);
@@ -1167,8 +1166,8 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
                        G.save_over = 1; /* disable untitled.blend convention */
                }
 
-               BKE_BIT_TEST_SET(G.fileflags, fileflags & G_FILE_COMPRESS, G_FILE_COMPRESS);
-               BKE_BIT_TEST_SET(G.fileflags, fileflags & G_FILE_AUTOPLAY, G_FILE_AUTOPLAY);
+               SET_FLAG_FROM_TEST(G.fileflags, fileflags & G_FILE_COMPRESS, G_FILE_COMPRESS);
+               SET_FLAG_FROM_TEST(G.fileflags, fileflags & G_FILE_AUTOPLAY, G_FILE_AUTOPLAY);
 
                /* prevent background mode scripts from clobbering history */
                if (do_history) {
@@ -1555,7 +1554,7 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op)
                /* This can be used when loading of a start-up file should only change
                 * the scene content but keep the blender UI as it is. */
                wm_open_init_load_ui(op, true);
-               BKE_BIT_TEST_SET(G.fileflags, !RNA_boolean_get(op->ptr, "load_ui"), G_FILE_NO_UI);
+               SET_FLAG_FROM_TEST(G.fileflags, !RNA_boolean_get(op->ptr, "load_ui"), G_FILE_NO_UI);
 
                if (RNA_property_is_set(op->ptr, prop)) {
                        RNA_property_string_get(op->ptr, prop, filepath_buf);
@@ -2038,20 +2037,24 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
        fileflags = G.fileflags & ~G_FILE_USERPREFS;
 
        /* set compression flag */
-       BKE_BIT_TEST_SET(fileflags, RNA_boolean_get(op->ptr, "compress"),
-                        G_FILE_COMPRESS);
-       BKE_BIT_TEST_SET(fileflags, RNA_boolean_get(op->ptr, "relative_remap"),
-                        G_FILE_RELATIVE_REMAP);
-       BKE_BIT_TEST_SET(fileflags,
-                        (RNA_struct_property_is_set(op->ptr, "copy") &&
-                         RNA_boolean_get(op->ptr, "copy")),
-                        G_FILE_SAVE_COPY);
+       SET_FLAG_FROM_TEST(
+               fileflags, RNA_boolean_get(op->ptr, "compress"),
+               G_FILE_COMPRESS);
+       SET_FLAG_FROM_TEST(
+               fileflags, RNA_boolean_get(op->ptr, "relative_remap"),
+               G_FILE_RELATIVE_REMAP);
+       SET_FLAG_FROM_TEST(
+               fileflags,
+               (RNA_struct_property_is_set(op->ptr, "copy") &&
+                RNA_boolean_get(op->ptr, "copy")),
+               G_FILE_SAVE_COPY);
 
 #ifdef USE_BMESH_SAVE_AS_COMPAT
-       BKE_BIT_TEST_SET(fileflags,
-                        (RNA_struct_find_property(op->ptr, "use_mesh_compat") &&
-                         RNA_boolean_get(op->ptr, "use_mesh_compat")),
-                        G_FILE_MESH_COMPAT);
+       SET_FLAG_FROM_TEST(
+               fileflags,
+               (RNA_struct_find_property(op->ptr, "use_mesh_compat") &&
+                RNA_boolean_get(op->ptr, "use_mesh_compat")),
+               G_FILE_MESH_COMPAT);
 #else
 #  error "don't remove by accident"
 #endif