diff options
author | Mike Pall <mike> | 2020-06-13 00:52:54 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2020-06-15 02:52:00 +0200 |
commit | 8ae5170cdc9c307bd81019b3e014391c9fd00581 (patch) | |
tree | ccf9f17035d0754c1758faee209e9a26b4e03418 /src/lib_string.c | |
parent | 8b55054473452963f24b01efb7c4cc72497c74ec (diff) | |
download | luajit-8ae5170cdc9c307bd81019b3e014391c9fd00581.tar.gz luajit-8ae5170cdc9c307bd81019b3e014391c9fd00581.tar.bz2 luajit-8ae5170cdc9c307bd81019b3e014391c9fd00581.zip |
Improve assertions.
Diffstat (limited to 'src/lib_string.c')
-rw-r--r-- | src/lib_string.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib_string.c b/src/lib_string.c index 6b88ee9b..0d9290bc 100644 --- a/src/lib_string.c +++ b/src/lib_string.c | |||
@@ -136,7 +136,7 @@ LJLIB_CF(string_dump) | |||
136 | /* ------------------------------------------------------------------------ */ | 136 | /* ------------------------------------------------------------------------ */ |
137 | 137 | ||
138 | /* macro to `unsign' a character */ | 138 | /* macro to `unsign' a character */ |
139 | #define uchar(c) ((unsigned char)(c)) | 139 | #define uchar(c) ((unsigned char)(c)) |
140 | 140 | ||
141 | #define CAP_UNFINISHED (-1) | 141 | #define CAP_UNFINISHED (-1) |
142 | #define CAP_POSITION (-2) | 142 | #define CAP_POSITION (-2) |
@@ -645,7 +645,7 @@ static GCstr *string_fmt_tostring(lua_State *L, int arg, int retry) | |||
645 | { | 645 | { |
646 | TValue *o = L->base+arg-1; | 646 | TValue *o = L->base+arg-1; |
647 | cTValue *mo; | 647 | cTValue *mo; |
648 | lua_assert(o < L->top); /* Caller already checks for existence. */ | 648 | lj_assertL(o < L->top, "bad usage"); /* Caller already checks for existence. */ |
649 | if (LJ_LIKELY(tvisstr(o))) | 649 | if (LJ_LIKELY(tvisstr(o))) |
650 | return strV(o); | 650 | return strV(o); |
651 | if (retry != 2 && !tvisnil(mo = lj_meta_lookup(L, o, MM_tostring))) { | 651 | if (retry != 2 && !tvisnil(mo = lj_meta_lookup(L, o, MM_tostring))) { |
@@ -717,7 +717,7 @@ again: | |||
717 | lj_strfmt_putptr(sb, lj_obj_ptr(L->base+arg-1)); | 717 | lj_strfmt_putptr(sb, lj_obj_ptr(L->base+arg-1)); |
718 | break; | 718 | break; |
719 | default: | 719 | default: |
720 | lua_assert(0); | 720 | lj_assertL(0, "bad string format type"); |
721 | break; | 721 | break; |
722 | } | 722 | } |
723 | } | 723 | } |