Move initialisation from generated code.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3161 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
RCSID("$Id$");
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <error.h>
|
||||
|
||||
@@ -55,6 +56,27 @@ com_right(struct error_table *list, long code)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
initialize_error_table(struct error_table **list,
|
||||
const char **messages,
|
||||
int num_errors,
|
||||
long base)
|
||||
{
|
||||
struct error_table *et;
|
||||
for(et = *list; et; et = et->next)
|
||||
if(et->msgs == messages)
|
||||
return;
|
||||
et = malloc(sizeof(*et));
|
||||
if (et == NULL)
|
||||
return;
|
||||
et->msgs = messages;
|
||||
et->n_msgs = num_errors;
|
||||
et->base = base;
|
||||
et->next = *list;
|
||||
*list = et;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
free_error_table(struct error_table *et)
|
||||
{
|
||||
|
@@ -41,6 +41,7 @@
|
||||
RCSID("$Id$");
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <error.h>
|
||||
|
||||
@@ -55,6 +56,27 @@ com_right(struct error_table *list, long code)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
initialize_error_table(struct error_table **list,
|
||||
const char **messages,
|
||||
int num_errors,
|
||||
long base)
|
||||
{
|
||||
struct error_table *et;
|
||||
for(et = *list; et; et = et->next)
|
||||
if(et->msgs == messages)
|
||||
return;
|
||||
et = malloc(sizeof(*et));
|
||||
if (et == NULL)
|
||||
return;
|
||||
et->msgs = messages;
|
||||
et->n_msgs = num_errors;
|
||||
et->base = base;
|
||||
et->next = *list;
|
||||
*list = et;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
free_error_table(struct error_table *et)
|
||||
{
|
||||
|
Reference in New Issue
Block a user