helpers.h (1639B)
1 /* 2 * Copyright (c) 1998 Thomas Roessler <roessler@guug.de> 3 * 4 * This file contains the prototypes for several of the 5 * functions from helpers.c. It is part of the "little 6 * brother database" packet. 7 * 8 * These functions have been stolen from the mutt mail 9 * user agent. The copyright notice from there: 10 * 11 * Copyright (C) 1996-8 Michael R. Elkins <me@cs.hmc.edu> 12 * 13 * This program is free software; you can 14 * redistribute it and/or modify it under the terms 15 * of the GNU General Public License as published by 16 * the Free Software Foundation; either version 2 of 17 * the License, or (at your option) any later 18 * version. 19 * 20 * This program is distributed in the hope that it 21 * will be useful, but WITHOUT ANY WARRANTY; without 22 * even the implied warranty of MERCHANTABILITY or 23 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 * General Public License for more details. 25 * 26 * You should have received a copy of the GNU General Public License 27 * along with this program; if not, write to the Free Software Foundation, 28 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,, USA. 29 */ 30 31 /* $Id: helpers.h,v 1.4 2005-10-29 14:48:08 roland Exp $ */ 32 33 #ifndef _HELPERS_H 34 #define _HELPERS_H 35 36 #include <ctype.h> 37 38 char *safe_strdup (const char *); 39 void *safe_calloc (size_t, size_t); 40 void *safe_malloc (unsigned int); 41 void safe_realloc (void **, size_t); 42 void safe_free (void *); 43 44 #define FREE(x) safe_free(x) 45 #define SKIPWS(c) while (*(c) && isspace ((unsigned char) *(c))) c++; 46 #define strfcpy(A,B,C) strncpy(A,B,C), *(A+(C)-1)=0 47 48 #define STRING 256 49 50 #endif