diff --git generic/ttk/ttkCache.c generic/ttk/ttkCache.c
index f4d1846066..0411d5cd1d 100644
--- generic/ttk/ttkCache.c
+++ generic/ttk/ttkCache.c
@@ -243,18 +243,16 @@ static Tcl_Obj *CheckNamedColor(Ttk_ResourceCache cache, Tcl_Obj *objPtr)
     return objPtr;
 }
 
-/*
- * Template for allocation routines:
- */
-typedef void *(*Allocator)(Tcl_Interp *, Tk_Window, Tcl_Obj *);
+enum allocator {ALLOCATOR_3DBORDER, ALLOCATOR_COLOR, ALLOCATOR_FONT};
 
 static Tcl_Obj *Ttk_Use(
     Tcl_Interp *interp,
     Tcl_HashTable *table,
-    Allocator allocate,
+    enum allocator allocate,
     Tk_Window tkwin,
     Tcl_Obj *objPtr)
 {
+    void *allocResult = NULL;
     int newEntry;
     Tcl_HashEntry *entryPtr =
 	Tcl_CreateHashEntry(table,Tcl_GetString(objPtr),&newEntry);
@@ -267,7 +265,19 @@ static Tcl_Obj *Ttk_Use(
     cacheObj = Tcl_DuplicateObj(objPtr);
     Tcl_IncrRefCount(cacheObj);
 
-    if (allocate(interp, tkwin, cacheObj)) {
+    switch (allocate) {
+    case ALLOCATOR_FONT:
+	allocResult = Tk_AllocFontFromObj(interp, tkwin, cacheObj);
+	break;
+    case ALLOCATOR_COLOR:
+	allocResult = Tk_AllocColorFromObj(interp, tkwin, cacheObj);
+	break;
+    case ALLOCATOR_3DBORDER:
+	allocResult = Tk_Alloc3DBorderFromObj(interp, tkwin, cacheObj);
+	break;
+    }
+
+    if (allocResult) {
 	Tcl_SetHashValue(entryPtr, cacheObj);
 	return cacheObj;
     } else {
@@ -286,7 +296,7 @@ Tcl_Obj *Ttk_UseFont(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr)
 {
     InitCacheWindow(cache, tkwin);
     return Ttk_Use(cache->interp,
-	&cache->fontTable,(Allocator)Tk_AllocFontFromObj, tkwin, objPtr);
+	&cache->fontTable, ALLOCATOR_FONT, tkwin, objPtr);
 }
 
 /*
@@ -298,7 +308,7 @@ Tcl_Obj *Ttk_UseColor(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr)
     objPtr = CheckNamedColor(cache, objPtr);
     InitCacheWindow(cache, tkwin);
     return Ttk_Use(cache->interp,
-	&cache->colorTable,(Allocator)Tk_AllocColorFromObj, tkwin, objPtr);
+	&cache->colorTable, ALLOCATOR_COLOR, tkwin, objPtr);
 }
 
 /*
@@ -311,7 +321,7 @@ Tcl_Obj *Ttk_UseBorder(
     objPtr = CheckNamedColor(cache, objPtr);
     InitCacheWindow(cache, tkwin);
     return Ttk_Use(cache->interp,
-	&cache->borderTable,(Allocator)Tk_Alloc3DBorderFromObj, tkwin, objPtr);
+	&cache->borderTable, ALLOCATOR_3DBORDER, tkwin, objPtr);
 }
 
 /* NullImageChanged --
