Pull requests

#6 Declined
Repository
MacGritsch/jsmn-patch MacGritsch
Branch
default
Repository
zserge/jsmn jsmn
Branch
default

Added possibility to specify the lenght of the input buffer (if not null-terminated) and added "extern C" to use it with CPP

Author
  1. Gabriel Gritsch
Reviewers
Description
  • Added possibility to specify the lenght of the input buffer (if not null-terminated).
  • Added "extern C" to use it with CPP.
  • Learn about pull requests

Comments (5)

  1. Serge Zaitsev repo owner

    Thanks for submitting this! The idea is good, I like it. But could you please edit the jsmn_test.c to use new API, too? Also, is picking "int" vs "size_t" for string length reasoned somehow?

  2. Gabriel Gritsch author

    Hi Serge,

    Changed code in pull-request to use a new function named "jsmn_parseV2" to be compatible with old user code. not sure if this name is ok, but it can be changed ;-)

    thank you and best regards

    GG

  3. Serge Zaitsev repo owner

    Hi, Garbiel!

    I don't want to look like suffering from a "not-invented-here" syndrome, but I have to discard this pull request because I fixed it in my recent commit :( The main reason is that comparison of position and maximum length should be done in all functions (not just jsmn_parse), otherwise when string is partially read and is not null-terminated, and the last token is a primitive or a string - the parser would not work. With my commit it seems to be working according to the tests.

    Still, I appreciate your efforts and big thanks for the help! I would say you encouraged me to finally fix it :)

    Regards, Serge

  4. Serge Zaitsev repo owner

    Hi, Garbiel!

    I don't want to look like suffering from a "not-invented-here" syndrome, but I have to discard this pull request because I fixed it in my recent commit :( The main reason is that comparison of position and maximum length should be done in all functions (not just jsmn_parse), otherwise when string is partially read and is not null-terminated, and the last token is a primitive or a string - the parser would not work. With my commit it seems to be working according to the tests.

    Still, I appreciate your efforts and big thanks for the help! I would say you encouraged me to finally fix it :)

    Regards, Serge