[Bf-blender-cvs] [4bb53147549] master: Cleanup: Use typedef for button string info type

Hans Goudey noreply at git.blender.org
Fri Dec 4 15:03:35 CET 2020


Commit: 4bb531475490c36c57065fb3db3d41974fb14897
Author: Hans Goudey
Date:   Fri Dec 4 08:01:54 2020 -0600
Branches: master
https://developer.blender.org/rB4bb531475490c36c57065fb3db3d41974fb14897

Cleanup: Use typedef for button string info type

Before, it wasn't clear what the int in `uiStringInfo` was supposed to
store. Using a typedef can make this someone more explicit.

===================================================================

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface.c

===================================================================

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index f9dc23502c7..a190194d89d 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1351,7 +1351,7 @@ struct PointerRNA *UI_but_operator_ptr_get(uiBut *but);
 void UI_but_unit_type_set(uiBut *but, const int unit_type);
 int UI_but_unit_type_get(const uiBut *but);
 
-enum {
+typedef enum uiStringInfoType {
   BUT_GET_RNAPROP_IDENTIFIER = 1,
   BUT_GET_RNASTRUCT_IDENTIFIER,
   BUT_GET_RNAENUM_IDENTIFIER,
@@ -1364,10 +1364,10 @@ enum {
   BUT_GET_RNAENUM_TIP,
   BUT_GET_OP_KEYMAP,
   BUT_GET_PROP_KEYMAP,
-};
+} uiStringInfoType;
 
 typedef struct uiStringInfo {
-  int type;
+  uiStringInfoType type;
   char *strinfo;
 } uiStringInfo;
 
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 685b34b7185..4a02c6b6e88 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -6795,7 +6795,7 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
 
   va_start(args, but);
   while ((si = (uiStringInfo *)va_arg(args, void *))) {
-    int type = si->type;
+    uiStringInfoType type = si->type;
     char *tmp = NULL;
 
     if (type == BUT_GET_LABEL) {



More information about the Bf-blender-cvs mailing list