#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <unistd.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "common.h"
#include "intern.h"
Functions | |
| const wchar_t * | intern (const wchar_t *in) |
| Return an identical copy of the specified string from a pool of unique strings. | |
| const wchar_t * | intern_static (const wchar_t *in) |
| Insert the specified string literal into the pool of unique strings. | |
| static void | clear_value (void *key, void *data) |
| Free the specified key/value pair. | |
| void | intern_free_all () |
| Free all interned strings. | |
Variables | |
| static hash_table_t * | intern_table = 0 |
| Table of interned strings. | |
| static hash_table_t * | intern_static_table = 0 |
| Table of static interned strings. | |
| static void clear_value | ( | void * | key, | |
| void * | data | |||
| ) | [static] |
Free the specified key/value pair.
Should only be called by intern_free_all at shutdown
References debug().
Referenced by intern_free_all().
| const wchar_t* intern | ( | const wchar_t * | in | ) |
Return an identical copy of the specified string from a pool of unique strings.
If the string was not in the pool, add a copy.
| in | the string to return an interned copy of |
References DIE_MEM, hash_get(), hash_init(), hash_put(), hash_wcs_cmp(), and hash_wcs_func().
Referenced by autoload_names(), builtin_source(), complete_get_exact_entry(), function_add(), history_create_mode(), input_mapping_add(), main(), parse_util_load_internal(), and parser_push_block().
| void intern_free_all | ( | ) |
Free all interned strings.
Only call this at shutdown.
References clear_value(), hash_destroy(), and hash_foreach().
Referenced by main().
| const wchar_t* intern_static | ( | const wchar_t * | in | ) |
Insert the specified string literal into the pool of unique strings.
The string will not first be copied, and it will not be free'd on exit.
| in | the string to add to the interned pool |
References DIE_MEM, hash_get(), hash_init(), hash_put(), hash_wcs_cmp(), and hash_wcs_func().
Referenced by builtin_init(), and builtin_source().
1.5.6