Cleanup: Fix const correctness in CustomData set name function

The function does modify the object since it changes the name of a layer
it owns. Ideally this wouldn't be possible, but raw pointers don't have
ownership semantics so this is a common problem with CustomData.
This commit is contained in:
Hans Goudey 2022-08-26 10:57:35 -05:00
parent 51178fd4da
commit aaea263be4
2 changed files with 2 additions and 5 deletions

View File

@ -417,7 +417,7 @@ void *CustomData_bmesh_get_n(const struct CustomData *data, void *block, int typ
*/
void *CustomData_bmesh_get_layer_n(const struct CustomData *data, void *block, int n);
bool CustomData_set_layer_name(const struct CustomData *data, int type, int n, const char *name);
bool CustomData_set_layer_name(struct CustomData *data, int type, int n, const char *name);
const char *CustomData_get_layer_name(const struct CustomData *data, int type, int n);
/**

View File

@ -3537,10 +3537,7 @@ int CustomData_get_offset_named(const CustomData *data, int type, const char *na
return data->layers[layer_index].offset;
}
bool CustomData_set_layer_name(const CustomData *data,
const int type,
const int n,
const char *name)
bool CustomData_set_layer_name(CustomData *data, const int type, const int n, const char *name)
{
/* get the layer index of the first layer of type */
const int layer_index = CustomData_get_layer_index_n(data, type, n);