Index: plug-ins/script-fu/tinyscheme/scheme.c
===================================================================
--- plug-ins/script-fu/tinyscheme/scheme.c	(revision 23176)
+++ plug-ins/script-fu/tinyscheme/scheme.c	(working copy)
@@ -74,8 +74,23 @@
 
 #include <string.h>
 #include <stdlib.h>
-#define stricmp g_ascii_strcasecmp
 
+#define stricmp utf8_stricmp
+
+static int utf8_stricmp(const char *s1, const char *s2)
+{
+  char *s1a, *s2a;
+  int result;
+
+  s1a = g_utf8_casefold(s1, -1);
+  s2a = g_utf8_casefold(s2, -1);
+
+  result = g_utf8_collate(s1a, s2a);
+
+  g_free(s1a);
+  g_free(s2a);
+  return result;
+}
 
 #define min(a, b)  ((a <= b) ? a : b)
 
@@ -156,7 +171,6 @@ static num num_one;
 
 INTERFACE INLINE int is_string(pointer p)     { return (type(p)==T_STRING); }
 #define strvalue(p)      ((p)->_object._string._svalue)
-#define strkey(p)        ((p)->_object._string._skey)
 #define strlength(p)     ((p)->_object._string._length)
 
 INTERFACE static int is_list(scheme *sc, pointer p);
@@ -198,8 +212,6 @@ INTERFACE pointer set_cdr(pointer p, poi
 
 INTERFACE INLINE int is_symbol(pointer p)   { return (type(p)==T_SYMBOL); }
 INTERFACE INLINE char *symname(pointer p)   { return strvalue(car(p)); }
-/* For now, we don't want foreign functions to access a strings key */
-INLINE           char *symkey(pointer p)    { return strkey(car(p)); }
 #if USE_PLIST
 SCHEME_EXPORT INLINE int hasprop(pointer p)     { return (typeflag(p)&T_SYMBOL); }
 #define symprop(p)       cdr(p)
@@ -785,22 +797,15 @@ static INLINE pointer oblist_find_by_nam
   int location;
   pointer x;
   char *s;
-  char *key;
-
-  /* case-insensitive, per R5RS section 2. */
-  s = g_utf8_casefold(name, -1);
-  key = g_utf8_collate_key(s, -1);
-  g_free(s);
 
   location = hash_fn(name, ivalue_unchecked(sc->oblist));
   for (x = vector_elem(sc->oblist, location); x != sc->NIL; x = cdr(x)) {
-    s = symkey(car(x));
-    if(strcmp(key, s) == 0) {
-      g_free(key);
+    s = symname(car(x));
+    /* case-insensitive, per R5RS section 2. */
+    if(stricmp(name, s) == 0) {
       return car(x);
     }
   }
-  g_free(key);
   return sc->NIL;
 }
 
@@ -829,21 +834,14 @@ static INLINE pointer oblist_find_by_nam
 {
      pointer x;
      char    *s;
-     char    *key;
-
-     /* case-insensitive, per R5RS section 2. */
-     s = g_utf8_casefold(name, -1);
-     key = g_utf8_collate_key(s, -1);
-     g_free(s);
 
      for (x = sc->oblist; x != sc->NIL; x = cdr(x)) {
-        s = symkey(car(x));
-        if(strcmp(key, s) == 0) {
-          g_free(key);
+        s = symname(car(x));
+        /* case-insensitive, per R5RS section 2. */
+        if(stricmp(name, s) == 0) {
           return car(x);
         }
      }
-     g_free(key);
      return sc->NIL;
 }
 
@@ -978,27 +976,19 @@ INTERFACE pointer mk_string(scheme *sc, 
 /* len is the length of str in characters */
 INTERFACE pointer mk_counted_string(scheme *sc, const char *str, int len) {
      pointer x = get_cell(sc, sc->NIL, sc->NIL);
-     char   *s;
 
      strvalue(x) = store_string(sc,len,str,0);
-     s = g_utf8_casefold(strvalue(x), -1);
-     strkey(x) = g_utf8_collate_key(s, -1);
      typeflag(x) = (T_STRING | T_ATOM);
      strlength(x) = len;
-     g_free(s);
      return (x);
 }
 
 static pointer mk_empty_string(scheme *sc, int len, gunichar fill) {
      pointer x = get_cell(sc, sc->NIL, sc->NIL);
-     char   *s;
 
      strvalue(x) = store_string(sc,len,0,fill);
-     s = g_utf8_casefold(strvalue(x), -1);
-     strkey(x) = g_utf8_collate_key(s, -1);
      typeflag(x) = (T_STRING | T_ATOM);
      strlength(x) = len;
-     g_free(s);
      return (x);
 }
 
@@ -1319,7 +1309,6 @@ static void gc(scheme *sc, pointer a, po
 static void finalize_cell(scheme *sc, pointer a) {
   if(is_string(a)) {
     sc->free(strvalue(a));
-    g_free(strkey(a)); /* mem was allocated via glib */
   } else if(is_port(a)) {
     if(a->_object._port->kind&port_file
        && a->_object._port->rep.stdio.closeit) {
@@ -3315,11 +3304,7 @@ static pointer opexe_2(scheme *sc, enum 
           newstr[newlen] = '\0';
 
           free(strvalue(a));
-          g_free(strkey(a)); /* mem was allocated via glib */
           strvalue(a)=newstr;
-          p1 = g_utf8_casefold(strvalue(a), -1);
-          strkey(a) = g_utf8_collate_key(p1, -1);
-          g_free(p1);
           strlength(a)=newlen;
 
           s_return(sc,a);
Index: plug-ins/script-fu/tinyscheme/scheme-private.h
===================================================================
--- plug-ins/script-fu/tinyscheme/scheme-private.h	(revision 23176)
+++ plug-ins/script-fu/tinyscheme/scheme-private.h	(working copy)
@@ -36,7 +36,6 @@ struct cell {
   union {
     struct {
       char   *_svalue;
-      char   *_skey;
       int   _length;
     } _string;
     num _number;
