summaryrefslogtreecommitdiff
path: root/libc/stdio/vfprintf.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-11-13 11:10:05 -0800
committerElliott Hughes <enh@google.com>2017-11-13 11:10:05 -0800
commitb70576b04869ae85b2f79e072efd40f792a16baf (patch)
tree83d0a5344d6cc721a281162b305b7d8af859eefa /libc/stdio/vfprintf.cpp
parent0793e3dd07b8ecb5bd0a0e91740f68f42f4f7e60 (diff)
Remove more trivial char/wchar_t printf differences.
Bug: http://b/67371539 Test: ran tests Change-Id: I899458af92517dc21f874519716fa3f3a0f0e3d6
Diffstat (limited to 'libc/stdio/vfprintf.cpp')
-rw-r--r--libc/stdio/vfprintf.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/libc/stdio/vfprintf.cpp b/libc/stdio/vfprintf.cpp
index e1aecbc4d..91828801d 100644
--- a/libc/stdio/vfprintf.cpp
+++ b/libc/stdio/vfprintf.cpp
@@ -43,10 +43,8 @@
#include "printf_common.h"
int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) {
- int ch; /* character from fmt */
- int n, n2; /* handy integers (short term usage) */
+ int n, n2;
CHAR_TYPE* cp; /* handy char pointer (short term usage) */
- struct __siov* iovp; /* for PRINT macro */
CHAR_TYPE sign; /* sign prefix (' ', '+', '-', or \0) */
int flags; /* flags as above */
int ret; /* return value accumulator */
@@ -90,6 +88,7 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) {
#define NIOV 8
struct __suio uio; /* output information: summary */
struct __siov iov[NIOV]; /* ... and individual io vectors */
+ struct __siov* iovp; /* for PRINT macro */
CHAR_TYPE buf[BUF]; /* buffer with space for digits of uintmax_t */
CHAR_TYPE ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */
union arg* argtable; /* args, built due to positional arg */
@@ -115,9 +114,6 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) {
static const char xdigs_lower[] = "0123456789abcdef";
static const char xdigs_upper[] = "0123456789ABCDEF";
- /*
- * BEWARE, these `goto error' on error, and PAD uses `n'.
- */
#define PRINT(ptr, len) \
do { \
iovp->iov_base = (ptr); \
@@ -163,6 +159,7 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) {
* Scan the format for conversions (`%' character).
*/
for (;;) {
+ int ch;
for (cp = fmt; (ch = *fmt) != '\0' && ch != '%'; fmt++) continue;
if (fmt != cp) {
ptrdiff_t m = fmt - cp;