All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cf_types.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2008-2013 by Aerospike.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to
6  * deal in the Software without restriction, including without limitation the
7  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8  * sell copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20  * IN THE SOFTWARE.
21  *****************************************************************************/
22 #pragma once
23 
24 #include <stdlib.h>
25 #include <string.h>
26 #include <inttypes.h>
27 #include <unistd.h>
28 
29 #ifndef CF_WINDOWS
30 /******************************************************************************
31  * LINUX
32  *****************************************************************************/
33 
34 #include <stdbool.h> // A real pity that Linux requires this for bool, true & false:
35 #include <alloca.h> // Use alloca() instead of variable-sized stack arrays for non-gcc portability.
36 
37 #else // CF_WINDOWS
38 /******************************************************************************
39  * WINDOWS
40  *****************************************************************************/
41 
42 #include <malloc.h> // for alloca()
43 
44 #define PRIu64 "I64u"
45 #define PRId64 "I64d"
46 
47 #endif // CF_WINDOWS
48 
49 
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 /******************************************************************************
56  * CONSTANTS
57  ******************************************************************************/
58 
59 #define CITRUSLEAF_EPOCH 1262304000
60 #define INVALID_FD (-1)
61 #define FALSE 0
62 #define TRUE 1
63 
64 /******************************************************************************
65  * TYPES
66  ******************************************************************************/
67 
68 typedef uint8_t byte;
69 typedef unsigned int uint;
70 
72  uint64_t sz;
73  byte data[];
74 };
75 
76 typedef struct cf_bytearray_t cf_bytearray;
77 
78 /******************************************************************************/
79 
80 #ifdef __cplusplus
81 } // end extern "C"
82 #endif