scc.h (932B)
1 #include <stddef.h> 2 3 extern int enadebug; 4 5 #ifndef NDEBUG 6 #define DBG(...) dbg(__VA_ARGS__) 7 #define DBGON() (enadebug = 1) 8 #else 9 #define DBG(...) 10 #define DBGON() 11 #endif 12 13 struct items { 14 char **s; 15 unsigned n; 16 }; 17 18 #ifdef CLOCKS_PER_SEC 19 struct fprop { 20 unsigned uid; 21 unsigned gid; 22 unsigned long mode; 23 long size; 24 time_t time; 25 }; 26 #endif 27 28 typedef struct alloc Alloc; 29 30 void die(const char *, ...); 31 void dbg(const char *, ...); 32 void newitem(struct items *, char *); 33 void *xmalloc(size_t); 34 void *xcalloc(size_t, size_t); 35 char *xstrdup(const char *); 36 void *xrealloc(void *, size_t); 37 Alloc *alloc(size_t, size_t); 38 void dealloc(Alloc *); 39 void *new(Alloc *); 40 void delete(Alloc *, void *); 41 int casecmp(const char *, const char *); 42 unsigned genhash(char *); 43 char *canonical(char *); 44 45 #ifdef CLOCKS_PER_SEC 46 long long fromepoch(time_t); 47 time_t totime(long long); 48 int getstat(char *, struct fprop *); 49 int setstat(char *, struct fprop *); 50 #endif