struct/dstr-putf.c: Remove apparently redundant inclusion of <math.h>.
[mLib] / struct / dstr.h
index 3ef3051..1c43cb7 100644 (file)
 #  include "arena.h"
 #endif
 
+#ifndef MLIB_MACROS_H
+#  include "macros.h"
+#endif
+
 /*----- 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
- *             @char ch@ = character to append
+ *             @int ch@ = character to append
  *
  * 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);                                                      \
-  _d->buf[_d->len++] = (ch);                                           \
+  *((unsigned char *)_d->buf + _d->len++) = (ch);                      \
 } while (0)
 
 /* --- @dstr_putz@ --- *
@@ -225,7 +229,8 @@ extern int dstr_vputf(dstr */*d*/, const char */*p*/, va_list */*ap*/);
  *             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@ --- *
  *