[draw] Inline draw_context_delete() and check that it's != NULL

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-14 15:22:31 +02:00
parent e5ed2f2f1c
commit 61d552a860
2 changed files with 14 additions and 13 deletions

View File

@ -135,18 +135,6 @@ draw_context_new(xcb_connection_t *conn, int phys_screen, int width, int height,
return d;
};
/** Delete a draw context
* \param ctx draw_context_t to delete
*/
void
draw_context_delete(draw_context_t **ctx)
{
g_object_unref((*ctx)->layout);
cairo_surface_destroy((*ctx)->surface);
cairo_destroy((*ctx)->cr);
p_delete(ctx);
}
/** Create a new Pango font
* \param conn Connection ref
* \param fontname Pango fontname (e.g. [FAMILY-LIST] [STYLE-OPTIONS] [SIZE])

View File

@ -124,7 +124,20 @@ typedef struct
} draw_context_t;
draw_context_t *draw_context_new(xcb_connection_t *, int, int, int, xcb_drawable_t);
void draw_context_delete(draw_context_t **);
/** Delete a draw context
* \param ctx draw_context_t to delete
*/
static inline void
draw_context_delete(draw_context_t **ctx)
{
if(*ctx)
{
g_object_unref((*ctx)->layout);
cairo_surface_destroy((*ctx)->surface);
cairo_destroy((*ctx)->cr);
p_delete(ctx);
}
}
font_t *draw_font_new(xcb_connection_t *, int, char *);
void draw_font_delete(font_t **);