mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Fix sizing structures in cifframe
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14437 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7cf7efc9b1
commit
33589dec57
3 changed files with 13 additions and 4 deletions
|
@ -1,3 +1,10 @@
|
|||
2002-09-13 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/cifframe.m (cifframe_guess_struct_size): Recurse if
|
||||
element contains structures.
|
||||
(cifframe_from_info): Alloc room for return value even if caller
|
||||
doesn't use it.
|
||||
|
||||
Thu Sep 12 11:02:03 2002 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* Source/NSObject.m ([+_becomeMultiThreaded:]): Fixed typo - this
|
||||
|
|
|
@ -95,7 +95,6 @@
|
|||
#include <Foundation/NSZone.h>
|
||||
#include <Foundation/NSLock.h>
|
||||
|
||||
|
||||
/*
|
||||
* Try to get more memory - the normal process has failed.
|
||||
* If we can't do anything, bomb out.
|
||||
|
|
|
@ -100,7 +100,10 @@ cifframe_guess_struct_size(ffi_type *stype)
|
|||
i = 0;
|
||||
while (stype->elements[i])
|
||||
{
|
||||
size += stype->elements[i]->size;
|
||||
if (stype->elements[i]->elements)
|
||||
size += cifframe_guess_struct_size(stype->elements[i]);
|
||||
else
|
||||
size += stype->elements[i]->size;
|
||||
|
||||
if (size % align != 0)
|
||||
{
|
||||
|
@ -173,7 +176,7 @@ cifframe_from_info (NSArgumentInfo *info, int numargs, void **retval)
|
|||
* make room for it at the end of the cifframe so we
|
||||
* only need to do a single malloc.
|
||||
*/
|
||||
if (retval)
|
||||
if (rtype && rtype->size > 0)
|
||||
{
|
||||
unsigned full = size;
|
||||
unsigned pos;
|
||||
|
@ -188,7 +191,7 @@ cifframe_from_info (NSArgumentInfo *info, int numargs, void **retval)
|
|||
else
|
||||
full += MAX(rtype->size, sizeof(smallret_t));
|
||||
cframe = buf = NSZoneCalloc(NSDefaultMallocZone(), full, 1);
|
||||
if (cframe)
|
||||
if (cframe && retval)
|
||||
{
|
||||
*retval = buf + pos;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue