diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-08-08 06:29:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-08-08 06:38:00 +0300 |
commit | 171e77c3c25a1224fc5f7db40ec6f8879f8dbbb0 (patch) | |
tree | ea51f4fa508a39807e6f6d333b2d53af8a2b9fc1 /source/blender/bmesh/intern | |
parent | 4bf3ca20165959f98c7c830a138ba2901d3dd851 (diff) |
Cleanup: use array syntax for sizeof with fixed values
Also order sizeof(..) first to promote other values to size_t.
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_core.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_interp.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_convert.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operators.c | 24 |
4 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 4e9775bcfa7..6c4f98e125f 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -182,7 +182,7 @@ BMEdge *BM_edge_create( e->v2 = v2; e->l = NULL; - memset(&e->v1_disk_link, 0, sizeof(BMDiskLink) * 2); + memset(&e->v1_disk_link, 0, sizeof(BMDiskLink[2])); /* --- done --- */ bmesh_disk_edge_append(e, e->v1); diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 256ef55ac59..2f811dbe463 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -535,7 +535,7 @@ void BM_loop_interp_multires_ex(BMesh *UNUSED(bm), md_dst->totdisp = md_src->totdisp; md_dst->level = md_src->level; if (md_dst->totdisp) { - md_dst->disps = MEM_callocN(sizeof(float) * 3 * md_dst->totdisp, __func__); + md_dst->disps = MEM_callocN(sizeof(float[3]) * md_dst->totdisp, __func__); } else { return; diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.c b/source/blender/bmesh/intern/bmesh_mesh_convert.c index 65bc4da49bc..8db125970fd 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_convert.c +++ b/source/blender/bmesh/intern/bmesh_mesh_convert.c @@ -860,7 +860,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh if (act_is_basis) { const float(*fp)[3] = actkey->data; - ofs = MEM_callocN(sizeof(float) * 3 * bm->totvert, "currkey->data"); + ofs = MEM_callocN(sizeof(float[3]) * bm->totvert, "currkey->data"); mvert = me->mvert; BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) { const int keyi = BM_ELEM_CD_GET_INT(eve, cd_shape_keyindex_offset); diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 19e42b33c80..746e9668671 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -55,17 +55,17 @@ BLI_STATIC_ASSERT(ARRAY_SIZE(bmo_error_messages) == BMERR_TOTAL, "message mismat /* operator slot type information - size of one element of the type given. */ const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = { - 0, /* 0: BMO_OP_SLOT_SENTINEL */ - sizeof(int), /* 1: BMO_OP_SLOT_BOOL */ - sizeof(int), /* 2: BMO_OP_SLOT_INT */ - sizeof(float), /* 3: BMO_OP_SLOT_FLT */ - sizeof(void *), /* 4: BMO_OP_SLOT_PNT */ - sizeof(void *), /* 5: BMO_OP_SLOT_PNT */ - 0, /* 6: unused */ - 0, /* 7: unused */ - sizeof(float) * 3, /* 8: BMO_OP_SLOT_VEC */ - sizeof(void *), /* 9: BMO_OP_SLOT_ELEMENT_BUF */ - sizeof(void *), /* 10: BMO_OP_SLOT_MAPPING */ + 0, /* 0: BMO_OP_SLOT_SENTINEL */ + sizeof(int), /* 1: BMO_OP_SLOT_BOOL */ + sizeof(int), /* 2: BMO_OP_SLOT_INT */ + sizeof(float), /* 3: BMO_OP_SLOT_FLT */ + sizeof(void *), /* 4: BMO_OP_SLOT_PNT */ + sizeof(void *), /* 5: BMO_OP_SLOT_PNT */ + 0, /* 6: unused */ + 0, /* 7: unused */ + sizeof(float[3]), /* 8: BMO_OP_SLOT_VEC */ + sizeof(void *), /* 9: BMO_OP_SLOT_ELEMENT_BUF */ + sizeof(void *), /* 10: BMO_OP_SLOT_MAPPING */ }; /* Dummy slot so there is something to return when slot name lookup fails */ @@ -418,7 +418,7 @@ void BMO_slot_mat_set(BMOperator *op, } slot->len = 4; - slot->data.p = BLI_memarena_alloc(op->arena, sizeof(float) * 4 * 4); + slot->data.p = BLI_memarena_alloc(op->arena, sizeof(float[4][4])); if (size == 4) { copy_m4_m4(slot->data.p, (float(*)[4])mat); |