/[bison]/bison/src/struniq.c
ViewVC logotype

Diff of /bison/src/struniq.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by akim, Tue Nov 12 07:55:55 2002 UTC revision 1.2 by akim, Tue Nov 12 08:05:59 2002 UTC
# Line 20  Line 20 
20    
21  #include "system.h"  #include "system.h"
22  #include "quotearg.h"  #include "quotearg.h"
23    #include "error.h"
24  #include "hash.h"  #include "hash.h"
25  #include "struniq.h"  #include "struniq.h"
26    
# Line 39  static struct hash_table *struniqs_table Line 40  static struct hash_table *struniqs_table
40  const struniq_t  const struniq_t
41  struniq_new (const char *s)  struniq_new (const char *s)
42  {  {
43    /* Keep the struniqs in a printable form.  */    struniq_t res = hash_lookup (struniqs_table, s);
   struniq_t res = hash_lookup (struniqs_table,  
                                quotearg_style (escape_quoting_style, s));  
   
44    if (!res)    if (!res)
45      {      {
46        /* First insertion in the hash. */        /* First insertion in the hash. */
47        res = xstrdup (quotearg_style (escape_quoting_style, s));        res = xstrdup (s);
48        hash_insert (struniqs_table, res);        hash_insert (struniqs_table, res);
49      }      }
50    return res;    return res;
51  }  }
52    
53    
54    /*---------------------------------.
55    | Return TRUE iff S is a struniq.  |
56    `---------------------------------*/
57    
58    bool
59    struniq_assert_p (const char *s)
60    {
61      if (!hash_lookup (struniqs_table, s))
62        {
63          error (0, 0, "not a struniq: %s", quotearg (s));
64          return false;
65        }
66      else
67        {
68          return true;
69        }
70    }
71    
72    
73  /*--------------------.  /*--------------------.
74  | Print the struniq.  |  | Print the struniq.  |
75  `--------------------*/  `--------------------*/

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26