mirror of https://github.com/GNOME/gimp.git
Commited patch from Sven Neumann that reverts the optimization patch which
2007-08-11 Kevin Cozens <kcozens@cvs.gnome.org> * plug-ins/script-fu/tinyscheme/scheme.c: Commited patch from Sven Neumann that reverts the optimization patch which stored collation keys. See bug #374854. svn path=/trunk/; revision=23207
This commit is contained in:
parent
b5acc46883
commit
ef3bce7b6b
|
@ -1,3 +1,9 @@
|
|||
2007-08-11 Kevin Cozens <kcozens@cvs.gnome.org>
|
||||
|
||||
* plug-ins/script-fu/tinyscheme/scheme.c: Commited patch from
|
||||
Sven Neumann that reverts the optimization patch which stored
|
||||
collation keys. See bug #374854.
|
||||
|
||||
2007-08-11 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* app/tools/gimprectangletool.c
|
||||
|
|
|
@ -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, pointer q) { return cdr(p)=q; }
|
|||
|
||||
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_name(scheme *sc, const char *name)
|
|||
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_name(scheme *sc, const char *name)
|
|||
{
|
||||
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, const char *str) {
|
|||
/* 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, pointer b) {
|
|||
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 scheme_opcodes op) {
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue