summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/hash.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2012-12-11 14:28:06 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2012-12-11 14:28:06 +0000
commit3226a8894c9f90a96a776fe36456af2cc2d078c7 (patch)
tree5d1387ede5191c9dc0ca5a1b113642cc04c48d32 /Build/source/texk/kpathsea/hash.c
parentfc101b568d7547030fceb58ab5f097d457d49c57 (diff)
kpathsea: Resolve some const related problems
git-svn-id: svn://tug.org/texlive/trunk@28500 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/hash.c')
-rw-r--r--Build/source/texk/kpathsea/hash.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/Build/source/texk/kpathsea/hash.c b/Build/source/texk/kpathsea/hash.c
index 8232eae5ac4..f1d81dbd3a6 100644
--- a/Build/source/texk/kpathsea/hash.c
+++ b/Build/source/texk/kpathsea/hash.c
@@ -1,6 +1,6 @@
/* hash.c: hash table operations.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2005, 2008
+ Copyright 1994-2000, 2002, 2005, 2008, 2012
Karl Berry & Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -158,23 +158,22 @@ hash_remove (hash_table_type *table, const_string key,
/* Look up KEY in TABLE, and return NULL-terminated list of all matching
values (not copies), in insertion order. If none, return NULL. */
-string *
+const_string *
hash_lookup (hash_table_type table, const_string key)
{
hash_element_type *p;
- str_list_type ret;
+ cstr_list_type ret;
unsigned n = hash (table, key);
- ret = str_list_init ();
+ ret = cstr_list_init ();
/* Look at everything in this bucket. */
for (p = table.buckets[n]; p != NULL; p = p->next)
if (FILESTRCASEEQ (key, p->key))
- /* Cast because the general str_list_type shouldn't force const data. */
- str_list_add (&ret, (string) p->value);
+ cstr_list_add (&ret, p->value);
/* If we found anything, mark end of list with null. */
if (STR_LIST (ret))
- str_list_add (&ret, NULL);
+ cstr_list_add (&ret, NULL);
#ifdef KPSE_DEBUG
#if defined (KPSE_COMPAT_API)
@@ -187,7 +186,7 @@ hash_lookup (hash_table_type table, const_string key)
fputs (" (nil)\n", stderr);
else
{
- string *r;
+ const_string *r;
for (r = STR_LIST (ret); *r; r++)
{
putc (' ', stderr);
@@ -207,6 +206,7 @@ hash_lookup (hash_table_type table, const_string key)
return STR_LIST (ret);
}
+#ifdef KPSE_DEBUG
/* We only print nonempty buckets, to decrease output volume. */
void
@@ -246,7 +246,9 @@ hash_print (hash_table_type table, boolean summary_only)
total_elements,
total_buckets ? total_elements / (double) total_buckets : 0.0);
}
+#endif
+#if KPATHSEA_CAN_FREE
void
hash_free (hash_table_type table)
{
@@ -260,3 +262,4 @@ hash_free (hash_table_type table)
p = q;
}
}
+#endif