libtrbase
1.0.2
Web server and task management solution.
Main Page
Related Pages
Data Structures
Files
File List
Globals
commons.h
Go to the documentation of this file.
1
/**
2
* \file
3
* Common reusable definitions.
4
*
5
* \todo All public symbols need to be prefixed to make name clashes
6
* more unlikely.
7
*
8
* \author Georg Hopp
9
*
10
* \copyright
11
* Copyright © 2014 Georg Hopp
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation, either version 3 of the License, or
16
* (at your option) any later version.
17
*
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
22
*
23
* You should have received a copy of the GNU General Public License
24
* along with this program. If not, see <http://www.gnu.org/licenses/>.
25
*/
26
27
#ifndef __TR_COMMONS_H__
28
#define __TR_COMMONS_H__
29
30
#define Bool char
31
#ifdef TRUE
32
# undef TRUE
33
#endif
34
#ifdef FALSE
35
# undef FALSE
36
#endif
37
38
#define TRUE 1
39
#define FALSE 0
40
41
#ifndef MAX
42
# define MAX(a,b) ((a)>(b)? (a) : (b))
43
#endif
44
45
#ifndef MIN
46
# define MIN(a,b) ((a)<(b)? (a) : (b))
47
#endif
48
49
/**
50
* XOR variant of swapping a variable
51
*/
52
#define SWAP_XOR(a, b) ((a)^=(b),(b)^=(a),(a)^=(b))
53
54
/**
55
* swap two variable through an intermediate.
56
*/
57
#define SWAP(type, a, b) do { \
58
type tmp = (a); \
59
(a) = (b); \
60
(b) = tmp; \
61
} while(0);
62
63
/**
64
* Const STRing Argument
65
* This makro evaluates to two function argument.
66
*
67
* \param char* val A NULL terminated static string.
68
*/
69
#define CSTRA(val) val, sizeof(val)-1
//!< Const STRing Argument
70
71
#endif // __TR_COMMONS_H__
72
73
// vim: set ts=4 sw=4:
include
tr
commons.h
Generated on Tue Apr 12 2016 10:15:56 for libtrbase by
1.8.10