/* PSPP - a program for statistical analysis.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010, 2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <string.h>
#include "libpspp/hash-functions.h"
+#include "libpspp/i18n.h"
#include "libpspp/string-set.h"
#include "libpspp/stringi-set.h"
struct stringi_map_node *
stringi_map_find_node (const struct stringi_map *map, const char *key)
{
- return stringi_map_find_node__ (map, key, hash_case_string (key, 0));
+ return stringi_map_find_node__ (map, key, utf8_hash_case_string (key, 0));
}
/* If MAP contains KEY (or an equivalent with different case) as a key, deletes
stringi_map_insert (struct stringi_map *map, const char *key,
const char *value)
{
- unsigned int hash = hash_case_string (key, 0);
+ unsigned int hash = utf8_hash_case_string (key, 0);
struct stringi_map_node *node = stringi_map_find_node__ (map, key, hash);
if (node == NULL)
node = stringi_map_insert__ (map, xstrdup (key), xstrdup (value), hash);
struct stringi_map_node *
stringi_map_insert_nocopy (struct stringi_map *map, char *key, char *value)
{
- unsigned int hash = hash_case_string (key, 0);
+ unsigned int hash = utf8_hash_case_string (key, 0);
struct stringi_map_node *node = stringi_map_find_node__ (map, key, hash);
if (node == NULL)
node = stringi_map_insert__ (map, key, value, hash);
stringi_map_replace (struct stringi_map *map, const char *key,
const char *value)
{
- unsigned int hash = hash_case_string (key, 0);
+ unsigned int hash = utf8_hash_case_string (key, 0);
struct stringi_map_node *node = stringi_map_find_node__ (map, key, hash);
if (node == NULL)
node = stringi_map_insert__ (map, xstrdup (key), xstrdup (value), hash);
struct stringi_map_node *
stringi_map_replace_nocopy (struct stringi_map *map, char *key, char *value)
{
- unsigned int hash = hash_case_string (key, 0);
+ unsigned int hash = utf8_hash_case_string (key, 0);
struct stringi_map_node *node = stringi_map_find_node__ (map, key, hash);
if (node == NULL)
node = stringi_map_insert__ (map, key, value, hash);
bool
stringi_map_delete (struct stringi_map *map, const char *key)
{
- return stringi_map_delete__ (map, key, hash_case_string (key, 0));
+ return stringi_map_delete__ (map, key, utf8_hash_case_string (key, 0));
}
/* Deletes NODE from MAP and destroys the node and its key and value. */
HMAP_FOR_EACH_WITH_HASH (node, struct stringi_map_node, hmap_node,
hash, &map->hmap)
- if (!strcasecmp (key, node->key))
+ if (!utf8_strcasecmp (key, node->key))
return node;
return NULL;