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:
cremno
2014-08-29 15:50:31 +02:00
parent 0e28f4b973
commit c219c2a15e
+2 -1
View File
@@ -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");
}
}