Skip to content

Commit

Permalink
lua_writestring & co. moved to llimits.h
Browse files Browse the repository at this point in the history
They don't need to be visible by clients of Lua.
  • Loading branch information
roberto-ieru committed Jun 21, 2024
1 parent a08d82e commit e24ce8c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 32 deletions.
6 changes: 0 additions & 6 deletions lauxlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
#include "llimits.h"


#if !defined(MAX_SIZET)
/* maximum value for size_t */
#define MAX_SIZET ((size_t)(~(size_t)0))
#endif


/*
** {======================================================
** Traceback
Expand Down
24 changes: 0 additions & 24 deletions lauxlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,30 +236,6 @@ typedef struct luaL_Stream {

/* }====================================================== */

/*
** {==================================================================
** "Abstraction Layer" for basic report of messages and errors
** ===================================================================
*/

/* print a string */
#if !defined(lua_writestring)
#define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout)
#endif

/* print a newline and flush the output */
#if !defined(lua_writeline)
#define lua_writeline() (lua_writestring("\n", 1), fflush(stdout))
#endif

/* print an error message */
#if !defined(lua_writestringerror)
#define lua_writestringerror(s,p) \
(fprintf(stderr, (s), (p)), fflush(stderr))
#endif

/* }================================================================== */


/*
** {============================================================
Expand Down
25 changes: 25 additions & 0 deletions llimits.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,29 @@ typedef unsigned long l_uint32;
#endif


/*
** {==================================================================
** "Abstraction Layer" for basic report of messages and errors
** ===================================================================
*/

/* print a string */
#if !defined(lua_writestring)
#define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout)
#endif

/* print a newline and flush the output */
#if !defined(lua_writeline)
#define lua_writeline() (lua_writestring("\n", 1), fflush(stdout))
#endif

/* print an error message */
#if !defined(lua_writestringerror)
#define lua_writestringerror(s,p) \
(fprintf(stderr, (s), (p)), fflush(stderr))
#endif

/* }================================================================== */

#endif

2 changes: 0 additions & 2 deletions lstrlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
** Some sizes are better limited to fit in 'int', but must also fit in
** 'size_t'. (We assume that 'lua_Integer' cannot be smaller than 'int'.)
*/
#define MAX_SIZET ((size_t)(~(size_t)0))

#define MAXSIZE \
(sizeof(size_t) < sizeof(int) ? MAX_SIZET : (size_t)(INT_MAX))

Expand Down

0 comments on commit e24ce8c

Please sign in to comment.