mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
simplify last change
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30616 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4e0ef853d3
commit
94fdf2eb27
4 changed files with 20 additions and 23 deletions
|
@ -1,3 +1,10 @@
|
|||
2010-06-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSFFIInvocation.m:
|
||||
* Source/cifframe.h:
|
||||
* Source/cifframe.m:
|
||||
Removed distinction between GC and non-GC code.
|
||||
|
||||
2010-06-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSInvocation.h:
|
||||
|
|
|
@ -141,7 +141,7 @@ gs_find_by_receiver_best_typed_sel (id receiver, SEL sel)
|
|||
|
||||
static IMP gs_objc_msg_forward2 (id receiver, SEL sel)
|
||||
{
|
||||
void *frame;
|
||||
NSMutableData *frame;
|
||||
cifframe_t *cframe;
|
||||
ffi_closure *cclosure;
|
||||
NSMethodSignature *sig;
|
||||
|
@ -202,11 +202,7 @@ static IMP gs_objc_msg_forward2 (id receiver, SEL sel)
|
|||
where it becomes owned by the callback invocation, so we don't have to
|
||||
worry about ownership */
|
||||
frame = cifframe_from_signature(sig);
|
||||
#if GS_WITH_GC
|
||||
cframe = frame;
|
||||
#else
|
||||
cframe = [(NSMutableData*)frame mutableBytes];
|
||||
#endif
|
||||
cframe = [frame mutableBytes];
|
||||
/* Autorelease the closure through GSAutoreleasedBuffer */
|
||||
|
||||
memory = [GSCodeBuffer memoryWithSize: sizeof(ffi_closure)];
|
||||
|
@ -333,14 +329,9 @@ static id gs_objc_proxy_lookup(id receiver, SEL op)
|
|||
_sig = RETAIN(aSignature);
|
||||
_numArgs = [aSignature numberOfArguments];
|
||||
_info = [aSignature methodInfo];
|
||||
#if GS_WITH_GC
|
||||
_frame = nil;
|
||||
_cframe = cifframe_from_signature(_sig);
|
||||
#else
|
||||
_frame = (NSMutableData*)cifframe_from_signature(_sig);
|
||||
_frame = cifframe_from_signature(_sig);
|
||||
[_frame retain];
|
||||
_cframe = [_frame mutableBytes];
|
||||
#endif
|
||||
|
||||
/* Make sure we have somewhere to store the return value if needed.
|
||||
*/
|
||||
|
|
|
@ -50,7 +50,9 @@ typedef struct _cifframe_t {
|
|||
void **values;
|
||||
} cifframe_t;
|
||||
|
||||
extern void *cifframe_from_signature (NSMethodSignature *info);
|
||||
@class NSMutableData;
|
||||
|
||||
extern NSMutableData *cifframe_from_signature (NSMethodSignature *info);
|
||||
|
||||
extern void cifframe_set_arg(cifframe_t *cframe, int index, void *buffer,
|
||||
int size);
|
||||
|
|
|
@ -122,14 +122,14 @@ cifframe_guess_struct_size(ffi_type *stype)
|
|||
}
|
||||
|
||||
|
||||
void *
|
||||
NSMutableData *
|
||||
cifframe_from_signature (NSMethodSignature *info)
|
||||
{
|
||||
unsigned size = sizeof(cifframe_t);
|
||||
unsigned align = __alignof(double);
|
||||
unsigned type_offset = 0;
|
||||
unsigned offset = 0;
|
||||
void *result;
|
||||
NSMutableData *result;
|
||||
void *buf;
|
||||
int i;
|
||||
int numargs = [info numberOfArguments];
|
||||
|
@ -180,13 +180,9 @@ cifframe_from_signature (NSMethodSignature *info)
|
|||
}
|
||||
}
|
||||
|
||||
#if GS_WITH_GC
|
||||
cframe = buf = result = NSAllocateCollectable(size, NSScannedOption);
|
||||
#else
|
||||
result = (void*)[NSMutableData dataWithCapacity: size];
|
||||
[(NSMutableData*)result setLength: size];
|
||||
cframe = buf = [(NSMutableData*)result mutableBytes];
|
||||
#endif
|
||||
result = [NSMutableData dataWithCapacity: size];
|
||||
[result setLength: size];
|
||||
cframe = buf = [result mutableBytes];
|
||||
|
||||
if (cframe)
|
||||
{
|
||||
|
@ -199,7 +195,8 @@ cifframe_from_signature (NSMethodSignature *info)
|
|||
if (ffi_prep_cif (&cframe->cif, FFI_DEFAULT_ABI, cframe->nargs,
|
||||
rtype, cframe->arg_types) != FFI_OK)
|
||||
{
|
||||
cframe = result = NULL;
|
||||
cframe = NULL;
|
||||
result = NULL;
|
||||
}
|
||||
|
||||
if (cframe)
|
||||
|
|
Loading…
Reference in a new issue