chiark
/
gitweb
/
~mdw
/
mLib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
@@@ m4
[mLib]
/
struct
/
dstr-putf.c
diff --git
a/struct/dstr-putf.c
b/struct/dstr-putf.c
index 0ff4fb123c351218f0b1e12f75db00267d0783e3..270f9a3f84bdd96e4cdf83c772c6da86daaf6ee7 100644
(file)
--- a/
struct/dstr-putf.c
+++ b/
struct/dstr-putf.c
@@
-32,7
+32,6
@@
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
-#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@
-48,6
+47,7
@@
#include "darray.h"
#include "dstr.h"
#include "darray.h"
#include "dstr.h"
+#include "macros.h"
/*----- Tunable constants -------------------------------------------------*/
/*----- Tunable constants -------------------------------------------------*/
@@
-248,7
+248,7
@@
int dstr_vputf(dstr *d, const char *p, va_list *ap)
done_flags:
i = 0;
done_flags:
i = 0;
- while (
isdigit((unsigned char)
*p)) i = 10*i + *p++ - '0';
+ while (
ISDIGIT(
*p)) i = 10*i + *p++ - '0';
/* --- Snag: this might have been an argument position indicator --- */
/* --- Snag: this might have been an argument position indicator --- */
@@
-270,11
+270,11
@@
int dstr_vputf(dstr *d, const char *p, va_list *ap)
fs->wd = i;
} else if (*p == '*') {
p++;
fs->wd = i;
} else if (*p == '*') {
p++;
- if (!
isdigit((unsigned char)
*p))
+ if (!
ISDIGIT(
*p))
i = anext++;
else {
i = *p++ - '0';
i = anext++;
else {
i = *p++ - '0';
- while (
isdigit((unsigned char)
*p)) i = 10*i + *p++ - '0';
+ while (
ISDIGIT(
*p)) i = 10*i + *p++ - '0';
assert(*p == '$'); p++;
assert(i > 0); i--;
}
assert(*p == '$'); p++;
assert(i > 0); i--;
}
@@
-287,19
+287,19
@@
int dstr_vputf(dstr *d, const char *p, va_list *ap)
if (*p == '.') {
p++;
f |= f_prec;
if (*p == '.') {
p++;
f |= f_prec;
- if (
isdigit((unsigned char)
*p)) {
+ if (
ISDIGIT(
*p)) {
i = *p++ - '0';
i = *p++ - '0';
- while (
isdigit((unsigned char)
*p)) i = 10*i + *p++ - '0';
+ while (
ISDIGIT(
*p)) i = 10*i + *p++ - '0';
fs->prec = i;
} else if (*p != '*')
fs->prec = 0;
else {
p++;
fs->prec = i;
} else if (*p != '*')
fs->prec = 0;
else {
p++;
- if (!
isdigit((unsigned char)
*p))
+ if (!
ISDIGIT(
*p))
i = anext++;
else {
i = *p++ - '0';
i = anext++;
else {
i = *p++ - '0';
- while (
isdigit((unsigned char)
*p)) i = 10*i + *p++ - '0';
+ while (
ISDIGIT(
*p)) i = 10*i + *p++ - '0';
assert(*p == '$'); p++;
assert(i > 0); i--;
}
assert(*p == '$'); p++;
assert(i > 0); i--;
}