#include "libpspp/string-set.h"
#include "gl/xalloc.h"
+#include "gl/xmemdup0.h"
static struct string_map_node *string_map_find_node_with_hash (
const struct string_map *, const char *key, size_t length,
struct string_map_node *node = string_map_find_node_with_hash (map, key,
length, hash);
if (node == NULL)
- node = string_map_insert__ (map, xstrdup (key), xstrdup (value), hash);
+ node = string_map_insert__ (map, xmemdup0 (key, length), xstrdup (value),
+ hash);
return node;
}
struct string_map_node *node = string_map_find_node_with_hash (map, key,
length, hash);
if (node == NULL)
- node = string_map_insert__ (map, xstrdup (key), xstrdup (value), hash);
+ node = string_map_insert__ (map, xmemdup0 (key, length),
+ xstrdup (value), hash);
else
string_map_node_set_value (node, value);
return node;