mirror of https://github.com/rusefi/lua.git
avoids warning with 'clang' + comment explaining macro
This commit is contained in:
parent
52f9ccd298
commit
f993771c70
13
lmem.h
13
lmem.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lmem.h,v 1.37 2011/11/30 12:42:49 roberto Exp roberto $
|
** $Id: lmem.h,v 1.38 2011/12/02 13:26:54 roberto Exp $
|
||||||
** Interface to Memory Manager
|
** Interface to Memory Manager
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -14,9 +14,16 @@
|
||||||
#include "lua.h"
|
#include "lua.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This macro avoids the runtime division MAX_SIZET/(e), as 'e' is
|
||||||
|
** always constant.
|
||||||
|
** The macro is somewhat complex to avoid warnings:
|
||||||
|
** +1 avoids warnings of "comparsion has constant result";
|
||||||
|
** cast to 'void' avoids warnings of "value unused".
|
||||||
|
*/
|
||||||
#define luaM_reallocv(L,b,on,n,e) \
|
#define luaM_reallocv(L,b,on,n,e) \
|
||||||
((cast(size_t, (n)+1) > MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \
|
(cast(void, \
|
||||||
(luaM_toobig(L), (void *)0) : \
|
(cast(size_t, (n)+1) > MAX_SIZET/(e)) ? (luaM_toobig(L), 0) : 0), \
|
||||||
luaM_realloc_(L, (b), (on)*(e), (n)*(e)))
|
luaM_realloc_(L, (b), (on)*(e), (n)*(e)))
|
||||||
|
|
||||||
#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0)
|
#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0)
|
||||||
|
|
Loading…
Reference in New Issue