X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/ec1a68c8a2703555659265994f30e8f9156af21c..0f3e9cfc4b5d0f13085c975e10c0e6c4c8e5fbc3:/src/common.h diff --git a/src/common.h b/src/common.h index cd4bb62..b20969b 100644 --- a/src/common.h +++ b/src/common.h @@ -1,7 +1,7 @@ /* common.h - Common functions/includes * Copyright 2000-2004 srvx Development Team * - * This file is part of srvx. + * This file is part of x3. * * srvx is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -83,21 +83,39 @@ extern struct tm *localtime_r(const time_t *clock, struct tm *res); # define free(p) GC_FREE(p) # undef HAVE_STRDUP # undef strdup -#elif defined(WITH_MALLOC_SRVX) +#elif defined(WITH_MALLOC_X3) # undef malloc -# define malloc(n) srvx_malloc(__FILE__, __LINE__, (n)) +# define malloc(n) x3_malloc(__FILE__, __LINE__, (n)) # undef calloc -# define calloc(m,n) srvx_malloc(__FILE__, __LINE__, (m)*(n)) +# define calloc(m,n) x3_malloc(__FILE__, __LINE__, (m)*(n)) # undef realloc -# define realloc(p,n) srvx_realloc(__FILE__, __LINE__, (p), (n)) +# define realloc(p,n) x3_realloc(__FILE__, __LINE__, (p), (n)) # undef free -# define free(p) srvx_free(__FILE__, __LINE__, (p)) +# define free(p) x3_free(__FILE__, __LINE__, (p)) # undef strdup -# define strdup(s) srvx_strdup(__FILE__, __LINE__, (s)) -extern void *srvx_malloc(const char *, unsigned int, size_t); -extern void *srvx_realloc(const char *, unsigned int, void *, size_t); -extern char *srvx_strdup(const char *, unsigned int, const char *); -extern void srvx_free(const char *, unsigned int, void *); +# define strdup(s) x3_strdup(__FILE__, __LINE__, (s)) +extern void *x3_malloc(const char *, unsigned int, size_t); +extern void *x3_realloc(const char *, unsigned int, void *, size_t); +extern char *x3_strdup(const char *, unsigned int, const char *); +extern void x3_free(const char *, unsigned int, void *); +# if !defined(NDEBUG) +extern void verify(const void *ptr); +# define verify(x) verify(x) +# endif +#elif defined(WITH_MALLOC_SLAB) +# define malloc(n) slab_malloc(__FILE__, __LINE__, (n)) +# undef calloc +# define calloc(m,n) slab_malloc(__FILE__, __LINE__, (m)*(n)) +# undef realloc +# define realloc(p,n) slab_realloc(__FILE__, __LINE__, (p), (n)) +# undef free +# define free(p) slab_free(__FILE__, __LINE__, (p)) +# undef strdup +# define strdup(s) slab_strdup(__FILE__, __LINE__, (s)) +extern void *slab_malloc(const char *, unsigned int, size_t); +extern void *slab_realloc(const char *, unsigned int, void *, size_t); +extern char *slab_strdup(const char *, unsigned int, const char *); +extern void slab_free(const char *, unsigned int, void *); # if !defined(NDEBUG) extern void verify(const void *ptr); # define verify(x) verify(x) @@ -129,9 +147,12 @@ int split_line(char *line, int irc_colon, int argv_size, char *argv[]); int mmatch(const char *glob, const char *newglob); int match_ircglob(const char *text, const char *glob); int user_matches_glob(struct userNode *user, const char *glob, int include_nick); +int is_overmask(char *mask); + int is_ircmask(const char *text); int is_gline(const char *text); +int is_shun(const char *text); char *sanitize_ircmask(char *text); @@ -147,6 +168,9 @@ int checkpass(const char *pass, const char *crypt); int split_ircmask(char *text, char **nick, char **ident, char **host); char *unsplit_string(char *set[], unsigned int max, char *dest); +extern char* x3_strtok(char** save, char* str, char* fs); + +int valid_email(const char *email); #define DECLARE_LIST(STRUCTNAME,ITEMTYPE) struct STRUCTNAME {\ unsigned int used, size;\