[tarantool-patches] Re: [PATCH v2 2/3] lua-yaml: fix boolean/null representation in yaml
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Fri Jan 25 00:32:42 MSK 2019
> static inline int
> yaml_parse_null(const char *str, size_t len, bool *is_null);
>
>> + if (len == 1 && str[0] == '~')
>> + return YAML_NULL;
>> + if (len == 4 && (strcmp(str, "null") == 0 || strcmp(str, "Null") == 0 ||
>
> 5. Hmm. Length of "null" and "Null" is 3, not 4. As I understand,
> len does not count terminating zero. And I can prove it - load_scalar()
> in case if !strcmp(tag, "str") does lua_pushlstring(loader->L, str, length),
> so length == strlen(str).
>
> Even if I am mistaken about it, why two lines above you consider len
> of "~" as 1, not 2?
Sorry, my fault. I was too tired. Of course, strlen('null') == 4. I
counted 'll' for one. But please, still consider my point about
strcmp -> memcmp.
>
>> + strcmp(str, "NULL") == 0))
>> + return YAML_NULL;
>> + return YAML_NO_MATCH;
>> +}
>> +
More information about the Tarantool-patches
mailing list