From a0c6fea32c9f6fca5710a31ebf128b9f8bbf3f54 Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 22 Jun 2018 22:29:52 +0200 Subject: [PATCH] Replace fake-varargs, which doesn't work on 64-bit machines, with real varargs. --- util/ass/ass00.h | 3 +++ util/ass/ass80.c | 27 ++++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/util/ass/ass00.h b/util/ass/ass00.h index 42bd5b01c..3f393c236 100644 --- a/util/ass/ass00.h +++ b/util/ass/ass00.h @@ -256,3 +256,6 @@ struct proctab { cons_t pr_off; /* distance from pb */ cons_t pr_loc; /* number of bytes locals */ }; + +extern void error(const char* string1, ...); +extern void werror(const char* string1, ...); diff --git a/util/ass/ass80.c b/util/ass/ass80.c index 514c8dbc0..122796c24 100644 --- a/util/ass/ass80.c +++ b/util/ass/ass80.c @@ -4,9 +4,10 @@ * */ -#include "ass00.h" -#include "assex.h" -#include +#include "ass00.h" +#include "assex.h" +#include +#include #ifndef NORCSID static char rcs_id[] = "$Id$" ; @@ -29,7 +30,7 @@ zero(area,length) char *area; unsigned length ; { } /* VARARGS1 */ -static void pr_error(string1,a1,a2,a3,a4) char *string1 ; { +static void pr_error(const char* string1, va_list ap) { /* * diagnostic output */ @@ -44,20 +45,28 @@ static void pr_error(string1,a1,a2,a3,a4) char *string1 ; { fprintf(stderr,"proc %s, ",pstate.s_curpro->p_name); } fprintf(stderr,"line %d: ",line_num); - fprintf(stderr,string1,a1,a2,a3,a4); + vfprintf(stderr,string1,ap); fprintf(stderr,"\n"); } /* VARARGS1 */ -void error(string1,a1,a2,a3,a4) char *string1 ; { - pr_error(string1,a1,a2,a3,a4) ; +void error(const char* string1, ...) +{ + va_list ap; + va_start(ap, string1); + pr_error(string1, ap); + va_end(ap); nerrors++ ; } /* VARARGS1 */ -void werror(string1,a1,a2,a3,a4) char *string1 ; { +void werror(const char* string1, ...) { + va_list ap; if ( wflag ) return ; - pr_error(string1,a1,a2,a3,a4) ; + + va_start(ap, string1); + pr_error(string1, ap); + va_end(ap); } fatal(s) char *s; { -- 2.34.1