diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-06-21 12:29:08 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-06-21 12:29:08 -0300 |
| commit | e24ce8c2b322226bbc211e57f301c265a2622c4b (patch) | |
| tree | 875afb43726cadefdf6b1ea90ed8e8fb10db1a44 | |
| parent | a08d82eb132bfd9db5b91e0d5ebcb81d7b26dcd0 (diff) | |
| download | lua-e24ce8c2b322226bbc211e57f301c265a2622c4b.tar.gz lua-e24ce8c2b322226bbc211e57f301c265a2622c4b.tar.bz2 lua-e24ce8c2b322226bbc211e57f301c265a2622c4b.zip | |
lua_writestring & co. moved to llimits.h
They don't need to be visible by clients of Lua.
| -rw-r--r-- | lauxlib.c | 6 | ||||
| -rw-r--r-- | lauxlib.h | 24 | ||||
| -rw-r--r-- | llimits.h | 25 | ||||
| -rw-r--r-- | lstrlib.c | 2 |
4 files changed, 25 insertions, 32 deletions
| @@ -28,12 +28,6 @@ | |||
| 28 | #include "llimits.h" | 28 | #include "llimits.h" |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | #if !defined(MAX_SIZET) | ||
| 32 | /* maximum value for size_t */ | ||
| 33 | #define MAX_SIZET ((size_t)(~(size_t)0)) | ||
| 34 | #endif | ||
| 35 | |||
| 36 | |||
| 37 | /* | 31 | /* |
| 38 | ** {====================================================== | 32 | ** {====================================================== |
| 39 | ** Traceback | 33 | ** Traceback |
| @@ -236,30 +236,6 @@ typedef struct luaL_Stream { | |||
| 236 | 236 | ||
| 237 | /* }====================================================== */ | 237 | /* }====================================================== */ |
| 238 | 238 | ||
| 239 | /* | ||
| 240 | ** {================================================================== | ||
| 241 | ** "Abstraction Layer" for basic report of messages and errors | ||
| 242 | ** =================================================================== | ||
| 243 | */ | ||
| 244 | |||
| 245 | /* print a string */ | ||
| 246 | #if !defined(lua_writestring) | ||
| 247 | #define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) | ||
| 248 | #endif | ||
| 249 | |||
| 250 | /* print a newline and flush the output */ | ||
| 251 | #if !defined(lua_writeline) | ||
| 252 | #define lua_writeline() (lua_writestring("\n", 1), fflush(stdout)) | ||
| 253 | #endif | ||
| 254 | |||
| 255 | /* print an error message */ | ||
| 256 | #if !defined(lua_writestringerror) | ||
| 257 | #define lua_writestringerror(s,p) \ | ||
| 258 | (fprintf(stderr, (s), (p)), fflush(stderr)) | ||
| 259 | #endif | ||
| 260 | |||
| 261 | /* }================================================================== */ | ||
| 262 | |||
| 263 | 239 | ||
| 264 | /* | 240 | /* |
| 265 | ** {============================================================ | 241 | ** {============================================================ |
| @@ -244,4 +244,29 @@ typedef unsigned long l_uint32; | |||
| 244 | #endif | 244 | #endif |
| 245 | 245 | ||
| 246 | 246 | ||
| 247 | /* | ||
| 248 | ** {================================================================== | ||
| 249 | ** "Abstraction Layer" for basic report of messages and errors | ||
| 250 | ** =================================================================== | ||
| 251 | */ | ||
| 252 | |||
| 253 | /* print a string */ | ||
| 254 | #if !defined(lua_writestring) | ||
| 255 | #define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) | ||
| 247 | #endif | 256 | #endif |
| 257 | |||
| 258 | /* print a newline and flush the output */ | ||
| 259 | #if !defined(lua_writeline) | ||
| 260 | #define lua_writeline() (lua_writestring("\n", 1), fflush(stdout)) | ||
| 261 | #endif | ||
| 262 | |||
| 263 | /* print an error message */ | ||
| 264 | #if !defined(lua_writestringerror) | ||
| 265 | #define lua_writestringerror(s,p) \ | ||
| 266 | (fprintf(stderr, (s), (p)), fflush(stderr)) | ||
| 267 | #endif | ||
| 268 | |||
| 269 | /* }================================================================== */ | ||
| 270 | |||
| 271 | #endif | ||
| 272 | |||
| @@ -41,8 +41,6 @@ | |||
| 41 | ** Some sizes are better limited to fit in 'int', but must also fit in | 41 | ** Some sizes are better limited to fit in 'int', but must also fit in |
| 42 | ** 'size_t'. (We assume that 'lua_Integer' cannot be smaller than 'int'.) | 42 | ** 'size_t'. (We assume that 'lua_Integer' cannot be smaller than 'int'.) |
| 43 | */ | 43 | */ |
| 44 | #define MAX_SIZET ((size_t)(~(size_t)0)) | ||
| 45 | |||
| 46 | #define MAXSIZE \ | 44 | #define MAXSIZE \ |
| 47 | (sizeof(size_t) < sizeof(int) ? MAX_SIZET : (size_t)(INT_MAX)) | 45 | (sizeof(size_t) < sizeof(int) ? MAX_SIZET : (size_t)(INT_MAX)) |
| 48 | 46 | ||
