chiark
/
gitweb
/
~mdw
/
mLib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
utils/macros.3: Document `CLANG_WARNING'.
[mLib]
/
struct
/
dstr.h
diff --git
a/struct/dstr.h
b/struct/dstr.h
index 3ef3051f4ad960629bdf463455655c334a4b89ef..1c43cb720e1b74ab1b61b95627af809da6691a22 100644
(file)
--- a/
struct/dstr.h
+++ b/
struct/dstr.h
@@
-56,6
+56,10
@@
# include "arena.h"
#endif
# include "arena.h"
#endif
+#ifndef MLIB_MACROS_H
+# include "macros.h"
+#endif
+
/*----- Data structures ---------------------------------------------------*/
typedef struct dstr {
/*----- Data structures ---------------------------------------------------*/
typedef struct dstr {
@@
-141,19
+145,19
@@
extern void dstr_ensure(dstr */*d*/, size_t /*sz*/);
/* --- @dstr_putc@ --- *
*
* Arguments: @dstr *d@ = pointer to a dynamic string block
/* --- @dstr_putc@ --- *
*
* Arguments: @dstr *d@ = pointer to a dynamic string block
- * @
char
ch@ = character to append
+ * @
int
ch@ = character to append
*
* Returns: ---
*
* Use: Appends a character to a string.
*/
*
* Returns: ---
*
* Use: Appends a character to a string.
*/
-extern void dstr_putc(dstr */*d*/,
char
/*ch*/);
+extern void dstr_putc(dstr */*d*/,
int
/*ch*/);
#define DPUTC(d, ch) do { \
dstr *_d = (d); \
DENSURE(_d, 1); \
#define DPUTC(d, ch) do { \
dstr *_d = (d); \
DENSURE(_d, 1); \
-
_d->buf[_d->len++] = (ch);
\
+
*((unsigned char *)_d->buf + _d->len++) = (ch);
\
} while (0)
/* --- @dstr_putz@ --- *
} while (0)
/* --- @dstr_putz@ --- *
@@
-225,7
+229,8
@@
extern int dstr_vputf(dstr */*d*/, const char */*p*/, va_list */*ap*/);
* itself is malicious.
*/
* itself is malicious.
*/
-extern int dstr_putf(dstr */*d*/, const char */*p*/, ...);
+extern int PRINTF_LIKE(2, 3)
+ dstr_putf(dstr */*d*/, const char */*p*/, ...);
/* --- @dstr_putd@ --- *
*
/* --- @dstr_putd@ --- *
*