diff options
Diffstat (limited to 'src/regerror.c')
-rw-r--r-- | src/regerror.c | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/src/regerror.c b/src/regerror.c index 70efe9a..3fbcdfe 100644 --- a/src/regerror.c +++ b/src/regerror.c @@ -30,13 +30,7 @@ #include "regint.h" #include <stdio.h> /* for vsnprintf() */ -#ifdef HAVE_STDARG_PROTOTYPES #include <stdarg.h> -#define va_init_list(a,b) va_start(a,b) -#else -#include <varargs.h> -#define va_init_list(a,b) va_start(a) -#endif extern UChar* onig_error_code_to_format(int code) @@ -247,7 +241,7 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end, if (len >= buf_size) break; } - *is_over = ((p < end) ? 1 : 0); + *is_over = p < end; } else { len = MIN((int )(end - s), buf_size); @@ -262,15 +256,7 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end, /* for ONIG_MAX_ERROR_MESSAGE_LEN */ #define MAX_ERROR_PAR_LEN 30 -extern int -#ifdef HAVE_STDARG_PROTOTYPES -onig_error_code_to_str(UChar* s, int code, ...) -#else -onig_error_code_to_str(s, code, va_alist) - UChar* s; - int code; - va_dcl -#endif +extern int onig_error_code_to_str(UChar* s, int code, ...) { UChar *p, *q; OnigErrorInfo* einfo; @@ -278,7 +264,7 @@ onig_error_code_to_str(s, code, va_alist) UChar parbuf[MAX_ERROR_PAR_LEN]; va_list vargs; - va_init_list(vargs, code); + va_start(vargs, code); switch (code) { case ONIGERR_UNDEFINED_NAME_REFERENCE: @@ -330,27 +316,15 @@ onig_error_code_to_str(s, code, va_alist) } -void -#ifdef HAVE_STDARG_PROTOTYPES -onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc, - UChar* pat, UChar* pat_end, const UChar *fmt, ...) -#else -onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist) - UChar buf[]; - int bufsize; - OnigEncoding enc; - UChar* pat; - UChar* pat_end; - const UChar *fmt; - va_dcl -#endif +void onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc, + UChar* pat, UChar* pat_end, const UChar *fmt, ...) { int n, need, len; UChar *p, *s, *bp; UChar bs[6]; va_list args; - va_init_list(args, fmt); + va_start(args, fmt); n = xvsnprintf((char* )buf, bufsize, (const char* )fmt, args); va_end(args); |