#include <config.h>
#include "pool.h"
+#include <stdint.h>
#include <stdlib.h>
#include <libpspp/assertion.h>
#include "message.h"
#include "str.h"
-#include "size_max.h"
#include "xalloc.h"
/* Fast, low-overhead memory block suballocator. */
return pool_clone_unaligned (pool, string, strlen (string) + 1);
}
+/* Duplicates the SIZE bytes of STRING, plus a trailing 0 byte,
+ and returns a pointer to the duplicate. For use only with
+ strings, because the returned pointere may not be aligned
+ properly for other types. */
+char *
+pool_strdup0 (struct pool *pool, const char *string, size_t size)
+{
+ char *new_string = pool_alloc_unaligned (pool, size + 1);
+ memcpy (new_string, string, size);
+ new_string[size] = '\0';
+ return new_string;
+}
+
/* Formats FORMAT with the given ARGS in memory allocated from
POOL and returns the formatted string. */
char *