mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-23 20:35:42 +02:00
Revert "particle/list: optionally destroy sub particles"
This reverts commit c5d3e934b4
.
This commit is contained in:
parent
5a155d1a8d
commit
6bd698fbc8
3 changed files with 5 additions and 16 deletions
3
config.c
3
config.c
|
@ -166,8 +166,7 @@ particle_list_from_config(const struct yml_node *node,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct particle *list = particle_list_new(
|
struct particle *list = particle_list_new(
|
||||||
parts, count, left_spacing, right_spacing, left_margin, right_margin,
|
parts, count, left_spacing, right_spacing, left_margin, right_margin);
|
||||||
true);
|
|
||||||
|
|
||||||
free(parts);
|
free(parts);
|
||||||
return list;
|
return list;
|
||||||
|
|
|
@ -5,7 +5,6 @@ struct particle_private {
|
||||||
struct particle **particles;
|
struct particle **particles;
|
||||||
size_t count;
|
size_t count;
|
||||||
int left_spacing, right_spacing;
|
int left_spacing, right_spacing;
|
||||||
bool has_ownership;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct exposable_private {
|
struct exposable_private {
|
||||||
|
@ -94,12 +93,8 @@ static void
|
||||||
particle_destroy(struct particle *particle)
|
particle_destroy(struct particle *particle)
|
||||||
{
|
{
|
||||||
struct particle_private *p = particle->private;
|
struct particle_private *p = particle->private;
|
||||||
|
for (size_t i = 0; i < p->count; i++)
|
||||||
if (p->has_ownership) {
|
p->particles[i]->destroy(p->particles[i]);
|
||||||
for (size_t i = 0; i < p->count; i++)
|
|
||||||
p->particles[i]->destroy(p->particles[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(p->particles);
|
free(p->particles);
|
||||||
free(p);
|
free(p);
|
||||||
free(particle);
|
free(particle);
|
||||||
|
@ -108,15 +103,13 @@ particle_destroy(struct particle *particle)
|
||||||
struct particle *
|
struct particle *
|
||||||
particle_list_new(
|
particle_list_new(
|
||||||
struct particle *particles[], size_t count,
|
struct particle *particles[], size_t count,
|
||||||
int left_spacing, int right_spacing, int left_margin, int right_margin,
|
int left_spacing, int right_spacing, int left_margin, int right_margin)
|
||||||
bool take_ownership)
|
|
||||||
{
|
{
|
||||||
struct particle_private *p = malloc(sizeof(*p));
|
struct particle_private *p = malloc(sizeof(*p));
|
||||||
p->particles = malloc(count * sizeof(p->particles[0]));
|
p->particles = malloc(count * sizeof(p->particles[0]));
|
||||||
p->count = count;
|
p->count = count;
|
||||||
p->left_spacing = left_spacing;
|
p->left_spacing = left_spacing;
|
||||||
p->right_spacing = right_spacing;
|
p->right_spacing = right_spacing;
|
||||||
p->has_ownership = take_ownership;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < count; i++)
|
for (size_t i = 0; i < count; i++)
|
||||||
p->particles[i] = particles[i];
|
p->particles[i] = particles[i];
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include "../particle.h"
|
#include "../particle.h"
|
||||||
|
|
||||||
struct particle *particle_list_new(
|
struct particle *particle_list_new(
|
||||||
struct particle *particles[], size_t count,
|
struct particle *particles[], size_t count,
|
||||||
int left_spacing, int right_spacing, int left_margin, int right_margin,
|
int left_spacing, int right_spacing, int left_margin, int right_margin);
|
||||||
bool take_ownership);
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue