remove strlist from config.c, move it to reports.c (where it is used primarily).

this is not the best data structure there is, should replace it some day.
This commit is contained in:
Enno Rehling 2014-12-17 17:40:36 +01:00
parent 8971f59ecc
commit 1050daac19
4 changed files with 29 additions and 28 deletions

View File

@ -990,26 +990,6 @@ int getunit(const region * r, const faction * f, unit **uresult)
return result; return result;
} }
/* - String Listen --------------------------------------------- */
void addstrlist(strlist ** SP, const char *s)
{
strlist *slist = malloc(sizeof(strlist));
slist->next = NULL;
slist->s = _strdup(s);
addlist(SP, slist);
}
void freestrlist(strlist * s)
{
strlist *q, *p = s;
while (p) {
q = p->next;
free(p->s);
free(p);
p = q;
}
}
/* - Namen der Strukturen -------------------------------------- */ /* - Namen der Strukturen -------------------------------------- */
char *untilde(char *ibuf) char *untilde(char *ibuf)
{ {

View File

@ -108,14 +108,6 @@ extern "C" {
/* special units */ /* special units */
void make_undead_unit(struct unit *); void make_undead_unit(struct unit *);
typedef struct strlist {
struct strlist *next;
char *s;
} strlist;
void addstrlist(strlist ** SP, const char *s);
void freestrlist(strlist * s);
unsigned int atoip(const char *s); unsigned int atoip(const char *s);
unsigned int getuint(void); unsigned int getuint(void);
int getint(void); int getint(void);

View File

@ -2406,6 +2406,26 @@ static void eval_int36(struct opstack **stack, const void *userdata)
/*** END MESSAGE RENDERING ***/ /*** END MESSAGE RENDERING ***/
/* - String Listen --------------------------------------------- */
void addstrlist(strlist ** SP, const char *s)
{
strlist *slist = malloc(sizeof(strlist));
slist->next = NULL;
slist->s = _strdup(s);
addlist(SP, slist);
}
void freestrlist(strlist * s)
{
strlist *q, *p = s;
while (p) {
q = p->next;
free(p->s);
free(p);
p = q;
}
}
#include <util/nrmessage.h> #include <util/nrmessage.h>
static void log_orders(const struct message *msg) static void log_orders(const struct message *msg)

View File

@ -142,6 +142,15 @@ extern "C" {
size_t f_regionid(const struct region *r, const struct faction *f, size_t f_regionid(const struct region *r, const struct faction *f,
char *buffer, size_t size); char *buffer, size_t size);
typedef struct strlist {
struct strlist *next;
char *s;
} strlist;
void addstrlist(strlist ** SP, const char *s);
void freestrlist(strlist * s);
#define GR_PLURAL 0x01 /* grammar: plural */ #define GR_PLURAL 0x01 /* grammar: plural */
#define MAX_INVENTORY 128 /* maimum number of different items in an inventory */ #define MAX_INVENTORY 128 /* maimum number of different items in an inventory */
#define MAX_RAWMATERIALS 8 /* maximum kinds of raw materials in a regions */ #define MAX_RAWMATERIALS 8 /* maximum kinds of raw materials in a regions */