OSDN Git Service

add doxycomment
[ccunit/ccunit.git] / src / ccunit / CCUnitConfig.h
1 /* Copyright (C) 2003 TSUTSUMI Kikuo.
2    This file is part of the CCUnit Library.
3
4    The CCUnit Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public License
6    as published by the Free Software Foundation; either version 2.1 of
7    the License, or (at your option) any later version.
8
9    The CCUnit Library is distributed in the hope that it will be
10    useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU Lesser General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with the CCUnit Library; see the file COPYING.LESSER.
16    If not, write to the Free Software Foundation, Inc., 59 Temple
17    Place - Suite 330, Boston, MA 02111-1307, USA.  
18 */
19
20 /*
21  * $Id$
22  */
23 #ifndef CCUNITCONFIG_H
24 #define CCUNITCONFIG_H
25
26 #if HAVE_CONFIG_H
27 #  include <config.h>
28 #endif
29
30 #if WITH_DMALLOC
31 #  include <dmalloc.h>
32 #endif
33
34 #if STDC_HEADERS
35 #include <stdlib.h>
36 #include <string.h>
37 #endif
38
39 #if HAVE_STDBOOL_H
40 #include <stdbool.h>
41 #elif defined (__cplusplus)
42 #elif !defined (bool)
43 #define bool int
44 #define true (1)
45 #define false (0)
46 #endif
47
48 /**
49  * safty free memory.
50  * Omits dmalloc's free(NULL) warning.
51  * @param p [in/out] pointer to free. and set NULL.
52  */
53 #define safe_free(p) (!p ? NULL : (free (p), p = NULL))
54
55 /**
56  * safty strdup. Tries not to pass NULL to strdup.
57  * @param s string to duplicate.
58  * @return duplicated string, or NULL when error occured.
59  */
60 #define safe_strdup(s) (!s ? NULL : strdup (s))
61
62 /**
63  * printf format string.
64  */
65 #ifdef __CYGWIN__
66 #define PFMTSIZE_T "u"
67 #define PFMTINT32_T "ld"
68 #else
69 #define PFMTSIZE_T "lu"
70 #define PFMTINT32_T "d"
71 #endif
72
73 #endif