From 0bae2662f455c2866ce769fdc73b3068f8239bd0 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Sat, 3 Oct 2020 16:01:59 +0200 Subject: Cleanup: Remove/replace C standard library assert() and header usages We have our own assert implementation, `BLI_assert()` that is prefered over the C standard library one. Its output is more consistent across compilers and makes termination on assert failure optional (through `WITH_ASSERT_ABORT`). In many places we'd include the C library header without ever accessing it. --- source/blender/makesrna/intern/rna_brush.c | 1 - source/blender/makesrna/intern/rna_ui.c | 4 +--- source/blender/makesrna/intern/rna_wm.c | 12 +++++------- source/blender/makesrna/intern/rna_wm_gizmo.c | 8 +++----- 4 files changed, 9 insertions(+), 16 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 82db67e0612..35f5c4c37bc 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -18,7 +18,6 @@ * \ingroup RNA */ -#include #include #include "DNA_brush_types.h" diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 8ce6ab957b8..d637e011777 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -65,8 +65,6 @@ const EnumPropertyItem rna_enum_uilist_layout_type_items[] = { #ifdef RNA_RUNTIME -# include - # include "MEM_guardedalloc.h" # include "RNA_access.h" @@ -993,7 +991,7 @@ static void rna_Menu_bl_description_set(PointerRNA *ptr, const char *value) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ } else { - assert(!"setting the bl_description on a non-builtin menu"); + BLI_assert(!"setting the bl_description on a non-builtin menu"); } } diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index c31e49fce97..f3438aaa835 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -512,8 +512,6 @@ const EnumPropertyItem rna_enum_wm_report_items[] = { #ifdef RNA_RUNTIME -# include - # include "BLI_string_utils.h" # include "WM_api.h" @@ -1747,7 +1745,7 @@ static void rna_Operator_bl_idname_set(PointerRNA *ptr, const char *value) BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */ } else { - assert(!"setting the bl_idname on a non-builtin operator"); + BLI_assert(!"setting the bl_idname on a non-builtin operator"); } } @@ -1759,7 +1757,7 @@ static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value) BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */ } else { - assert(!"setting the bl_label on a non-builtin operator"); + BLI_assert(!"setting the bl_label on a non-builtin operator"); } } @@ -1771,7 +1769,7 @@ static void rna_Operator_bl_translation_context_set(PointerRNA *ptr, const char BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ } else { - assert(!"setting the bl_translation_context on a non-builtin operator"); + BLI_assert(!"setting the bl_translation_context on a non-builtin operator"); } } @@ -1783,7 +1781,7 @@ static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ } else { - assert(!"setting the bl_description on a non-builtin operator"); + BLI_assert(!"setting the bl_description on a non-builtin operator"); } } @@ -1795,7 +1793,7 @@ static void rna_Operator_bl_undo_group_set(PointerRNA *ptr, const char *value) BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */ } else { - assert(!"setting the bl_undo_group on a non-builtin operator"); + BLI_assert(!"setting the bl_undo_group on a non-builtin operator"); } } diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c index c19998b4803..971991869e2 100644 --- a/source/blender/makesrna/intern/rna_wm_gizmo.c +++ b/source/blender/makesrna/intern/rna_wm_gizmo.c @@ -45,8 +45,6 @@ #ifdef RNA_RUNTIME -# include - # include "BLI_string_utils.h" # include "WM_api.h" @@ -240,7 +238,7 @@ static void rna_Gizmo_bl_idname_set(PointerRNA *ptr, const char *value) BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */ } else { - assert(!"setting the bl_idname on a non-builtin operator"); + BLI_assert(!"setting the bl_idname on a non-builtin operator"); } } @@ -632,7 +630,7 @@ static void rna_GizmoGroup_bl_idname_set(PointerRNA *ptr, const char *value) BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */ } else { - assert(!"setting the bl_idname on a non-builtin operator"); + BLI_assert(!"setting the bl_idname on a non-builtin operator"); } } @@ -644,7 +642,7 @@ static void rna_GizmoGroup_bl_label_set(PointerRNA *ptr, const char *value) BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */ } else { - assert(!"setting the bl_label on a non-builtin operator"); + BLI_assert(!"setting the bl_label on a non-builtin operator"); } } -- cgit v1.2.3