mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-26 12:27:52 +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:
parent
fa3118993e
commit
697e64272e
@ -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:
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user