summaryrefslogtreecommitdiff
path: root/pango/glyphstring.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-10-24 04:50:09 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-10-24 04:50:09 +0000
commitb178da14dabd63937c3867f6d5cbb29f7a31d69f (patch)
treecd998c7bde03f495f0e5badd09cfcbd96f44c0f9 /pango/glyphstring.c
parent24b36e5df683f622cfe9e210716c06da8193f6f8 (diff)
downloadpango-b178da14dabd63937c3867f6d5cbb29f7a31d69f.tar.gz
Bug 471577 – GBoxed GType for PangoGlyphItem
2007-10-24 Behdad Esfahbod <behdad@gnome.org> 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
Diffstat (limited to 'pango/glyphstring.c')
-rw-r--r--pango/glyphstring.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/pango/glyphstring.c b/pango/glyphstring.c
index d8e4dd31..6aeba2b7 100644
--- a/pango/glyphstring.c
+++ b/pango/glyphstring.c
@@ -92,17 +92,23 @@ pango_glyph_string_get_type (void)
/**
* pango_glyph_string_copy:
- * @string: a #PangoGlyphString.
+ * @string: a #PangoGlyphString, may be %NULL
*
- * Copy a glyph string and associated storage.
+ * Copy a glyph string and associated storage.
*
* Return value: the newly allocated #PangoGlyphString, which
- * should be freed with pango_glyph_string_free().
+ * should be freed with pango_glyph_string_free(),
+ * or %NULL if @string was %NULL.
*/
PangoGlyphString *
pango_glyph_string_copy (PangoGlyphString *string)
{
- PangoGlyphString *new_string = g_slice_new (PangoGlyphString);
+ PangoGlyphString *new_string;
+
+ if (new_string == NULL)
+ return NULL;
+
+ new_string = g_slice_new (PangoGlyphString);
*new_string = *string;
@@ -116,13 +122,15 @@ pango_glyph_string_copy (PangoGlyphString *string)
/**
* pango_glyph_string_free:
- * @string: a #PangoGlyphString.
+ * @string: a #PangoGlyphString, may be %NULL
*
* Free a glyph string and associated storage.
*/
void
pango_glyph_string_free (PangoGlyphString *string)
{
+ if (string == NULL)
+ return;
g_free (string->glyphs);
g_free (string->log_clusters);
g_slice_free (PangoGlyphString, string);