25 |
| struniq_t -- pointers to unique copies of C strings. | |
| struniq_t -- pointers to unique copies of C strings. | |
26 |
`------------------------------------------------------*/ |
`------------------------------------------------------*/ |
27 |
|
|
28 |
typedef char *struniq_t; |
typedef const char *struniq_t; |
29 |
|
|
30 |
/* Return the struniq for S. */ |
/* Return the struniq for S. */ |
31 |
const struniq_t struniq_new (const char *s); |
const struniq_t struniq_new (const char *s); |
32 |
|
|
33 |
|
/* Two struniq have the same value iff they are the same. */ |
34 |
|
#define STRUNIQ_EQ(S1, S2) ((S1) == (S2)) |
35 |
|
|
36 |
/*--------------------------------------. |
/*--------------------------------------. |
37 |
| Initializing, destroying, debugging. | |
| Initializing, destroying, debugging. | |
38 |
`--------------------------------------*/ |
`--------------------------------------*/ |
40 |
/* Create the string table. */ |
/* Create the string table. */ |
41 |
void struniqs_new (void); |
void struniqs_new (void); |
42 |
|
|
43 |
|
/* Die if S is not a struniq. */ |
44 |
|
#define struniq_assert(S) assert (struniq_assert_p (S)); |
45 |
|
bool struniq_assert_p (const char *s); |
46 |
|
|
47 |
/* Free all the memory allocated for symbols. */ |
/* Free all the memory allocated for symbols. */ |
48 |
void struniqs_free (void); |
void struniqs_free (void); |
49 |
|
|