diff options
| -rw-r--r-- | lobject.h | 10 | ||||
| -rw-r--r-- | lstring.h | 2 |
2 files changed, 2 insertions, 10 deletions
| @@ -350,21 +350,13 @@ typedef struct TString { | |||
| 350 | } TString; | 350 | } TString; |
| 351 | 351 | ||
| 352 | 352 | ||
| 353 | /* | ||
| 354 | ** Ensures that address after this type is always fully aligned. | ||
| 355 | */ | ||
| 356 | typedef union UTString { | ||
| 357 | LUAI_MAXALIGN; /* ensures maximum alignment for strings */ | ||
| 358 | TString tsv; | ||
| 359 | } UTString; | ||
| 360 | |||
| 361 | 353 | ||
| 362 | /* | 354 | /* |
| 363 | ** Get the actual string (array of bytes) from a 'TString'. | 355 | ** Get the actual string (array of bytes) from a 'TString'. |
| 364 | ** (Access to 'extra' ensures that value is really a 'TString'.) | 356 | ** (Access to 'extra' ensures that value is really a 'TString'.) |
| 365 | */ | 357 | */ |
| 366 | #define getstr(ts) \ | 358 | #define getstr(ts) \ |
| 367 | check_exp(sizeof((ts)->extra), cast_charp((ts)) + sizeof(UTString)) | 359 | check_exp(sizeof((ts)->extra), cast_charp((ts)) + sizeof(TString)) |
| 368 | 360 | ||
| 369 | 361 | ||
| 370 | /* get the actual string (array of bytes) from a Lua value */ | 362 | /* get the actual string (array of bytes) from a Lua value */ |
| @@ -19,7 +19,7 @@ | |||
| 19 | #define MEMERRMSG "not enough memory" | 19 | #define MEMERRMSG "not enough memory" |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | #define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char)) | 22 | #define sizelstring(l) (sizeof(TString) + ((l) + 1) * sizeof(char)) |
| 23 | 23 | ||
| 24 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ | 24 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ |
| 25 | (sizeof(s)/sizeof(char))-1)) | 25 | (sizeof(s)/sizeof(char))-1)) |
