Skip to content

Commit

Permalink
Merge pull request #2905 from 9rnsr/revert_pull2902
Browse files Browse the repository at this point in the history
Revert "Merge pull request #2902 from yebblies/typeofva_argsave"
  • Loading branch information
9rnsr committed Jan 24, 2015
2 parents 588c76c + 5417836 commit 80f463a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
21 changes: 16 additions & 5 deletions std/outbuffer.d
Expand Up @@ -312,13 +312,24 @@ class OutBuffer

void printf(string format, ...) @trusted
{
va_list ap;
static if (is(typeof(__va_argsave)))
version (Win64)
{
vprintf(format, _argptr);
}
else version (X86_64)
{
va_list ap;
va_start(ap, __va_argsave);
vprintf(format, ap);
va_end(ap);
}
else
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
{
va_list ap;
ap = cast(va_list)&format;
ap += format.sizeof;
vprintf(format, ap);
}
}

/*****************************************
Expand Down
17 changes: 13 additions & 4 deletions std/stream.d
Expand Up @@ -1204,16 +1204,25 @@ class Stream : InputStream, OutputStream {

// writes data to stream using printf() syntax,
// returns number of bytes written
version (Win64)
size_t printf(const(char)[] format, ...) {
return vprintf(format, _argptr);
}
else version (X86_64)
size_t printf(const(char)[] format, ...) {
va_list ap;
static if (is(typeof(__va_argsave)))
va_start(ap, __va_argsave);
else
va_start(ap, format);
va_start(ap, __va_argsave);
auto result = vprintf(format, ap);
va_end(ap);
return result;
}
else
size_t printf(const(char)[] format, ...) {
va_list ap;
ap = cast(va_list) &format;
ap += format.sizeof;
return vprintf(format, ap);
}

private void doFormatCallback(dchar c) {
char[4] buf;
Expand Down

0 comments on commit 80f463a

Please sign in to comment.