1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 04:17:33 +00:00

text_object: provide generic object free routine

This is a valid replacement to a custom routine for objects using data.s
or data.opaque to point to dynamically allocated data.
This commit is contained in:
Phil Sutter 2009-11-20 01:43:00 +01:00
parent fa3118993e
commit 697e64272e
2 changed files with 10 additions and 0 deletions

View File

@ -31,6 +31,12 @@
#include <stdlib.h>
#include <stdio.h>
void gen_free_opaque(struct text_object *obj)
{
if (obj->data.opaque)
free(obj->data.opaque);
}
/* text_object_list
*
* this list is special. it looks like this:

View File

@ -489,6 +489,10 @@ struct obj_cb {
void (*free)(struct text_object *obj);
};
/* generic free opaque callback
* can be used to simply free obj->data.opaque or obj->data.s */
void gen_free_opaque(struct text_object *);
struct text_object {
struct text_object *next, *prev; /* doubly linked list of text objects */
struct text_object *sub; /* for objects parsing text into objects */