zc_xplatform.h 1.42 KB
Newer Older
Hardy Simpson's avatar
Hardy Simpson committed
1 2 3 4 5
/*
 * This file is part of the zlog Library.
 *
 * Copyright (C) 2011 by Hardy Simpson <HardySimpson1984@gmail.com>
 *
6
 * Licensed under the LGPL v2.1, see the file COPYING in base directory.
Hardy Simpson's avatar
Hardy Simpson committed
7
 */
8 9
#ifndef __zc_xplatform_h
#define __zc_xplatform_h
Hardy Simpson's avatar
Hardy Simpson committed
10

11
#include <limits.h>
Hardy Simpson's avatar
Hardy Simpson committed
12

13 14
#define ZLOG_INT32_LEN   sizeof("-2147483648") - 1
#define ZLOG_INT64_LEN   sizeof("-9223372036854775808") - 1
Hardy Simpson's avatar
Hardy Simpson committed
15

16 17 18 19 20
#if ((__GNU__ == 2) && (__GNUC_MINOR__ < 8))
#define ZLOG_MAX_UINT32_VALUE  (uint32_t) 0xffffffffLL
#else
#define ZLOG_MAX_UINT32_VALUE  (uint32_t) 0xffffffff
#endif
21

22
#define ZLOG_MAX_INT32_VALUE   (uint32_t) 0x7fffffff
23

24 25
#define MAXLEN_PATH 1024
#define MAXLEN_CFG_LINE (MAXLEN_PATH * 4)
Hardy Simpson's avatar
Hardy Simpson committed
26

27 28
#define FILE_NEWLINE "\n"
#define FILE_NEWLINE_LEN 1
29

30 31
#include <string.h>
#include <strings.h>
32

33 34 35 36
#define STRCMP(_a_,_C_,_b_) ( strcmp(_a_,_b_) _C_ 0 )
#define STRNCMP(_a_,_C_,_b_,_n_) ( strncmp(_a_,_b_,_n_) _C_ 0 )
#define STRICMP(_a_,_C_,_b_) ( strcasecmp(_a_,_b_) _C_ 0 )
#define STRNICMP(_a_,_C_,_b_,_n_) ( strncasecmp(_a_,_b_,_n_) _C_ 0 )
Hardy Simpson's avatar
Hardy Simpson committed
37

Hardy Simpson's avatar
Hardy Simpson committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

#ifdef __APPLE__
#include <AvailabilityMacros.h>
#endif

/* Define zlog_fstat to fstat or fstat64() */
#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_6)
#define zlog_fstat fstat64
#define zlog_stat stat64
#else
#define zlog_fstat fstat
#define zlog_stat stat
#endif

/* Define zlog_fsync to fdatasync() in Linux and fsync() for all the rest */
#ifdef __linux__
#define zlog_fsync fdatasync
#else
#define zlog_fsync fsync
#endif



Hardy Simpson's avatar
Hardy Simpson committed
61
#endif