1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +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
)
{
#if defined(__ppc) || defined(linux) || defined(CSRG_BASED)
#if defined(__ppc) || defined(linux) || defined(__OpenBSD__)
#define va_start_params() __va_copy(params, va_params)
#elif defined(__FreeBSD__)
#define va_start_params() va_copy(params, va_params)
#else
#define va_start_params() (params = va_params)
#endif

View file

@ -214,6 +214,10 @@ hashalloc __PARAM__((Hash_table_t* ref, ...), (va_alist)) __OTORP__(va_dcl)
tab->flags |= HASH_STATIC;
break;
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)])
{
__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);
__va_copy(ap, vl);
#endif
break;
case 0:
if (vp > va)
{
#if defined(__FreeBSD__) && !defined(__LP64__)
ap = *--vp;
#else
vp--;
__va_copy( ap, *vp );
#endif
break;
}
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);
if(!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);
__va_copy( fa->args, args );
__va_copy( args, argsp );
#endif
fa->argf.p = argf;
fa->extf.p = extf;
fa->next = fast;
@ -313,8 +319,12 @@ loop_fa :
default : /* unknown directive */
if(extf)
{
#if defined(__FreeBSD__) && !defined(__LP64__)
va_list savarg = args; /* is this portable? */
#else
va_list savarg; /* is this portable? Sorry .. NO. */
__va_copy( savarg, args );
#endif
GETARG(sp,astr,argf,args,char*,char*,fmt,t_user,n_user);
astr = NIL(char*);
@ -322,7 +332,11 @@ loop_fa :
if((sp = astr) )
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 */
#endif
}
/* treat as text */