diff options
author | Jeff Garrett <jeff@jgarrett.org> | 2007-11-21 00:01:15 -0600 |
---|---|---|
committer | Jeff Garrett <jeff@jgarrett.org> | 2007-11-21 00:01:15 -0600 |
commit | b217747c98bdb3d0f66dfc83ddad84cb5f3162e5 (patch) | |
tree | 7c01ce428b9bd0f8860717236bce4660a107c8d2 | |
parent | 74d9171a160bc8611a1e9f02b211ae03405c81fd (diff) |
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.
-rw-r--r-- | src/glyph.c | 32 | ||||
-rw-r--r-- | src/glyph.h | 2 |
2 files changed, 1 insertions, 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); |