]> git.saurik.com Git - bison.git/blobdiff - src/struniq.h
(struniq_new): Do not declare the return type
[bison.git] / src / struniq.h
index e83a0834215b6d6d8e85589ded42c24e750bcfa6..adaee5d932c8968087535c50dc3072b8cce341bc 100644 (file)
 | struniq_t -- pointers to unique copies of C strings.  |
 `------------------------------------------------------*/
 
-typedef char *struniq_t;
+typedef const char *struniq_t;
 
 /* Return the struniq for S.  */
-const struniq_t struniq_new (const char *s);
+struniq_t struniq_new (const char *s);
+
+/* Two struniq have the same value iff they are the same.  */
+#define STRUNIQ_EQ(S1, S2) ((S1) == (S2))
 
 /*--------------------------------------.
 | Initializing, destroying, debugging.  |
@@ -37,6 +40,10 @@ const struniq_t struniq_new (const char *s);
 /* Create the string table.  */
 void struniqs_new (void);
 
+/* Die if S is not a struniq.  */
+#define struniq_assert(S) assert (struniq_assert_p (S));
+bool struniq_assert_p (const char *s);
+
 /* Free all the memory allocated for symbols.  */
 void struniqs_free (void);