mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
use RITE_LV_NULL_MARK for better readability
The comment didn't say why the length is reserved. Using RITE_LV_NULL_MARK makes things a bit clearer.
This commit is contained in:
+2
-1
@@ -9,6 +9,7 @@
|
||||
#include "mruby.h"
|
||||
#include "mruby/khash.h"
|
||||
#include "mruby/string.h"
|
||||
#include "mruby/dump.h"
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
typedef struct symbol_name {
|
||||
@@ -38,7 +39,7 @@ KHASH_DEFINE (n2s, symbol_name, mrb_sym, TRUE, sym_hash_func, sym_hash_equal)
|
||||
static void
|
||||
sym_validate_len(mrb_state *mrb, size_t len)
|
||||
{
|
||||
if (len > (UINT16_MAX-1)) { /* UINT16_MAX is reverved */
|
||||
if (len >= RITE_LV_NULL_MARK) {
|
||||
mrb_raise(mrb, E_ARGUMENT_ERROR, "symbol length too long");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user