Fix the defunct test for the standard structure types in cifframe_type.

The failure to detect those types was causing a substantial space leak
in some gui applications.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30093 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2010-04-06 16:49:44 +00:00
parent 67dd833cc5
commit 21dd778c1f
2 changed files with 17 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2010-04-06 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/cifframe.m (cifframe_type): Fix the defunct test for the
standard structure types. The failure to detect those types was
causing a substantial space leak in some gui applications.
2010-03-29 Richard Frith-Macdonald <rfm@gnu.org>
* config/config.ffi.c: add test for libffi functionality

View file

@ -340,8 +340,13 @@ cifframe_type(const char *typePtr, const char **advance)
unsigned align = __alignof(double);
/* Standard structures can be handled using cached type information.
Since the switch statement has already skipped the _C_STRUCT_B
character, we must use typePtr-1 below to successfully match the
type encoding with one of the standard type encodings. The same
holds for skipping past the whole structure type's encoding with
objc_skip_typespec.
*/
if (GSSelectorTypesMatch(typePtr, @encode(NSRange)))
if (GSSelectorTypesMatch(typePtr - 1, @encode(NSRange)))
{
static ffi_type *elems[3];
static ffi_type stype = { 0 };
@ -368,10 +373,10 @@ cifframe_type(const char *typePtr, const char **advance)
stype.type = FFI_TYPE_STRUCT;
}
ftype = &stype;
typePtr = objc_skip_typespec (typePtr);
typePtr = objc_skip_typespec (typePtr - 1);
break;
}
else if (GSSelectorTypesMatch(typePtr, @encode(NSSize)))
else if (GSSelectorTypesMatch(typePtr - 1, @encode(NSSize)))
{
static ffi_type *elems[3];
static ffi_type stype = { 0 };
@ -392,10 +397,10 @@ cifframe_type(const char *typePtr, const char **advance)
stype.type = FFI_TYPE_STRUCT;
}
ftype = &stype;
typePtr = objc_skip_typespec (typePtr);
typePtr = objc_skip_typespec (typePtr - 1);
break;
}
else if (GSSelectorTypesMatch(typePtr, @encode(NSRect)))
else if (GSSelectorTypesMatch(typePtr - 1, @encode(NSRect)))
{
static ffi_type *elems[3];
static ffi_type stype = { 0 };
@ -412,7 +417,7 @@ cifframe_type(const char *typePtr, const char **advance)
stype.type = FFI_TYPE_STRUCT;
}
ftype = &stype;
typePtr = objc_skip_typespec (typePtr);
typePtr = objc_skip_typespec (typePtr - 1);
break;
}