summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-03-13 14:14:40 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-03-13 14:14:40 -0300
commitc5feac2b5edf86aa9bdc4b8acd5380f2fe9e197f (patch)
treea1e8a11973681bc207060809a9cb7119abdc22c1
parentdfebe439db76b5c9fd9b4e3877857e2449c8ad87 (diff)
downloadlua-github-c5feac2b5edf86aa9bdc4b8acd5380f2fe9e197f.tar.gz
Strings inside Lua are not fully aligned
Removed code to ensure that strings inside Lua (as returned by 'lua_tolstring') always start in fully aligned addresses. Since version 5.3 the documentation does not ensure that.
-rw-r--r--lobject.h10
-rw-r--r--lstring.h2
2 files changed, 2 insertions, 10 deletions
diff --git a/lobject.h b/lobject.h
index df31a1a0..53e67932 100644
--- a/lobject.h
+++ b/lobject.h
@@ -350,21 +350,13 @@ typedef struct TString {
} TString;
-/*
-** Ensures that address after this type is always fully aligned.
-*/
-typedef union UTString {
- LUAI_MAXALIGN; /* ensures maximum alignment for strings */
- TString tsv;
-} UTString;
-
/*
** Get the actual string (array of bytes) from a 'TString'.
** (Access to 'extra' ensures that value is really a 'TString'.)
*/
#define getstr(ts) \
- check_exp(sizeof((ts)->extra), cast_charp((ts)) + sizeof(UTString))
+ check_exp(sizeof((ts)->extra), cast_charp((ts)) + sizeof(TString))
/* get the actual string (array of bytes) from a Lua value */
diff --git a/lstring.h b/lstring.h
index e7e4aedc..b2550218 100644
--- a/lstring.h
+++ b/lstring.h
@@ -19,7 +19,7 @@
#define MEMERRMSG "not enough memory"
-#define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char))
+#define sizelstring(l) (sizeof(TString) + ((l) + 1) * sizeof(char))
#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
(sizeof(s)/sizeof(char))-1))