types: Use generic type definitions to separate header file

This commit is contained in:
Martin Willi
2015-04-16 14:49:19 +02:00
parent 717313c542
commit 95726f7617
3 changed files with 89 additions and 63 deletions
+1 -62
View File
@@ -74,27 +74,7 @@
#define BUILD_ASSERT_ARRAY(a) \
BUILD_ASSERT(!__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
/**
* General purpose boolean type.
*/
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#else
# ifndef HAVE__BOOL
# define _Bool signed char
# endif /* HAVE__BOOL */
# define bool _Bool
# define false 0
# define true 1
# define __bool_true_false_are_defined 1
#endif /* HAVE_STDBOOL_H */
#ifndef FALSE
# define FALSE false
#endif /* FALSE */
#ifndef TRUE
# define TRUE true
#endif /* TRUE */
#include "utils/types.h"
#include "enum.h"
#include "utils/atomics.h"
#include "utils/strerror.h"
@@ -433,36 +413,6 @@ static inline void *memset_noop(void *s, int c, size_t n)
*/
#define TIME_32_BIT_SIGNED_MAX 0x7fffffff
/**
* define some missing fixed width int types on OpenSolaris.
* TODO: since the uintXX_t types are defined by the C99 standard we should
* probably use those anyway
*/
#if defined __sun || defined WIN32
#include <stdint.h>
typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
#endif
#ifdef HAVE_INT128
/**
* 128 bit wide signed integer, if supported
*/
typedef __int128 int128_t;
/**
* 128 bit wide unsigned integer, if supported
*/
typedef unsigned __int128 u_int128_t;
# define MAX_INT_TYPE int128_t
# define MAX_UINT_TYPE u_int128_t
#else
# define MAX_INT_TYPE int64_t
# define MAX_UINT_TYPE u_int64_t
#endif
typedef enum status_t status_t;
/**
@@ -575,12 +525,6 @@ enum tty_escape_t {
*/
char* tty_escape_get(int fd, tty_escape_t escape);
/**
* deprecated pluto style return value:
* error message, NULL for success
*/
typedef const char *err_t;
/**
* Handle struct timeval like an own type.
*/
@@ -591,11 +535,6 @@ typedef struct timeval timeval_t;
*/
typedef struct timespec timespec_t;
/**
* Handle struct chunk_t like an own type.
*/
typedef struct sockaddr sockaddr_t;
/**
* malloc(), but returns aligned memory.
*