mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-07-01 23:35:58 +00:00
Add NEED_ALLOCA macro
since a9438d1f5e, project introduced alloca calls. but in [BSD manpage][1], this function is machine and compiler dependent. also if use newlib or glibc, this function requires `alloca.h` unlike bsd system. this patch just revert alloca call except MSC case. [1]: https://www.freebsd.org/cgi/man.cgi?alloca
This commit is contained in:
parent
6e7965f013
commit
41248aad1e
@ -42,6 +42,7 @@
|
|||||||
#include "rs.h"
|
#include "rs.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
#define NEED_ALLOCA
|
||||||
#define alloca(x) _alloca(x)
|
#define alloca(x) _alloca(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -225,10 +226,17 @@ static int invert_mat(gf *src, int k) {
|
|||||||
int irow, icol, row, col, i, ix;
|
int irow, icol, row, col, i, ix;
|
||||||
|
|
||||||
int error = 1;
|
int error = 1;
|
||||||
|
#ifdef NEED_ALLOCA
|
||||||
int *indxc = alloca(k*sizeof(int));
|
int *indxc = alloca(k*sizeof(int));
|
||||||
int *indxr = alloca(k*sizeof(int));
|
int *indxr = alloca(k*sizeof(int));
|
||||||
int *ipiv = alloca(k*sizeof(int));
|
int *ipiv = alloca(k*sizeof(int));
|
||||||
gf *id_row = alloca(k*sizeof(gf));
|
gf *id_row = alloca(k*sizeof(gf));
|
||||||
|
#else
|
||||||
|
int indxc[k];
|
||||||
|
int indxr[k];
|
||||||
|
int ipiv[k];
|
||||||
|
gf id_row[k];
|
||||||
|
#endif
|
||||||
|
|
||||||
memset(id_row, 0, k*sizeof(gf));
|
memset(id_row, 0, k*sizeof(gf));
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user