From 88cc3b3954760d5e2f826310bf021f8e88335eab Mon Sep 17 00:00:00 2001 From: ttate Date: Sun, 12 May 2002 19:54:10 +0000 Subject: cast to long from char, short and int in ASM_PUSH_XXXX. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/dl/dl.h | 6 +++--- ext/dl/sym.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'ext') diff --git a/ext/dl/dl.h b/ext/dl/dl.h index ceee8c5384..5068fc6bbc 100644 --- a/ext/dl/dl.h +++ b/ext/dl/dl.h @@ -161,9 +161,9 @@ #elif defined(USE_DLSTACK) # define ASM_START(sym) # define ASM_END(sym) -# define ASM_PUSH_C(x) memcpy(sp,&x,1); sp++; -# define ASM_PUSH_H(x) memcpy(sp,&x,sizeof(short)); sp++; -# define ASM_PUSH_I(x) memcpy(sp,&x,sizeof(int)); sp++; +# define ASM_PUSH_C(x) {long v=(long)x; memcpy(sp,&v,sizeof(long)); sp++;} +# define ASM_PUSH_H(x) {long v=(long)x; memcpy(sp,&v,sizeof(long)); sp++;} +# define ASM_PUSH_I(x) {long v=(long)x; memcpy(sp,&v,sizeof(long)); sp++;} # define ASM_PUSH_L(x) memcpy(sp,&x,sizeof(long)); sp++; # define ASM_PUSH_P(x) memcpy(sp,&x,sizeof(void*)); sp++; # define ASM_PUSH_F(x) memcpy(sp,&x,sizeof(float)); sp+=sizeof(float)/sizeof(long); diff --git a/ext/dl/sym.c b/ext/dl/sym.c index 996831bec2..5340dcb489 100644 --- a/ext/dl/sym.c +++ b/ext/dl/sym.c @@ -529,8 +529,10 @@ rb_dlsym_call(int argc, VALUE argv[], VALUE self) stack[5],stack[6],stack[7],stack[8],stack[9],\ stack[10],stack[11],stack[12],stack[13],stack[14] int stk_size; - long *stack, *sp; + long stack[15]; + long *sp; + sp = stack; stk_size = stack_size(sym); if( stk_size < 0 ){ FREE_ARGS; @@ -539,10 +541,7 @@ rb_dlsym_call(int argc, VALUE argv[], VALUE self) else if( stk_size > (int)(sizeof(long) * 15) ){ FREE_ARGS; rb_raise(rb_eArgError, "too many arguments."); - stk_size = sizeof(long) * 15; } - stack = (long*)alloca(stk_size); - sp = stack; #elif defined(USE_INLINE_ASM) #define DLSTACK_PROTO #define DLSTACK_ARGS -- cgit v1.2.3