X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=src%2Futil.h;h=39c07495d5ddce724492b99aa9b2c851eb102b8a;hb=2b8964c94d39fc6d888e0b274cfb9fbe59424c1c;hp=689ed6262be7401a58707ccd6d9b840cbe476608;hpb=ba2658aef9fdf5965818bddaef06ce2e3945bd41;p=lackey diff --git a/src/util.h b/src/util.h index 689ed62..39c0749 100644 --- a/src/util.h +++ b/src/util.h @@ -1,16 +1,16 @@ /* - * Copyright (C) 2012 Andy Spencer - * + * Copyright (C) 2012,2013 Andy Spencer + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ @@ -22,15 +22,22 @@ #define ROUND(x) ((int)((x)+0.5)) #define N_ELEMENTS(x) (sizeof(x)/sizeof((x)[0])) +#define new0(type) alloc0(sizeof(type)) + /* Debug functions */ void util_init(void); /* Stirng functions */ void strsub(char *str, char find, char repl); +char *strcopy(const char *str); +int match(const char *a, const char *b); + +/* Memory functions */ +void *alloc0(int size); + +/* File functions */ +char *read_file(const char *path, int *len); /* Debug functions */ -#ifdef DEBUG -int debug(char *fmt, ...); -#else -#define debug(...) -#endif +void debug(char *fmt, ...); +void error(char *fmt, ...);