mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-24 21:05:40 +02:00
particle: provide a default destroy() function
This allows us to destroy the associated decoration.
This commit is contained in:
parent
f65a18b655
commit
1427d6a98b
2 changed files with 10 additions and 1 deletions
|
@ -1,6 +1,14 @@
|
|||
#include "particle.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
particle_default_destroy(struct particle *particle)
|
||||
{
|
||||
if (particle->deco != NULL)
|
||||
particle->deco->destroy(particle->deco);
|
||||
free(particle);
|
||||
}
|
||||
|
||||
struct particle *
|
||||
particle_common_new(int left_margin, int right_margin)
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ struct particle {
|
|||
void *private;
|
||||
|
||||
int left_margin, right_margin;
|
||||
const struct deco *deco;
|
||||
struct deco *deco;
|
||||
|
||||
void (*destroy)(struct particle *particle);
|
||||
struct exposable *(*instantiate)(const struct particle *particle,
|
||||
|
@ -35,3 +35,4 @@ struct exposable {
|
|||
};
|
||||
|
||||
struct particle *particle_common_new(int left_margin, int right_margin);
|
||||
void particle_default_destroy(struct particle *particle);
|
||||
|
|
Loading…
Add table
Reference in a new issue