summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-10-12 19:43:09 -0700
committerKaz Kylheku <kaz@kylheku.com>2011-10-12 19:43:09 -0700
commit6e23d00099312495addb7639d7062aab71a9cbfe (patch)
tree1a564dc72c7ddf0e5e4260543fb69989f562cad7 /lib.h
parente79aef01748279dab58ad5f6059d225a086a19ff (diff)
downloadtxr-6e23d00099312495addb7639d7062aab71a9cbfe.tar.gz
txr-6e23d00099312495addb7639d7062aab71a9cbfe.tar.bz2
txr-6e23d00099312495addb7639d7062aab71a9cbfe.zip
Bug #34538
* lib.h (wli): This macro now does the pointer displacement by 1. (auto_str, static_str): #if/#else/#endif gone. These functions just add the type tag. The + 1 logic was incorrect; it should have been + sizeof(wchar_t). But even that was not right because other code expects a wchli_t * to point to the first character, such as the string_out_put_char function.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h10
1 files changed, 1 insertions, 9 deletions
diff --git a/lib.h b/lib.h
index 235ab169..7255e4f1 100644
--- a/lib.h
+++ b/lib.h
@@ -191,7 +191,7 @@ INLINE type_t type(val obj)
typedef struct wli wchli_t;
#if LIT_ALIGN < 4
-#define wli(lit) ((const wchli_t *) L"\0" L ## lit L"\0")
+#define wli(lit) ((const wchli_t *) (L"\0" L ## lit L"\0" + 1))
#define wini(ini) L"\0" L ## ini L"\0"
#define wref(arr) ((arr) + 1)
#else
@@ -202,20 +202,12 @@ typedef struct wli wchli_t;
INLINE val auto_str(const wchli_t *str)
{
-#if LIT_ALIGN < 4
- return (val) (((cnum) str + 1) | TAG_LIT);
-#else
return (val) (((cnum) str) | TAG_LIT);
-#endif
}
INLINE val static_str(const wchli_t *str)
{
-#if LIT_ALIGN < 4
- return (val) (((cnum) str + 1) | TAG_LIT);
-#else
return (val) (((cnum) str) | TAG_LIT);
-#endif
}
INLINE wchar_t *litptr(val obj)