mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +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
16a2ec7128
commit
860d398fb4
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>
|
Thu Sep 12 11:02:03 2002 Nicola Pero <n.pero@mi.flashnet.it>
|
||||||
|
|
||||||
* Source/NSObject.m ([+_becomeMultiThreaded:]): Fixed typo - this
|
* Source/NSObject.m ([+_becomeMultiThreaded:]): Fixed typo - this
|
||||||
|
|
|
@ -95,7 +95,6 @@
|
||||||
#include <Foundation/NSZone.h>
|
#include <Foundation/NSZone.h>
|
||||||
#include <Foundation/NSLock.h>
|
#include <Foundation/NSLock.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to get more memory - the normal process has failed.
|
* Try to get more memory - the normal process has failed.
|
||||||
* If we can't do anything, bomb out.
|
* If we can't do anything, bomb out.
|
||||||
|
|
|
@ -100,7 +100,10 @@ cifframe_guess_struct_size(ffi_type *stype)
|
||||||
i = 0;
|
i = 0;
|
||||||
while (stype->elements[i])
|
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)
|
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
|
* make room for it at the end of the cifframe so we
|
||||||
* only need to do a single malloc.
|
* only need to do a single malloc.
|
||||||
*/
|
*/
|
||||||
if (retval)
|
if (rtype && rtype->size > 0)
|
||||||
{
|
{
|
||||||
unsigned full = size;
|
unsigned full = size;
|
||||||
unsigned pos;
|
unsigned pos;
|
||||||
|
@ -188,7 +191,7 @@ cifframe_from_info (NSArgumentInfo *info, int numargs, void **retval)
|
||||||
else
|
else
|
||||||
full += MAX(rtype->size, sizeof(smallret_t));
|
full += MAX(rtype->size, sizeof(smallret_t));
|
||||||
cframe = buf = NSZoneCalloc(NSDefaultMallocZone(), full, 1);
|
cframe = buf = NSZoneCalloc(NSDefaultMallocZone(), full, 1);
|
||||||
if (cframe)
|
if (cframe && retval)
|
||||||
{
|
{
|
||||||
*retval = buf + pos;
|
*retval = buf + pos;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue