chiark
/
gitweb
/
~mdw
/
mLib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Take advantage of the new dynamic string macros.
[mLib]
/
dstr.c
diff --git
a/dstr.c
b/dstr.c
index 6304351ea64eb8cab0ebf9866bdd7b1290c8611a..fe65ebebed3064119c7b7502e92e06c18e6da0d7 100644
(file)
--- a/
dstr.c
+++ b/
dstr.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: dstr.c,v 1.
6 1999/05/21 08:38:33
mdw Exp $
+ * $Id: dstr.c,v 1.
7 1999/05/21 22:14:30
mdw Exp $
*
* Handle dynamically growing strings
*
*
* Handle dynamically growing strings
*
@@
-30,6
+30,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: dstr.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: dstr.c,v $
+ * Revision 1.7 1999/05/21 22:14:30 mdw
+ * Take advantage of the new dynamic string macros.
+ *
* Revision 1.6 1999/05/21 08:38:33 mdw
* Implement some more functions in terms of macros.
*
* Revision 1.6 1999/05/21 08:38:33 mdw
* Implement some more functions in terms of macros.
*
@@
-205,11
+208,11
@@
int dstr_vputf(dstr *d, const char *p, va_list ap)
const char *q = p;
size_t n = d->len;
size_t sz;
const char *q = p;
size_t n = d->len;
size_t sz;
+ dstr dd = DSTR_INIT;
while (*p) {
unsigned f;
int wd, prec;
while (*p) {
unsigned f;
int wd, prec;
- dstr dd;
enum {
f_short = 1,
enum {
f_short = 1,
@@
-233,7
+236,6
@@
int dstr_vputf(dstr *d, const char *p, va_list ap)
/* --- Sort out the various silly flags and things --- */
/* --- Sort out the various silly flags and things --- */
- dstr_create(&dd);
DPUTC(&dd, '%');
f = 0;
sz = DSTR_PUTFSTEP;
DPUTC(&dd, '%');
f = 0;
sz = DSTR_PUTFSTEP;
@@
-396,13
+398,14
@@
int dstr_vputf(dstr *d, const char *p, va_list ap)
}
formatted:
}
formatted:
-
dstr_destroy
(&dd);
+
DRESET
(&dd);
q = ++p;
}
DPUTM(d, q, p - q);
finished:
DPUTZ(d);
q = ++p;
}
DPUTM(d, q, p - q);
finished:
DPUTZ(d);
+ DDESTROY(&dd);
return (d->len - n);
}
return (d->len - n);
}