1 /* 2 * Copyright (c) 2004, Stefan Walter 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * * Redistributions of source code must retain the above 10 * copyright notice, this list of conditions and the 11 * following disclaimer. 12 * * Redistributions in binary form must reproduce the 13 * above copyright notice, this list of conditions and 14 * the following disclaimer in the documentation and/or 15 * other materials provided with the distribution. 16 * * The names of contributors to this software may not be 17 * used to endorse or promote products derived from this 18 * software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 31 * DAMAGE. 32 * 33 * 34 * CONTRIBUTORS 35 * Stef Walter <stef@memberwebs.com> 36 * 37 */ 38 39 #ifndef __USUALS_H__ 40 #define __USUALS_H__ 41 42 #include <sys/types.h> 43 44 #include "config.h" 45 46 #include <stdio.h> 47 #include <stdlib.h> 48 #include <errno.h> 49 #include <string.h> 50 51 #include "compat.h" 52 53 #ifndef NULL 54 #define NULL 0 55 #endif 56 57 #ifndef max 58 #define max(a,b) (((a) > (b)) ? (a) : (b)) 59 #endif 60 61 #ifndef min 62 #define min(a,b) (((a) < (b)) ? (a) : (b)) 63 #endif 64 65 #define countof(x) (sizeof(x) / sizeof(x[0])) 66 67 #ifdef _DEBUG 68 #include "assert.h" 69 #define ASSERT(x) assert(x) 70 #else 71 #define ASSERT(x) 72 #endif 73 74 #define KL(s) ((sizeof(s) - 1) / sizeof(char)) 75 #define RETURN(x) { ret = (x); goto cleanup; } 76 77 78 #endif /* __USUALS_H__ */ 79