1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

Fix for __va_copy on FreeBSD i386.

This commit is contained in:
Ulrich Wilkens 2012-09-05 16:49:35 +02:00 committed by Jon Trulson
parent 33da5fa944
commit 9a34624e25
3 changed files with 26 additions and 1 deletions

View file

@ -350,8 +350,10 @@ write_func_def_params(
va_list va_params va_list va_params
) )
{ {
#if defined(__ppc) || defined(linux) || defined(CSRG_BASED) #if defined(__ppc) || defined(linux) || defined(__OpenBSD__)
#define va_start_params() __va_copy(params, va_params) #define va_start_params() __va_copy(params, va_params)
#elif defined(__FreeBSD__)
#define va_start_params() va_copy(params, va_params)
#else #else
#define va_start_params() (params = va_params) #define va_start_params() (params = va_params)
#endif #endif

View file

@ -214,6 +214,10 @@ hashalloc __PARAM__((Hash_table_t* ref, ...), (va_alist)) __OTORP__(va_dcl)
tab->flags |= HASH_STATIC; tab->flags |= HASH_STATIC;
break; break;
case HASH_va_list: case HASH_va_list:
#if defined(__FreeBSD__) && !defined(__LP64__)
if (vp < &va[elementsof(va)]) *vp++ = ap;
ap = va_arg(ap, va_list);
#else
if (vp < &va[elementsof(va)]) if (vp < &va[elementsof(va)])
{ {
__va_copy( *vp, ap ); __va_copy( *vp, ap );
@ -221,12 +225,17 @@ hashalloc __PARAM__((Hash_table_t* ref, ...), (va_alist)) __OTORP__(va_dcl)
} }
vl = va_arg(ap, va_list); vl = va_arg(ap, va_list);
__va_copy(ap, vl); __va_copy(ap, vl);
#endif
break; break;
case 0: case 0:
if (vp > va) if (vp > va)
{ {
#if defined(__FreeBSD__) && !defined(__LP64__)
ap = *--vp;
#else
vp--; vp--;
__va_copy( ap, *vp ); __va_copy( ap, *vp );
#endif
break; break;
} }
if (tab->flags & HASH_SCOPE) if (tab->flags & HASH_SCOPE)

View file

@ -301,9 +301,15 @@ loop_fa :
GETARG(form,form,argf,args,char*,char*,'1',t_user,n_user); GETARG(form,form,argf,args,char*,char*,'1',t_user,n_user);
if(!form) if(!form)
form = ""; form = "";
#if defined(__FreeBSD__) && !defined(__LP64__)
GETARG(argsp,argsp,argf,args,va_list*,va_list*,'2',t_user,n_user);
memcpy((Void_t*)(&(fa->args)), (Void_t*)(&args), sizeof(va_list));
memcpy((Void_t*)(&args), (Void_t*)argsp, sizeof(va_list));
#else
GETARGL(argsp,argsp,argf,args,va_list*,va_list*,'2',t_user,n_user); GETARGL(argsp,argsp,argf,args,va_list*,va_list*,'2',t_user,n_user);
__va_copy( fa->args, args ); __va_copy( fa->args, args );
__va_copy( args, argsp ); __va_copy( args, argsp );
#endif
fa->argf.p = argf; fa->argf.p = argf;
fa->extf.p = extf; fa->extf.p = extf;
fa->next = fast; fa->next = fast;
@ -313,8 +319,12 @@ loop_fa :
default : /* unknown directive */ default : /* unknown directive */
if(extf) if(extf)
{ {
#if defined(__FreeBSD__) && !defined(__LP64__)
va_list savarg = args; /* is this portable? */
#else
va_list savarg; /* is this portable? Sorry .. NO. */ va_list savarg; /* is this portable? Sorry .. NO. */
__va_copy( savarg, args ); __va_copy( savarg, args );
#endif
GETARG(sp,astr,argf,args,char*,char*,fmt,t_user,n_user); GETARG(sp,astr,argf,args,char*,char*,fmt,t_user,n_user);
astr = NIL(char*); astr = NIL(char*);
@ -322,7 +332,11 @@ loop_fa :
if((sp = astr) ) if((sp = astr) )
goto s_format; goto s_format;
#if defined(__FreeBSD__) && !defined(__LP64__)
args = savarg; /* extf failed, treat as if unmatched */
#else
__va_copy( args, savarg ); /* extf failed, treat as if unmatched */ __va_copy( args, savarg ); /* extf failed, treat as if unmatched */
#endif
} }
/* treat as text */ /* treat as text */