no bug - Correct some typos in the comments. a=typo-fix
[gecko.git] / third_party / sipcc / cpr_linux_types.h
blob78f05f413fdda99981fed8cdb95dbcb1d1d1ebcc
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef _CPR_LINUX_TYPES_H_
6 #define _CPR_LINUX_TYPES_H_
8 #include "sys/types.h"
9 #include "stddef.h"
10 #include "inttypes.h"
12 /**
13 * @typedef boolean
15 * Define boolean as an unsigned byte
17 * @note There are differences within TNP header files
18 * @li curses.h: bool => char
19 * @li types.h: boolean_t => enum
20 * @li dki_lock.h: bool_t => int
22 typedef uint8_t boolean;
25 * Define size_t
26 * defined in numerous header files
28 /* DONE (sys/types.h => unsigned int) */
31 * Define ssize_t
33 /* DONE (sys/types.h => int) */
36 * Define MIN/MAX
37 * defined in param.h
39 * The GNU versions of the MAX and MIN macros do two things better than
40 * the old versions:
41 * 1. they are more optimal as they only evaluate a & b once by creating a
42 * a variable of each type on the local stack.
43 * 2. they fix potential errors due to side-effects where a and b were
44 * evaluated twice, i.e. MIN(i++,j++)
46 * @note b could be cast to a's type, to help with usage where the code
47 * compares signed and unsigned types.
49 #ifndef MIN
50 #ifdef __GNUC__
51 #define MIN(a,b) ({ typeof(a) _a = (a); typeof(b) _b = (b); _a < _b ? _a : _b; })
52 #else
53 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
54 #endif
55 #endif
57 #ifndef MAX
58 #ifdef __GNUC__
59 #define MAX(a,b) ({ typeof(a) _a = (a); typeof(b) _b = (b); _a > _b ? _a : _b; })
60 #else
61 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
62 #endif
63 #endif
65 /**
66 * Define TRUE/FALSE
67 * defined in several header files
69 #ifndef TRUE
70 #define TRUE 1
71 #endif
73 #ifndef FALSE
74 #define FALSE 0
75 #endif
78 * Define offsetof
80 /* DONE (stddef.h) */
82 #endif