Style cleanups for printf.
PR: bin/152934 Approved by: jhb (mentor) Obtained from: Illumos MFC after: 2 weeks
This commit is contained in:
parent
7983103ae6
commit
ab71f27172
@ -66,21 +66,21 @@ static const char rcsid[] =
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PF(f, func) do { \
|
#define PF(f, func) do { \
|
||||||
char *b = NULL; \
|
char *b = NULL; \
|
||||||
if (havewidth) \
|
if (havewidth) \
|
||||||
if (haveprec) \
|
if (haveprec) \
|
||||||
(void)asprintf(&b, f, fieldwidth, precision, func); \
|
(void)asprintf(&b, f, fieldwidth, precision, func); \
|
||||||
else \
|
else \
|
||||||
(void)asprintf(&b, f, fieldwidth, func); \
|
(void)asprintf(&b, f, fieldwidth, func); \
|
||||||
else if (haveprec) \
|
else if (haveprec) \
|
||||||
(void)asprintf(&b, f, precision, func); \
|
(void)asprintf(&b, f, precision, func); \
|
||||||
else \
|
else \
|
||||||
(void)asprintf(&b, f, func); \
|
(void)asprintf(&b, f, func); \
|
||||||
if (b) { \
|
if (b) { \
|
||||||
(void)fputs(b, stdout); \
|
(void)fputs(b, stdout); \
|
||||||
free(b); \
|
free(b); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static int asciicode(void);
|
static int asciicode(void);
|
||||||
@ -357,10 +357,10 @@ mknum(char *str, char ch)
|
|||||||
static int
|
static int
|
||||||
escape(char *fmt, int percent, size_t *len)
|
escape(char *fmt, int percent, size_t *len)
|
||||||
{
|
{
|
||||||
char *save, *store;
|
char *save, *store, c;
|
||||||
int value, c;
|
int value;
|
||||||
|
|
||||||
for (save = store = fmt; (c = *fmt); ++fmt, ++store) {
|
for (save = store = fmt; ((c = *fmt) != 0); ++fmt, ++store) {
|
||||||
if (c != '\\') {
|
if (c != '\\') {
|
||||||
*store = c;
|
*store = c;
|
||||||
continue;
|
continue;
|
||||||
@ -414,7 +414,7 @@ escape(char *fmt, int percent, size_t *len)
|
|||||||
*store++ = '%';
|
*store++ = '%';
|
||||||
*store = '%';
|
*store = '%';
|
||||||
} else
|
} else
|
||||||
*store = value;
|
*store = (char)value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*store = *fmt;
|
*store = *fmt;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user