mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 04:43:03 +00:00
* src/main.c: Include macrotab.h.
* src/macrotab.h (macro_entry_s): Constify fields. Adjust functions prototypes. * src/macrotab.c (macro_insert): Constify key and value. (macro_find): Constify key. (macro_insert): Include 'xalloc.h' (macro_insert): Use XMALLOC. (macro_find): Constify return value. * src/output.c (output_table_data): Rename table to table_data. (output_parser): Constify macro_key, macro_value.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "xalloc.h"
|
||||
#include "system.h"
|
||||
#include "hash.h"
|
||||
#include "files.h"
|
||||
@@ -110,16 +111,16 @@ macro_init (void)
|
||||
}
|
||||
|
||||
void
|
||||
macro_insert (char* key, char* value)
|
||||
macro_insert (const char *key, const char *value)
|
||||
{
|
||||
macro_entry_t* pair = (macro_entry_t*) xmalloc (sizeof (macro_entry_t));
|
||||
macro_entry_t* pair = XMALLOC (macro_entry_t, 1);
|
||||
pair->key = key;
|
||||
pair->value = value;
|
||||
hash_insert (¯o_table, pair);
|
||||
}
|
||||
|
||||
char*
|
||||
macro_find (char* key)
|
||||
const char*
|
||||
macro_find (const char *key)
|
||||
{
|
||||
macro_entry_t pair = { key, 0 };
|
||||
macro_entry_t* result = hash_find_item (¯o_table, &pair);
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
|
||||
typedef struct macro_entry_s
|
||||
{
|
||||
char* key;
|
||||
char* value;
|
||||
const char* key;
|
||||
const char* value;
|
||||
} macro_entry_t;
|
||||
|
||||
void macro_init PARAMS ((void));
|
||||
void macro_insert PARAMS ((char* key, char* value));
|
||||
char* macro_find PARAMS ((char* key));
|
||||
void macro_insert PARAMS ((const char *key, const char *value));
|
||||
const char* macro_find PARAMS ((const char *key));
|
||||
|
||||
#endif /* not MACROTAB_H_ */
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "LR0.h"
|
||||
#include "conflicts.h"
|
||||
#include "print_graph.h"
|
||||
#include "macrotab.h"
|
||||
|
||||
/* The name this program was run with, for messages. */
|
||||
char *program_name;
|
||||
|
||||
@@ -130,7 +130,7 @@ struct obstack output_obstack;
|
||||
|
||||
static inline void
|
||||
output_table_data (struct obstack* oout,
|
||||
short* table,
|
||||
short* table_data,
|
||||
short first,
|
||||
short begin,
|
||||
short end)
|
||||
@@ -149,7 +149,7 @@ output_table_data (struct obstack* oout,
|
||||
}
|
||||
else
|
||||
++j;
|
||||
obstack_fgrow1 (oout, "%6d", table[i]);
|
||||
obstack_fgrow1 (oout, "%6d", table_data[i]);
|
||||
}
|
||||
obstack_1grow (oout, 0);
|
||||
}
|
||||
@@ -984,8 +984,8 @@ output_parser (void)
|
||||
else if ((c = getc (fskel)) == '%')
|
||||
{
|
||||
/* Read the macro. */
|
||||
char* macro_key = 0;
|
||||
char* macro_value = 0;
|
||||
const char* macro_key = 0;
|
||||
const char* macro_value = 0;
|
||||
while (isalnum (c = getc (fskel)) || c == '_')
|
||||
obstack_1grow (¯o_obstack, c);
|
||||
obstack_1grow (¯o_obstack, 0);
|
||||
|
||||
Reference in New Issue
Block a user