From: zooko Date: Thu, 20 Dec 2007 20:55:55 +0000 (+0530) Subject: zfec: silence a warning when compiling on Mac OS X with gcc, and refactor a complicat... X-Git-Url: https://git.rkrishnan.org/pf/content/en/service/frontends/%3C?a=commitdiff_plain;h=9e9f7a271922598dfac81fec1ea5c852d137c685;p=tahoe-lafs%2Fzfec.git zfec: silence a warning when compiling on Mac OS X with gcc, and refactor a complicated #define stanza into the shared header file darcs-hash:89e84b89db0085a83eb17f4e0c104846db996354 --- diff --git a/zfec/zfec/_fecmodule.c b/zfec/zfec/_fecmodule.c index f766321..63b07cb 100644 --- a/zfec/zfec/_fecmodule.c +++ b/zfec/zfec/_fecmodule.c @@ -13,22 +13,6 @@ typedef int Py_ssize_t; #include "stdarg.h" -#if defined(_MSC_VER) -// actually, some of the flavors (i.e. Enterprise) do support restrict -//#define restrict __restrict -#define restrict -#define inline __inline -#define alloca _alloca -#else -#ifdef __GNUC__ -#define alloca(x) __builtin_alloca(x) -#else -#include -#endif -#endif - - - static PyObject *py_fec_error; static char fec__doc__[] = "\ diff --git a/zfec/zfec/fec.c b/zfec/zfec/fec.c index 0fb2f1b..9b1e5fa 100644 --- a/zfec/zfec/fec.c +++ b/zfec/zfec/fec.c @@ -9,21 +9,6 @@ #include #include -#if defined(_MSC_VER) -// actually, some of the flavors (i.e. Enterprise) do support restrict -//#define restrict __restrict -#define restrict -#define inline __inline -#define alloca _alloca -#else -#ifdef __GNUC__ -#define alloca(x) __builtin_alloca(x) -#else -#include -#endif -#endif - - /* * Primitive polynomials - see Lin & Costello, Appendix A, * and Lee & Messerschmitt, p. 453. diff --git a/zfec/zfec/fec.h b/zfec/zfec/fec.h index e9f1108..4004b72 100644 --- a/zfec/zfec/fec.h +++ b/zfec/zfec/fec.h @@ -36,6 +36,21 @@ void fec_encode(const fec_t* code, const gf*restrict const*restrict const src, g */ void fec_decode(const fec_t* code, const gf*restrict const*restrict const inpkts, gf*restrict const*restrict const outpkts, const unsigned*restrict const index, size_t sz); +#if defined(_MSC_VER) +// actually, some of the flavors (i.e. Enterprise) do support restrict +//#define restrict __restrict +#define restrict +#define inline __inline +#define alloca _alloca +#else +#ifdef __GNUC__ +#ifndef alloca +#define alloca(x) __builtin_alloca(x) +#endif +#else +#include +#endif +#endif /** * zfec -- fast forward error correction library with Python interface