From b178da14dabd63937c3867f6d5cbb29f7a31d69f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 24 Oct 2007 04:50:09 +0000 Subject: =?UTF-8?q?Bug=20471577=20=E2=80=93=20GBoxed=20GType=20for=20Pango?= =?UTF-8?q?GlyphItem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2007-10-24 Behdad Esfahbod Bug 471577 – GBoxed GType for PangoGlyphItem * pango/pango-glyph-item.h: * pango/pango-glyph-item.c: New public API: PANGO_TYPE_GLYPH_ITEM pango_glyph_item_copy() pango_glyph_item_get_type() * pango/pango-layout.c: New public API: pango_layout_iter_copy() * pango/fonts.c (pango_font_description_copy), (pango_font_description_copy_static), (pango_font_description_free), (pango_font_descriptions_free), (pango_font_metrics_ref), (pango_font_metrics_unref): * pango/glyphstring.c (pango_glyph_string_copy), (pango_glyph_string_free): * pango/pango-attributes.c (pango_attr_list_ref), (pango_attr_list_unref), (pango_attr_list_copy): * pango/pango-color.c (pango_color_copy), (pango_color_free): * pango/pango-item.c (pango_item_copy), (pango_item_free): * pango/pango-layout.c (pango_layout_line_ref), (pango_layout_line_unref), (pango_layout_iter_copy), (pango_layout_iter_free): * pango/pango-layout.h: * pango/pango-matrix.c (pango_matrix_copy), (pango_matrix_free): Update all copy/free functions to accept NULL as legitimate input. Previously all were g_return_[val_]if_fail()ing it. * pango/pango.def: * docs/pango-sections.txt: * docs/tmpl/glyphs.sgml: * docs/tmpl/layout.sgml: Update. svn path=/trunk/; revision=2457 --- pango/pango-color.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'pango/pango-color.c') diff --git a/pango/pango-color.c b/pango/pango-color.c index beae87fa..eec81ae4 100644 --- a/pango/pango-color.c +++ b/pango/pango-color.c @@ -42,7 +42,7 @@ pango_color_get_type (void) /** * pango_color_copy: - * @src: color to copy + * @src: color to copy, may be %NULL * * Creates a copy of @src, which should be freed with * pango_color_free(). Primarily used by language bindings, @@ -50,14 +50,16 @@ pango_color_get_type (void) * by assignment in C). * * Return value: the newly allocated #PangoColor, which should - * be freed with pango_color_free(). + * be freed with pango_color_free(), or %NULL + * if @src was %NULL. **/ PangoColor* pango_color_copy (const PangoColor *src) { PangoColor *ret; - g_return_val_if_fail (src != NULL, NULL); + if (src == NULL) + return NULL; ret = g_slice_new (PangoColor); @@ -68,14 +70,15 @@ pango_color_copy (const PangoColor *src) /** * pango_color_free: - * @color: an allocated #PangoColor + * @color: an allocated #PangoColor, may be %NULL * * Frees a color allocated by pango_color_copy(). **/ void pango_color_free (PangoColor *color) { - g_return_if_fail (color != NULL); + if (color == NULL) + return; g_slice_free (PangoColor, color); } -- cgit v1.2.1