From b217747c98bdb3d0f66dfc83ddad84cb5f3162e5 Mon Sep 17 00:00:00 2001 From: Jeff Garrett Date: Wed, 21 Nov 2007 00:01:15 -0600 Subject: Remove duplicated code in glyph loading glyph_load is exactly equivalent to glyph_load_at_size with width and height -1, so use that code. --- src/glyph.c | 32 -------------------------------- src/glyph.h | 2 +- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/src/glyph.c b/src/glyph.c index 8b6e35d..8390ace 100644 --- a/src/glyph.c +++ b/src/glyph.c @@ -143,38 +143,6 @@ void _glyph_load_at_size_into_struct(glyph_t* pNewGlyph, const gchar* pszName, g pNewGlyph->nHeight = gdk_pixbuf_get_height(pNewPixbuf); } -// Load at image's default size -glyph_t* glyph_load(const gchar* pszName) -{ - g_assert(pszName != NULL); - - glyph_t* pExistingGlyph = NULL; - - if (!g_pGlyphArray) - g_pGlyphArray = g_ptr_array_new(); - - if(glyph_find_by_attributes(pszName, -1, -1, &pExistingGlyph)) { - //g_debug("Found in cache '%s'\n", pszName); - pExistingGlyph->nReferenceCount++; - return pExistingGlyph; - } - - // NOTE: We always return something! - glyph_t* pNewGlyph = g_new0(glyph_t, 1); - pNewGlyph->nReferenceCount = 1; - - pNewGlyph->pszName = g_strdup(pszName); - pNewGlyph->nMaxWidth = -1; - pNewGlyph->nMaxHeight = -1; - - // call internal function to fill the struct - _glyph_load_at_size_into_struct(pNewGlyph, pszName, -1, -1); - - g_ptr_array_add(g_pGlyphArray, pNewGlyph); - - return pNewGlyph; -} - glyph_t* glyph_load_at_size(const gchar* pszName, gint nMaxWidth, gint nMaxHeight) { g_assert(pszName != NULL); diff --git a/src/glyph.h b/src/glyph.h index b475fac..9ac88fa 100644 --- a/src/glyph.h +++ b/src/glyph.h @@ -39,7 +39,7 @@ typedef struct { } glyph_t; glyph_t* glyph_load_at_size(const gchar* pszName, gint nMaxWidth, gint nMaxHeight); -glyph_t* glyph_load(const gchar* pszName); +#define glyph_load(_name) glyph_load_at_size(_name, -1, -1) void glyph_reload_all(void); -- cgit v1.2.3