Skip to content

Commit

Permalink
Remove unused private writefx() function.
Browse files Browse the repository at this point in the history
This eliminates the 3rd last usage of doFormat in Phobos, thus inching
us closer to fully fixing bug #4532.
  • Loading branch information
H. S. Teoh committed Aug 7, 2014
1 parent 32c0556 commit 1682224
Showing 1 changed file with 0 additions and 75 deletions.
75 changes: 0 additions & 75 deletions std/stdio.d
Expand Up @@ -2704,81 +2704,6 @@ unittest
//pragma(msg, "--- todo: readf ---");
}

private
void writefx(FILE* fps, TypeInfo[] arguments, va_list argptr, int newline=false)
{
import std.format : doFormat;
import std.utf : toUTF8;

int orientation = fwide(fps, 0); // move this inside the lock?

/* Do the file stream locking at the outermost level
* rather than character by character.
*/
FLOCK(fps);
scope(exit) FUNLOCK(fps);

auto fp = cast(_iobuf*)fps; // fp is locked version

if (orientation <= 0) // byte orientation or no orientation
{
void putc(dchar c)
{
if (c <= 0x7F)
{
FPUTC(c, fp);
}
else
{
char[4] buf = void;
foreach (i; 0 .. std.utf.toUTF8(buf, c).length)
FPUTC(buf[i], fp);
}
}

std.format.doFormat(&putc, arguments, argptr);
if (newline)
FPUTC('\n', fp);
}
else if (orientation > 0) // wide orientation
{
version (Windows)
{
void putcw(dchar c)
{
import std.utf : isValidDchar;

assert(isValidDchar(c));
if (c <= 0xFFFF)
{
FPUTWC(c, fp);
}
else
{
FPUTWC(cast(wchar) ((((c - 0x10000) >> 10) & 0x3FF) +
0xD800), fp);
FPUTWC(cast(wchar) (((c - 0x10000) & 0x3FF) + 0xDC00), fp);
}
}
}
else version (Posix)
{
void putcw(dchar c)
{
FPUTWC(c, fp);
}
}
else
{
static assert(0);
}

std.format.doFormat(&putcw, arguments, argptr);
if (newline)
FPUTWC('\n', fp);
}
}

/**
* Indicates whether $(D T) is a file handle of some kind.
*/
Expand Down

0 comments on commit 1682224

Please sign in to comment.