/*
* UCW Library -- Memory Pools (String Operations)
*
- * (c) 2004 Martin Mares <mj@ucw.cz>
+ * (c) 2004--2015 Martin Mares <mj@ucw.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU Lesser General Public License.
#include <ucw/lib.h>
#include <ucw/mempool.h>
+#include <ucw/unicode.h>
#include <alloca.h>
#include <string.h>
return str;
}
+void *mp_append_utf8_32(struct mempool *pool, void *p, uint c)
+{
+ p = mp_spread(pool, p, utf8_space(c));
+ return utf8_32_put(p, c);
+}
+
#ifdef TEST
#include <stdio.h>
return mp_append_block(pool, p, str, strlen(str));
}
+/**
+ * Append an UTF-8 character to the growing buffer. Called with @p pointing after
+ * the last byte in the buffer, returns a pointer after the last byte
+ * of the new (possibly reallocated) buffer.
+ **/
+void *mp_append_utf8_32(struct mempool *pool, void *p, uint c);
+
/**
* Close the growing buffer. The @end must point just behind the data, you want to keep
* allocated (so it can be in the interval `[@mp_ptr(@pool), @mp_ptr(@pool) + @mp_avail(@pool)]`).