From: Marcelo M. <mar...@us...> - 2005-11-29 01:47:21
|
Update of /cvsroot/swig/SWIG/Source/DOH In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18999/Source/DOH Modified Files: base.c doh.h string.c Log Message: remove many memory leaks and cleanup Index: doh.h =================================================================== RCS file: /cvsroot/swig/SWIG/Source/DOH/doh.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** doh.h 28 Nov 2005 17:32:56 -0000 1.18 --- doh.h 29 Nov 2005 01:47:10 -0000 1.19 *************** *** 264,271 **** #define DohStringGetc(so) DohString_getc(so) #define DohStringUngetc(ch,so) DohString_ungetc(so, ch) ! #define DohStringAppend(so,str) DohString_append(so, str) ! #define DohStringLen(so) DohString_len(so) #define DohStringChar(so) DohString_char(so) ! #define DohStringEqual(s1,s2) DohString_equal(s1,s2) /* Meta-variables */ --- 264,271 ---- #define DohStringGetc(so) DohString_getc(so) #define DohStringUngetc(ch,so) DohString_ungetc(so, ch) ! #define DohStringAppend(so,str) DohString_append(so, (DOH*)str) ! #define DohStringLen(so) DohString_len((DOH*)so) #define DohStringChar(so) DohString_char(so) ! #define DohStringEqual(s1,s2) DohString_equal((DOH *)s1, (DOH *)s2) /* Meta-variables */ Index: base.c =================================================================== RCS file: /cvsroot/swig/SWIG/Source/DOH/base.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** base.c 28 Nov 2005 17:32:56 -0000 1.15 --- base.c 29 Nov 2005 01:47:10 -0000 1.16 *************** *** 234,243 **** b2info = b2->type; } else { ! return strncmp((b1info->doh_data)(b1), (void*) obj2, (b1info->doh_len)(b1)) == 0; } } else if (DohCheck(b2)) { b2info = b2->type; ! return strncmp((b2info->doh_data)(b2), (void*) obj1, (b2info->doh_len)(b2)) == 0; } if (!b1info) { return obj1 == obj2; --- 234,250 ---- b2info = b2->type; } else { ! int len = (b1info->doh_len)(b1); ! char *cobj = (char *) obj2; ! return len == strlen(cobj) ? (memcmp(RawData(b1), cobj, len) == 0) : 0; } } else if (DohCheck(b2)) { b2info = b2->type; ! int len = (b2info->doh_len)(b2); ! char *cobj = (char *) obj1; ! return len == strlen(cobj) ? (memcmp(RawData(b2), cobj, len) == 0) : 0; ! } else { ! return strcmp((char*) obj1, (char*) obj2) == 0; } + if (!b1info) { return obj1 == obj2; Index: string.c =================================================================== RCS file: /cvsroot/swig/SWIG/Source/DOH/string.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** string.c 28 Nov 2005 17:32:56 -0000 1.23 --- string.c 29 Nov 2005 01:47:10 -0000 1.24 *************** *** 151,154 **** --- 151,155 ---- register char *c1 = s1->str; register char *c2 = s2->str; + #if 0 register int mlen = len >> 2; register int i = mlen; *************** *** 163,166 **** --- 164,170 ---- } return 1; + #else + return memcmp(c1, c2, len) == 0; + #endif } } *************** *** 209,213 **** if (DohCheck(str)) { String *ss = (String *) ObjData(str); ! newstr = String_data(str); l = ss->len; } else { --- 213,217 ---- if (DohCheck(str)) { String *ss = (String *) ObjData(str); ! newstr = String_data((DOH*)str); l = ss->len; } else { *************** *** 668,673 **** int i; - str->hashkey = -1; - /* Figure out if anything gets replaced */ if (!strlen(token)) return 0; --- 672,675 ---- *************** *** 679,682 **** --- 681,686 ---- if (!s) return 0; /* No matches. Who cares */ + str->hashkey = -1; + if (flags & DOH_REPLACE_NOQUOTE) noquote = 1; |