Include some headers and move some functions
This commit is contained in:
parent
a23f377731
commit
c0563111f8
@ -1,10 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "http.h"
|
||||
#include "md5.h"
|
||||
#include "font.h"
|
||||
#include "defines.h"
|
||||
#include "powder.h"
|
||||
#include "interface.h"
|
||||
#include "misc.h"
|
||||
|
||||
SDLMod sdl_mod;
|
||||
int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0;
|
||||
|
34
main.c
34
main.c
@ -1167,40 +1167,6 @@ int execute_tagop(pixel *vid_buf, char *op, char *tag)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct strlist
|
||||
{
|
||||
char *str;
|
||||
struct strlist *next;
|
||||
};
|
||||
|
||||
void strlist_add(struct strlist **list, char *str)
|
||||
{
|
||||
struct strlist *item = malloc(sizeof(struct strlist));
|
||||
item->str = mystrdup(str);
|
||||
item->next = *list;
|
||||
*list = item;
|
||||
}
|
||||
|
||||
int strlist_find(struct strlist **list, char *str)
|
||||
{
|
||||
struct strlist *item;
|
||||
for(item=*list; item; item=item->next)
|
||||
if(!strcmp(item->str, str))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void strlist_free(struct strlist **list)
|
||||
{
|
||||
struct strlist *item;
|
||||
while(*list)
|
||||
{
|
||||
item = *list;
|
||||
*list = (*list)->next;
|
||||
free(item);
|
||||
}
|
||||
}
|
||||
|
||||
void thumb_cache_inval(char *id);
|
||||
|
||||
void execute_save(pixel *vid_buf)
|
||||
|
28
misc.c
28
misc.c
@ -53,3 +53,31 @@ char *mystrdup(char *s)
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void strlist_add(struct strlist **list, char *str)
|
||||
{
|
||||
struct strlist *item = malloc(sizeof(struct strlist));
|
||||
item->str = mystrdup(str);
|
||||
item->next = *list;
|
||||
*list = item;
|
||||
}
|
||||
|
||||
int strlist_find(struct strlist **list, char *str)
|
||||
{
|
||||
struct strlist *item;
|
||||
for(item=*list; item; item=item->next)
|
||||
if(!strcmp(item->str, str))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void strlist_free(struct strlist **list)
|
||||
{
|
||||
struct strlist *item;
|
||||
while(*list)
|
||||
{
|
||||
item = *list;
|
||||
*list = (*list)->next;
|
||||
free(item);
|
||||
}
|
||||
}
|
12
misc.h
12
misc.h
@ -22,4 +22,16 @@ extern inline float restrict_flt(float f, float min, float max);
|
||||
|
||||
char *mystrdup(char *s);
|
||||
|
||||
struct strlist
|
||||
{
|
||||
char *str;
|
||||
struct strlist *next;
|
||||
};
|
||||
|
||||
void strlist_add(struct strlist **list, char *str);
|
||||
|
||||
int strlist_find(struct strlist **list, char *str);
|
||||
|
||||
void strlist_free(struct strlist **list);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user