/* PSPP - a program for statistical analysis.
- Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011, 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
const char *
intern_new (const char *s)
{
- size_t length = strlen (s);
+ return intern_buffer (s, strlen (s));
+}
+
+const char *
+intern_buffer (const char *s, size_t length)
+{
unsigned int hash = hash_bytes (s, length, 0);
struct interned_string *is;
}
}
+/* Returns the length of interned string S. */
+size_t
+intern_strlen (const char *s)
+{
+ return interned_string_from_string (s)->length;
+}
+
/* Given null-terminated string S, returns true if S is an interned string
returned by intern_string_new(), false otherwise.
unsigned int hash = hash_bytes (s, length, 0);
return intern_lookup__ (s, length, hash) != NULL;
}
-
-/* Returns the length of S, which must be an interned string returned by
- intern_new(). */
-size_t
-intern_strlen (const char *s)
-{
- return interned_string_from_string (s)->length;
-}