From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@freelists.org, Alexander Turenko <alexander.turenko@tarantool.org> Subject: [tarantool-patches] Re: [PATCH v2 2/3] lua-yaml: fix boolean/null representation in yaml Date: Fri, 25 Jan 2019 00:32:42 +0300 [thread overview] Message-ID: <565ea7fe-051d-b6c3-f52b-0f976fe1e5e2@tarantool.org> (raw) In-Reply-To: <3da6fc29-991d-e475-0777-49eacb764b94@tarantool.org> > 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; >> +} >> +
next prev parent reply other threads:[~2019-01-24 21:32 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-01-22 2:12 [tarantool-patches] [PATCH v2 0/3] lua-yaml null/boolean fixes Alexander Turenko 2019-01-22 2:12 ` [tarantool-patches] [PATCH v2 1/3] lua-yaml: verify arguments count Alexander Turenko 2019-01-24 21:26 ` [tarantool-patches] " Vladislav Shpilevoy 2019-02-05 3:29 ` Alexander Turenko 2019-02-05 19:36 ` Vladislav Shpilevoy 2019-02-11 13:32 ` Alexander Turenko 2019-02-15 21:28 ` Vladislav Shpilevoy 2019-01-22 2:12 ` [tarantool-patches] [PATCH v2 2/3] lua-yaml: fix boolean/null representation in yaml Alexander Turenko 2019-01-24 21:26 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-24 21:32 ` Vladislav Shpilevoy [this message] 2019-02-05 3:29 ` Alexander Turenko 2019-02-05 19:36 ` Vladislav Shpilevoy 2019-02-15 21:06 ` Vladislav Shpilevoy 2019-02-15 21:23 ` Alexander Turenko 2019-02-18 18:55 ` Alexander Turenko 2019-02-22 15:14 ` Vladislav Shpilevoy 2019-01-22 2:12 ` [tarantool-patches] [PATCH v2 3/3] lua-yaml: treat an empty document/value as null Alexander Turenko 2019-01-24 21:26 ` [tarantool-patches] " Vladislav Shpilevoy 2019-02-05 3:30 ` Alexander Turenko 2019-01-24 21:26 ` [tarantool-patches] Re: [PATCH v2 0/3] lua-yaml null/boolean fixes Vladislav Shpilevoy 2019-02-25 11:27 ` Kirill Yukhin 2019-03-05 16:40 ` Alexander Turenko 2019-03-06 7:21 ` Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=565ea7fe-051d-b6c3-f52b-0f976fe1e5e2@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v2 2/3] lua-yaml: fix boolean/null representation in yaml' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox