mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 08:15:40 +02:00
particles: use calloc() instead of malloc()
In cases where it makes sense, use calloc() instead of malloc(): * When allocating large objects with many members, many for which NULL/0 is a good default value. * Arrays etc where we explicitly initialize to NULL anyway.
This commit is contained in:
parent
29e9cea1dd
commit
6bba9200cf
7 changed files with 16 additions and 23 deletions
|
@ -98,10 +98,10 @@ struct exposable *
|
|||
dynlist_exposable_new(struct exposable **exposables, size_t count,
|
||||
int left_spacing, int right_spacing)
|
||||
{
|
||||
struct private *e = malloc(sizeof(*e));
|
||||
struct private *e = calloc(1, sizeof(*e));
|
||||
e->count = count;
|
||||
e->exposables = malloc(count * sizeof(e->exposables[0]));
|
||||
e->widths = malloc(count * sizeof(e->widths[0]));
|
||||
e->widths = calloc(count, sizeof(e->widths[0]));
|
||||
e->left_spacing = left_spacing;
|
||||
e->right_spacing = right_spacing;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue