1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2010, 2011 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 #ifndef LIBPSPP_INTERN_H
18 #define LIBPSPP_INTERN_H 1
22 An "interned" string is stored in a global hash table. Only one copy of any
23 given string is kept in the hash table, which reduces memory usage in cases
24 where there might otherwise be many duplicates of a given string.
26 Interned strings can be compared for equality by comparing pointers, which
27 can also be a significant advantage in some cases.
29 Interned strings are immutable.
31 See http://en.wikipedia.org/wiki/String_interning for more information. */
36 const char *intern_new (const char *);
37 const char *intern_ref (const char *);
38 void intern_unref (const char *);
40 size_t intern_strlen (const char *);
42 bool is_interned_string (const char *);
44 #endif /* libpspp/intern.h */