summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToby Goodwin <toby@paccrat.org>2015-04-04 11:55:08 +0100
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:23:25 +0100
commit8f6cdbf1e60d882598cd649000d13cd9859d8cc9 (patch)
treec709b2f12e6d64856d56bc5904716f2a20350dd2
parentb84c9e384eb97f3ca12700ecadd22bac86f4fe64 (diff)
s/__va_copy/va_copy/g
-rw-r--r--ChangeLog6
-rw-r--r--print.c12
-rw-r--r--proto.h10
3 files changed, 17 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index eebcf3b..cf9dfeb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -858,3 +858,9 @@ Changes since rc-1.5b2
2015-04-03
Packaging: the rc.spec file was very out-of-date.
+
+2015-04-04
+
+ Portability: the comment from 1999-08-19 may well have been true at
+ the time, but the final version of the C99 standard called varargs
+ copying macro va_copy().
diff --git a/print.c b/print.c
index 3484086..2a30b5c 100644
--- a/print.c
+++ b/print.c
@@ -285,11 +285,11 @@ extern int fmtprint(Format *format, const char *fmt,...) {
va_list ap, saveargs;
va_start(ap, fmt);
- __va_copy(saveargs, format->args);
- __va_copy(format->args, ap);
+ va_copy(saveargs, format->args);
+ va_copy(format->args, ap);
n += printfmt(format, fmt);
va_end(format->args);
- __va_copy(format->args, saveargs);
+ va_copy(format->args, saveargs);
return n + format->flushed;
}
@@ -316,7 +316,7 @@ extern int fprint(int fd, const char *fmt,...) {
format.u.n = fd;
va_start(ap, fmt);
- __va_copy(format.args, ap);
+ va_copy(format.args, ap);
printfmt(&format, fmt);
va_end(format.args);
@@ -361,7 +361,7 @@ extern char *mprint(const char *fmt,...) {
format.u.n = 1;
va_start(ap, fmt);
- __va_copy(format.args, ap);
+ va_copy(format.args, ap);
result = memprint(&format, fmt, ealloc(PRINT_ALLOCSIZE), PRINT_ALLOCSIZE);
va_end(format.args);
return result;
@@ -374,7 +374,7 @@ extern char *nprint(const char *fmt,...) {
format.u.n = 0;
va_start(ap, fmt);
- __va_copy(format.args, ap);
+ va_copy(format.args, ap);
result = memprint(&format, fmt, nalloc(PRINT_ALLOCSIZE), PRINT_ALLOCSIZE);
va_end(format.args);
return result;
diff --git a/proto.h b/proto.h
index 3f1e05b..4a2d74a 100644
--- a/proto.h
+++ b/proto.h
@@ -23,11 +23,11 @@ typedef long align_t;
#include <stdarg.h>
-/* C 9x specifies a __va_copy() macro which should be used for copying
-objects of type va_list. Of course, most places don't have this yet,
-but where it does exist we need to use it. */
-#ifndef __va_copy
-#define __va_copy(x,y) (x)=(y)
+/* C 99 specifies a va_copy() macro to be used for copying
+objects of type va_list. If this doesn't exist, hope that simple
+assignment works. */
+#ifndef va_copy
+#define va_copy(x,y) (x)=(y)
#endif
#if STDC_HEADERS