From cb7a8d34e7e1163897e5c11e36f805ced9bba5dc Mon Sep 17 00:00:00 2001 From: kramm Date: Sat, 20 Oct 2007 17:14:10 +0000 Subject: [PATCH] added gfxfontlist_free --- lib/gfxtools.c | 10 ++++++++++ lib/gfxtools.h | 1 + 2 files changed, 11 insertions(+) diff --git a/lib/gfxtools.c b/lib/gfxtools.c index eeb1a7a..dd6b9ad 100644 --- a/lib/gfxtools.c +++ b/lib/gfxtools.c @@ -772,6 +772,16 @@ gfxfontlist_t*gfxfontlist_addfont(gfxfontlist_t*list, gfxfont_t*font) return l; } } +void gfxfontlist_free(gfxfontlist_t*list) +{ + gfxfontlist_t*l = list; + while(l) { + gfxfontlist_t*next = l; + memset(l, 0, sizeof(*l)); + free(l); + l = next; + } +} gfxline_t*gfxline_makerectangle(int x1,int y1,int x2, int y2) { diff --git a/lib/gfxtools.h b/lib/gfxtools.h index f24faee..b0f9ce8 100644 --- a/lib/gfxtools.h +++ b/lib/gfxtools.h @@ -81,6 +81,7 @@ gfxfontlist_t* gfxfontlist_create(); gfxfontlist_t*gfxfontlist_addfont(gfxfontlist_t*list, gfxfont_t*font); gfxfont_t*gfxfontlist_findfont(gfxfontlist_t*list, char*id); char gfxfontlist_hasfont(gfxfontlist_t*list, gfxfont_t*font); +void gfxfontlist_free(gfxfontlist_t*list); gfxline_t*gfxline_makerectangle(int x1, int y1, int x2, int y2); void gfxline_show(gfxline_t*line, FILE*fi); -- 1.7.10.4