forked from github/server
4e5f1d05ce
Compile with -std=c89 in gcc. remove all // comments (they are nice, but unnecessary). variables only declared at start of block. various pedantery. backwards compatible va_copy for pre-C99 gcc.
46 lines
984 B
C
46 lines
984 B
C
#pragma once
|
|
|
|
#ifndef UNILIB_H
|
|
#define UNILIB_H
|
|
|
|
#ifdef _MSC_VER
|
|
#ifndef __STDC__
|
|
#define __STDC__ 1 // equivalent to /Za
|
|
#endif
|
|
#define NO_STRDUP
|
|
#define NO_MKDIR
|
|
#define _CRT_SECURE_NO_WARNINGS
|
|
#pragma warning(disable: 4710 4820)
|
|
#pragma warning(disable: 4100) // unreferenced formal parameter
|
|
#pragma warning(disable: 4456) // declaration hides previous
|
|
#pragma warning(disable: 4457) // declaration hides function parameter
|
|
#pragma warning(disable: 4459) // declaration hides global
|
|
#else /* assume gcc */
|
|
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
|
|
# define va_copy(a,b) __va_copy(a,b)
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#define _POSIX_C_SOURCE 200809L
|
|
|
|
#ifndef MAX_PATH
|
|
# define MAX_PATH 4096
|
|
#endif
|
|
|
|
#define UNUSED_ARG(a) (void)(a)
|
|
|
|
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
|
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
|
|
|
#define TOLUA_CAST (char*)
|
|
|
|
#ifdef NO_STRDUP
|
|
char * strdup(const char *s);
|
|
#endif
|
|
|
|
#ifdef NO_MKDIR
|
|
int mkdir(const char *pathname, int mode);
|
|
#endif
|
|
|
|
#endif
|