diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-04-24 15:06:12 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-04-24 15:06:12 -0300 |
| commit | 2caecf1b3efdbee4e08888a04143421589d6143b (patch) | |
| tree | 5eb37237e2440b1fb0b3750e5917d6d6d80a8be7 | |
| parent | f399e6705fab15013ae468049c910577e1a9a5a1 (diff) | |
| download | lua-2caecf1b3efdbee4e08888a04143421589d6143b.tar.gz lua-2caecf1b3efdbee4e08888a04143421589d6143b.tar.bz2 lua-2caecf1b3efdbee4e08888a04143421589d6143b.zip | |
type 'L_Umaxalign' replaced by macro 'LUAI_MAXALIGN', which is also added
to the auxlib buffer
| -rw-r--r-- | lauxlib.c | 6 | ||||
| -rw-r--r-- | lauxlib.h | 7 | ||||
| -rw-r--r-- | llimits.h | 17 | ||||
| -rw-r--r-- | lobject.h | 6 | ||||
| -rw-r--r-- | ltests.c | 4 | ||||
| -rw-r--r-- | luaconf.h | 8 |
6 files changed, 21 insertions, 27 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.288 2016/12/04 20:17:24 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp roberto $ |
| 3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -496,7 +496,7 @@ static void *newbox (lua_State *L, size_t newsize) { | |||
| 496 | ** check whether buffer is using a userdata on the stack as a temporary | 496 | ** check whether buffer is using a userdata on the stack as a temporary |
| 497 | ** buffer | 497 | ** buffer |
| 498 | */ | 498 | */ |
| 499 | #define buffonstack(B) ((B)->b != (B)->initb) | 499 | #define buffonstack(B) ((B)->b != (B)->init.b) |
| 500 | 500 | ||
| 501 | 501 | ||
| 502 | /* | 502 | /* |
| @@ -568,7 +568,7 @@ LUALIB_API void luaL_addvalue (luaL_Buffer *B) { | |||
| 568 | 568 | ||
| 569 | LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { | 569 | LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { |
| 570 | B->L = L; | 570 | B->L = L; |
| 571 | B->b = B->initb; | 571 | B->b = B->init.b; |
| 572 | B->n = 0; | 572 | B->n = 0; |
| 573 | B->size = LUAL_BUFFERSIZE; | 573 | B->size = LUAL_BUFFERSIZE; |
| 574 | } | 574 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.h,v 1.130 2016/12/04 20:17:24 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.131 2016/12/06 14:54:31 roberto Exp roberto $ |
| 3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -150,7 +150,10 @@ typedef struct luaL_Buffer { | |||
| 150 | size_t size; /* buffer size */ | 150 | size_t size; /* buffer size */ |
| 151 | size_t n; /* number of characters in buffer */ | 151 | size_t n; /* number of characters in buffer */ |
| 152 | lua_State *L; | 152 | lua_State *L; |
| 153 | char initb[LUAL_BUFFERSIZE]; /* initial buffer */ | 153 | union { |
| 154 | LUAI_MAXALIGN; /* ensure maximum alignment for buffer */ | ||
| 155 | char b[LUAL_BUFFERSIZE]; /* initial buffer */ | ||
| 156 | } init; | ||
| 154 | } luaL_Buffer; | 157 | } luaL_Buffer; |
| 155 | 158 | ||
| 156 | 159 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llimits.h,v 1.140 2015/10/21 18:40:47 roberto Exp roberto $ | 2 | ** $Id: llimits.h,v 1.141 2015/11/19 19:16:22 roberto Exp roberto $ |
| 3 | ** Limits, basic types, and some other 'installation-dependent' definitions | 3 | ** Limits, basic types, and some other 'installation-dependent' definitions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -60,21 +60,6 @@ typedef unsigned char lu_byte; | |||
| 60 | 60 | ||
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | /* type to ensure maximum alignment */ | ||
| 64 | #if defined(LUAI_USER_ALIGNMENT_T) | ||
| 65 | typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; | ||
| 66 | #else | ||
| 67 | typedef union { | ||
| 68 | lua_Number n; | ||
| 69 | double u; | ||
| 70 | void *s; | ||
| 71 | lua_Integer i; | ||
| 72 | long l; | ||
| 73 | } L_Umaxalign; | ||
| 74 | #endif | ||
| 75 | |||
| 76 | |||
| 77 | |||
| 78 | /* types of 'usual argument conversions' for lua_Number and lua_Integer */ | 63 | /* types of 'usual argument conversions' for lua_Number and lua_Integer */ |
| 79 | typedef LUAI_UACNUMBER l_uacNumber; | 64 | typedef LUAI_UACNUMBER l_uacNumber; |
| 80 | typedef LUAI_UACINT l_uacInt; | 65 | typedef LUAI_UACINT l_uacInt; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 2.117 2016/08/01 19:51:24 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.118 2017/04/11 18:41:09 roberto Exp roberto $ |
| 3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -317,7 +317,7 @@ typedef struct TString { | |||
| 317 | ** Ensures that address after this type is always fully aligned. | 317 | ** Ensures that address after this type is always fully aligned. |
| 318 | */ | 318 | */ |
| 319 | typedef union UTString { | 319 | typedef union UTString { |
| 320 | L_Umaxalign dummy; /* ensures maximum alignment for strings */ | 320 | LUAI_MAXALIGN; /* ensures maximum alignment for strings */ |
| 321 | TString tsv; | 321 | TString tsv; |
| 322 | } UTString; | 322 | } UTString; |
| 323 | 323 | ||
| @@ -357,7 +357,7 @@ typedef struct Udata { | |||
| 357 | ** Ensures that address after this type is always fully aligned. | 357 | ** Ensures that address after this type is always fully aligned. |
| 358 | */ | 358 | */ |
| 359 | typedef union UUdata { | 359 | typedef union UUdata { |
| 360 | L_Umaxalign dummy; /* ensures maximum alignment for 'local' udata */ | 360 | LUAI_MAXALIGN; /* ensures maximum alignment for 'local' udata */ |
| 361 | Udata uv; | 361 | Udata uv; |
| 362 | } UUdata; | 362 | } UUdata; |
| 363 | 363 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 2.214 2017/04/19 18:46:47 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.215 2017/04/24 16:59:26 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -81,7 +81,7 @@ static int tpanic (lua_State *L) { | |||
| 81 | #define MARK 0x55 /* 01010101 (a nice pattern) */ | 81 | #define MARK 0x55 /* 01010101 (a nice pattern) */ |
| 82 | 82 | ||
| 83 | typedef union Header { | 83 | typedef union Header { |
| 84 | L_Umaxalign a; /* ensures maximum alignment for Header */ | 84 | LUAI_MAXALIGN; |
| 85 | struct { | 85 | struct { |
| 86 | size_t size; | 86 | size_t size; |
| 87 | int type; | 87 | int type; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: luaconf.h,v 1.259 2016/12/22 13:08:50 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.260 2017/04/19 16:34:35 roberto Exp roberto $ |
| 3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -761,6 +761,12 @@ | |||
| 761 | #define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer))) | 761 | #define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer))) |
| 762 | #endif | 762 | #endif |
| 763 | 763 | ||
| 764 | /* | ||
| 765 | @@ LUAI_MAXALIGN defines fields that, when used in a union, ensure | ||
| 766 | ** "maximum" alignment for the other items in that union. | ||
| 767 | */ | ||
| 768 | #define LUAI_MAXALIGN lua_Number n; double u; void *s; lua_Integer i; long l | ||
| 769 | |||
| 764 | /* }================================================================== */ | 770 | /* }================================================================== */ |
| 765 | 771 | ||
| 766 | 772 | ||
