From 5fb6293cdf2a929cc2d08e9b3a6651c19740595d Mon Sep 17 00:00:00 2001 From: fedor Date: Fri, 7 Jun 2002 03:39:27 +0000 Subject: [PATCH] Set values after prepping cifframe git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13791 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/cifframe.m | 20 +++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index db806f885..33847c369 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-06-06 Adam Fedor + + * Source/cifframe.m (cifframe_from_info): Set value locations + after prepping cifframe. + 2002-06-06 Richard Frith-Macdonald * Source/NSLog.m: patch by Jeff Teunissen to avoid adding date/time diff --git a/Source/cifframe.m b/Source/cifframe.m index 3ba062d25..960ca4849 100644 --- a/Source/cifframe.m +++ b/Source/cifframe.m @@ -204,6 +204,19 @@ cifframe_from_info (NSArgumentInfo *info, int numargs, void **retval) cframe->arg_types = buf + type_offset; memcpy(cframe->arg_types, arg_types, sizeof(ffi_type *) * numargs); cframe->values = buf + offset; + } + + if (ffi_prep_cif(&cframe->cif, FFI_DEFAULT_ABI, cframe->nargs, + rtype, cframe->arg_types) != FFI_OK) + { + free(cframe); + cframe = NULL; + } + + if (cframe) + { + /* Set values locations. This must be done after ffi_prep_cif so + that any structure sizes get calculated first. */ offset += numargs * sizeof(void*); if (offset % align != 0) { @@ -222,13 +235,6 @@ cifframe_from_info (NSArgumentInfo *info, int numargs, void **retval) } } - if (ffi_prep_cif(&cframe->cif, FFI_DEFAULT_ABI, cframe->nargs, - rtype, cframe->arg_types) != FFI_OK) - { - free(cframe); - cframe = NULL; - } - return cframe; }