aboutsummaryrefslogtreecommitdiff
path: root/contrib/sendmail/include/sm/gen.h
blob: 588c4b6fefca49d4922852032543e137795bab72 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * Copyright (c) 2000-2002 Proofpoint, Inc. and its suppliers.
 *	All rights reserved.
 *
 * By using this file, you agree to the terms and conditions set
 * forth in the LICENSE file which can be found at the top level of
 * the sendmail distribution.
 *
 *	$Id: gen.h,v 1.24 2013-11-22 20:51:31 ca Exp $
 */

/*
**  libsm general definitions
**  See libsm/gen.html for documentation.
*/

#ifndef SM_GEN_H
# define SM_GEN_H

# include <sm/config.h>
# include <sm/cdefs.h>
# include <sm/types.h>

/*
**  Define SM_RCSID and SM_IDSTR,
**  macros used to embed RCS and SCCS identification strings in object files.
*/

# ifdef lint
#  define SM_RCSID(str)
#  define SM_IDSTR(id,str)
# else /* lint */
#  define SM_RCSID(str) SM_UNUSED(static const char RcsId[]) = str;
#  define SM_IDSTR(id,str) SM_UNUSED(static const char id[]) = str;
# endif /* lint */

/*
**  Define NULL and offsetof (from the C89 standard)
*/

# if SM_CONF_STDDEF_H
#  include <stddef.h>
# else /* SM_CONF_STDDEF_H */
#  ifndef NULL
#   define NULL	0
#  endif
#  define offsetof(type, member)	((size_t)(&((type *)0)->member))
# endif /* SM_CONF_STDDEF_H */

/*
**  Define bool, true, false (from the C99 standard)
*/

# if SM_CONF_STDBOOL_H
#  include <stdbool.h>
# else /* SM_CONF_STDBOOL_H */
#  ifndef __cplusplus
    typedef int bool;
#   define false	0
#   define true		1
#   define __bool_true_false_are_defined	1
#  endif /* ! __cplusplus */
# endif /* SM_CONF_STDBOOL_H */

/*
**  Define SM_MAX and SM_MIN
*/

# define SM_MAX(a, b)	((a) > (b) ? (a) : (b))
# define SM_MIN(a, b)	((a) < (b) ? (a) : (b))

/* Define SM_SUCCESS and SM_FAILURE */
# define SM_SUCCESS	0
# define SM_FAILURE	(-1)

/* XXX This needs to be fixed when we start to use threads: */
typedef int SM_ATOMIC_INT_T;
typedef unsigned int SM_ATOMIC_UINT_T;

#if _FFR_EAI && !defined(USE_EAI)
# define USE_EAI 1
#endif

#if USE_EAI && !defined(_FFR_LOGASIS)
# define _FFR_LOGASIS 1
#endif

#if USE_EAI || _FFR_EIGHT_BIT_ADDR_OK
# define _FFR_8BITENVADDR 1
#endif

#if _FFR_HAPROXY && !defined(_FFR_XCNCT)
# define _FFR_XCNCT 1
#endif

#endif /* SM_GEN_H */