[Bf-blender-cvs] [b54cc683653] blender2.8: Cleanup: Use typed allocation type enum in custom data API

Sergey Sharybin noreply at git.blender.org
Wed May 30 10:23:09 CEST 2018


Commit: b54cc68365335d69b3a81ad3309c6011751ddbe9
Author: Sergey Sharybin
Date:   Wed May 30 10:20:22 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb54cc68365335d69b3a81ad3309c6011751ddbe9

Cleanup: Use typed allocation type enum in custom data API

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

M	source/blender/blenkernel/BKE_customdata.h
M	source/blender/blenkernel/intern/customdata.c

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

diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index a9ded0b8356..89d34977843 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -123,7 +123,7 @@ void CustomData_data_add(int type, void *data1, const void *data2);
  * mask is a bitfield where (mask & (1 << (layer type))) indicates
  * if a layer should be copied or not. alloctype must be one of the above. */
 void CustomData_copy(const struct CustomData *source, struct CustomData *dest,
-                     CustomDataMask mask, int alloctype, int totelem);
+                     CustomDataMask mask, CDAllocType alloctype, int totelem);
 
 /* BMESH_TODO, not really a public function but readfile.c needs it */
 void CustomData_update_typemap(struct CustomData *data);
@@ -131,7 +131,7 @@ void CustomData_update_typemap(struct CustomData *data);
 /* same as the above, except that this will preserve existing layers, and only
  * add the layers that were not there yet */
 bool CustomData_merge(const struct CustomData *source, struct CustomData *dest,
-                      CustomDataMask mask, int alloctype, int totelem);
+                      CustomDataMask mask, CDAllocType alloctype, int totelem);
 
 /* Reallocate custom data to a new element count.
  * Only affects on data layers which are owned by the CustomData itself,
@@ -146,7 +146,7 @@ void CustomData_realloc(struct CustomData *data, int totelem);
  * consistent with the new layout.*/
 bool CustomData_bmesh_merge(
         const struct CustomData *source, struct CustomData *dest,
-        CustomDataMask mask, int alloctype, struct BMesh *bm, const char htype);
+        CustomDataMask mask, CDAllocType alloctype, struct BMesh *bm, const char htype);
 
 /** NULL's all members and resets the typemap. */
 void CustomData_reset(struct CustomData *data);
@@ -166,10 +166,10 @@ void CustomData_free_temporary(struct CustomData *data, int totelem);
  * backed by an external data array. the different allocation types are
  * defined above. returns the data of the layer.
  */
-void *CustomData_add_layer(struct CustomData *data, int type, int alloctype,
+void *CustomData_add_layer(struct CustomData *data, int type, CDAllocType alloctype,
                            void *layer, int totelem);
 /*same as above but accepts a name */
-void *CustomData_add_layer_named(struct CustomData *data, int type, int alloctype,
+void *CustomData_add_layer_named(struct CustomData *data, int type, CDAllocType alloctype,
                                  void *layer, int totelem, const char *name);
 
 /* frees the active or first data layer with the give type.
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 9c0ace2f654..0c854551463 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1397,7 +1397,7 @@ void customData_mask_layers__print(CustomDataMask mask)
 /********************* CustomData functions *********************/
 static void customData_update_offsets(CustomData *data);
 
-static CustomDataLayer *customData_add_layer__internal(CustomData *data, int type, int alloctype, void *layerdata,
+static CustomDataLayer *customData_add_layer__internal(CustomData *data, int type, CDAllocType alloctype, void *layerdata,
                                                        int totelem, const char *name);
 
 void CustomData_update_typemap(CustomData *data)
@@ -1428,7 +1428,7 @@ static bool customdata_typemap_is_valid(const CustomData *data)
 #endif
 
 bool CustomData_merge(const struct CustomData *source, struct CustomData *dest,
-                      CustomDataMask mask, int alloctype, int totelem)
+                      CustomDataMask mask, CDAllocType alloctype, int totelem)
 {
 	/*const LayerTypeInfo *typeInfo;*/
 	CustomDataLayer *layer, *newlayer;
@@ -1511,7 +1511,7 @@ void CustomData_realloc(CustomData *data, int totelem)
 }
 
 void CustomData_copy(const struct CustomData *source, struct CustomData *dest,
-                     CustomDataMask mask, int alloctype, int totelem)
+                     CustomDataMask mask, CDAllocType alloctype, int totelem)
 {
 	CustomData_reset(dest);
 
@@ -1810,7 +1810,7 @@ static int customData_resize(CustomData *data, int amount)
 	return 1;
 }
 
-static CustomDataLayer *customData_add_layer__internal(CustomData *data, int type, int alloctype, void *layerdata,
+static CustomDataLayer *customData_add_layer__internal(CustomData *data, int type, CDAllocType alloctype, void *layerdata,
                                                        int totelem, const char *name)
 {
 	const LayerTypeInfo *typeInfo = layerType_getInfo(type);
@@ -1898,7 +1898,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data, int typ
 	return &data->layers[index];
 }
 
-void *CustomData_add_layer(CustomData *data, int type, int alloctype,
+void *CustomData_add_layer(CustomData *data, int type, CDAllocType alloctype,
                            void *layerdata, int totelem)
 {
 	CustomDataLayer *layer;
@@ -1915,7 +1915,7 @@ void *CustomData_add_layer(CustomData *data, int type, int alloctype,
 }
 
 /*same as above but accepts a name*/
-void *CustomData_add_layer_named(CustomData *data, int type, int alloctype,
+void *CustomData_add_layer_named(CustomData *data, int type, CDAllocType alloctype,
                                  void *layerdata, int totelem, const char *name)
 {
 	CustomDataLayer *layer;
@@ -2673,7 +2673,7 @@ void CustomData_bmesh_init_pool(CustomData *data, int totelem, const char htype)
 
 bool CustomData_bmesh_merge(
         const CustomData *source, CustomData *dest,
-        CustomDataMask mask, int alloctype, BMesh *bm, const char htype)
+        CustomDataMask mask, CDAllocType alloctype, BMesh *bm, const char htype)
 {
 	BMHeader *h;
 	BMIter iter;



More information about the Bf-blender-cvs mailing list