* 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.
+2001-08-30 Pascal Bart <pascal.bart@epita.fr>
+
+ * 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.
+
2001-08-30 Marc Autret <autret_m@epita.fr>
* src/reader.c (parse_skel_decl): New.
#include <string.h>
+#include "xalloc.h"
#include "system.h"
#include "hash.h"
#include "files.h"
}
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);
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_ */
#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;
static inline void
output_table_data (struct obstack* oout,
- short* table,
+ short* table_data,
short first,
short begin,
short end)
}
else
++j;
- obstack_fgrow1 (oout, "%6d", table[i]);
+ obstack_fgrow1 (oout, "%6d", table_data[i]);
}
obstack_1grow (oout, 0);
}
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);