redefine 'l_sprintf' to test correctness of buffer sizes given
to 'snprintf'
This commit is contained in:
11
ltests.h
11
ltests.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: ltests.h,v 2.46 2014/12/19 13:33:06 roberto Exp roberto $
|
** $Id: ltests.h,v 2.47 2014/12/26 14:44:44 roberto Exp roberto $
|
||||||
** Internal Header for Debugging of the Lua Implementation
|
** Internal Header for Debugging of the Lua Implementation
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -37,6 +37,15 @@
|
|||||||
#define UNUSED(x) (x=0, (void)(x))
|
#define UNUSED(x) (x=0, (void)(x))
|
||||||
|
|
||||||
|
|
||||||
|
/* test for sizes in 'l_sprintf' (make sure whole buffer is available) */
|
||||||
|
#undef l_sprintf
|
||||||
|
#if !defined(LUA_USE_C89)
|
||||||
|
#define l_sprintf(s,sz,f,i) (memset(s,0xAB,sz), snprintf(s,sz,f,i))
|
||||||
|
#else
|
||||||
|
#define l_sprintf(s,sz,f,i) (memset(s,0xAB,sz), sprintf(s,f,i))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* memory-allocator control variables */
|
/* memory-allocator control variables */
|
||||||
typedef struct Memcontrol {
|
typedef struct Memcontrol {
|
||||||
unsigned long numblocks;
|
unsigned long numblocks;
|
||||||
|
|||||||
Reference in New Issue
Block a user