GNU libmicrohttpd
0.9.69
mhd_compat.h
Go to the documentation of this file.
1
/*
2
This file is part of libmicrohttpd
3
Copyright (C) 2014-2016 Karlson2k (Evgeny Grin)
4
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
9
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
14
15
You should have received a copy of the GNU Lesser General Public
16
License along with this library; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19
*/
20
34
#ifndef MHD_COMPAT_H
35
#define MHD_COMPAT_H 1
36
37
#include "
mhd_options.h
"
38
#include <stdlib.h>
39
#ifdef HAVE_STRING_H
/* for strerror() */
40
#include <string.h>
41
#endif
/* HAVE_STRING_H */
42
43
/* MHD_strerror_ is strerror */
44
#define MHD_strerror_(errnum) strerror ((errnum))
45
46
/* Platform-independent snprintf name */
47
#if defined(HAVE_SNPRINTF)
48
#define MHD_snprintf_ snprintf
49
#else
/* ! HAVE_SNPRINTF */
50
#if defined(_WIN32) && ! defined(__CYGWIN__)
51
/* Emulate snprintf function on W32 */
52
int
W32_snprintf (
char
*__restrict s,
size_t
n,
const
char
*__restrict format,
53
...);
54
55
#define MHD_snprintf_ W32_snprintf
56
#else
/* ! _WIN32 || __CYGWIN__ */
57
#error \
58
Your platform does not support snprintf() and MHD does not know how to emulate it on your platform.
59
#endif
/* ! _WIN32 || __CYGWIN__ */
60
#endif
/* ! HAVE_SNPRINTF */
61
62
#ifdef HAVE_RANDOM
63
67
#define MHD_random_() random ()
68
#else
/* HAVE_RANDOM */
69
#ifdef HAVE_RAND
70
74
#define MHD_random_() ( (((long) rand ()) << 15) + (long) rand () )
75
#endif
/* HAVE_RAND */
76
#endif
/* HAVE_RANDOM */
77
78
#ifdef HAVE_CALLOC
79
82
#define MHD_calloc_(n,s) calloc ((n),(s))
83
#else
/* ! HAVE_CALLOC */
84
87
void
*
MHD_calloc_
(
size_t
nelem,
size_t
elsize);
88
89
#endif
/* ! HAVE_CALLOC */
90
91
#endif
/* MHD_COMPAT_H */
mhd_options.h
additional automatic macros for MHD_config.h
MHD_calloc_
void * MHD_calloc_(size_t nelem, size_t elsize)
Definition:
mhd_compat.c:98
src
microhttpd
mhd_compat.h
Generated by
1.8.16