summaryrefslogtreecommitdiff
path: root/libffi/src
diff options
context:
space:
mode:
authorbo <bo@138bc75d-0d04-0410-961f-82ee72b054a4>2002-05-27 13:54:44 +0000
committerbo <bo@138bc75d-0d04-0410-961f-82ee72b054a4>2002-05-27 13:54:44 +0000
commiteadca1d597846ed181a0656fa5609b3ace408dc2 (patch)
treea73c432d6339233c1f180b6e58b4e4443d00a053 /libffi/src
parentf20183e647ff9f2e7cb27580758622df761da4e5 (diff)
downloadgcc-eadca1d597846ed181a0656fa5609b3ace408dc2.tar.gz
2002-05-27 Bo Thorsen <bo@suse.de>
* src/x86/ffi.c (ffi_prep_args): Remove unused variable and fix formatting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53926 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libffi/src')
-rw-r--r--libffi/src/x86/ffi.c98
1 files changed, 46 insertions, 52 deletions
diff --git a/libffi/src/x86/ffi.c b/libffi/src/x86/ffi.c
index a6e73f711e3..b64265bb3d4 100644
--- a/libffi/src/x86/ffi.c
+++ b/libffi/src/x86/ffi.c
@@ -37,7 +37,6 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
{
register unsigned int i;
register int tmp;
- register unsigned int avn;
register void **p_argv;
register char *argp;
register ffi_type **p_arg;
@@ -45,12 +44,12 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
tmp = 0;
argp = stack;
- if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) {
- *(void **) argp = ecif->rvalue;
- argp += 4;
- }
+ if (ecif->cif->rtype->type == FFI_TYPE_STRUCT)
+ {
+ *(void **) argp = ecif->rvalue;
+ argp += 4;
+ }
- avn = ecif->cif->nargs;
p_argv = ecif->avalue;
for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
@@ -60,58 +59,53 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
size_t z;
/* Align if necessary */
- if (((*p_arg)->alignment - 1) & (unsigned) argp) {
+ if (((*p_arg)->alignment - 1) & (unsigned) argp)
argp = (char *) ALIGN(argp, (*p_arg)->alignment);
- }
- if (avn != 0)
+ z = (*p_arg)->size;
+ if (z < sizeof(int))
{
- avn--;
- z = (*p_arg)->size;
- if (z < sizeof(int))
- {
- z = sizeof(int);
- switch ((*p_arg)->type)
- {
- case FFI_TYPE_SINT8:
- *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
- break;
-
- case FFI_TYPE_UINT8:
- *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
- break;
-
- case FFI_TYPE_SINT16:
- *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
- break;
-
- case FFI_TYPE_UINT16:
- *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
- break;
-
- case FFI_TYPE_SINT32:
- *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv);
- break;
-
- case FFI_TYPE_UINT32:
- *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
- break;
-
- case FFI_TYPE_STRUCT:
- *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
- break;
-
- default:
- FFI_ASSERT(0);
- }
- }
- else
+ z = sizeof(int);
+ switch ((*p_arg)->type)
{
- memcpy(argp, *p_argv, z);
+ case FFI_TYPE_SINT8:
+ *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_UINT8:
+ *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_SINT16:
+ *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_UINT16:
+ *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_SINT32:
+ *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_UINT32:
+ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_STRUCT:
+ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
+ break;
+
+ default:
+ FFI_ASSERT(0);
}
- p_argv++;
- argp += z;
}
+ else
+ {
+ memcpy(argp, *p_argv, z);
+ }
+ p_argv++;
+ argp += z;
}
return;