[Bf-blender-cvs] [6cfc55c] master: Code cleanup: use enums instead of defines
Nicholas Bishop
noreply at git.blender.org
Mon Jan 26 16:42:04 CET 2015
Commit: 6cfc55c4f95f0fdf73a570d199004f5ad6c18fe2
Author: Nicholas Bishop
Date: Sat Jan 24 15:02:54 2015 +0100
Branches: master
https://developer.blender.org/rB6cfc55c4f95f0fdf73a570d199004f5ad6c18fe2
Code cleanup: use enums instead of defines
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D1026
===================================================================
M source/blender/gpu/intern/gpu_codegen.c
===================================================================
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index ed0282b..ee81abe 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -62,19 +62,25 @@ extern char datatoc_gpu_shader_vertex_world_glsl[];
static char *glsl_material_library = NULL;
-/* structs and defines */
+/* type definitions and constants */
-#define MAX_FUNCTION_NAME 64
-#define MAX_PARAMETER 32
+enum {
+ MAX_FUNCTION_NAME = 64
+};
+enum {
+ MAX_PARAMETER = 32
+};
-#define FUNCTION_QUAL_IN 0
-#define FUNCTION_QUAL_OUT 1
-#define FUNCTION_QUAL_INOUT 2
+typedef enum {
+ FUNCTION_QUAL_IN,
+ FUNCTION_QUAL_OUT,
+ FUNCTION_QUAL_INOUT
+} GPUFunctionQual;
typedef struct GPUFunction {
char name[MAX_FUNCTION_NAME];
GPUType paramtype[MAX_PARAMETER];
- int paramqual[MAX_PARAMETER];
+ GPUFunctionQual paramqual[MAX_PARAMETER];
int totparam;
} GPUFunction;
@@ -142,7 +148,8 @@ static void gpu_parse_functions_string(GHash *hash, char *code)
{
GPUFunction *function;
GPUType type;
- int i, qual;
+ GPUFunctionQual qual;
+ int i;
while ((code = strstr(code, "void "))) {
function = MEM_callocN(sizeof(GPUFunction), "GPUFunction");
More information about the Bf-blender-cvs
mailing list