[Tarantool-patches] [PATCH 1/2] Allow leading and trailing whitespaces in FromString

Chris Sosnin k.sosnin at tarantool.org
Thu Jun 11 23:14:08 MSK 2020


Hi! Thank you for the review!

> On 11 Jun 2020, at 20:06, Vladislav Shpilevoy <v.shpilevoy at tarantool.org> wrote:
> 
> Hi! Thanks for the patch!
> 
> I am afraid this may be a dead end. You didn't check for tabs, new lines,
> \r, and whatever else can be treated as a whitespace. Moreover, for some other
> code it may be necessary not to skip whitespaces. Why can't you trim whitespace
> symbols in SQL code? sql_atoi64(), for example, trims them, before calling
> strtoll()/strtoull().

I made this change here to unify the behavior, but perhaps this makes sense only in SQL?
In this case I can make a wrapper similar to sql_atoi64() you mentioned. And if I understand
correctly, I should use isspace instead of char comparison.

> 
> To trim right spaces you could make this function return a position where
> did it stop, so as to ensure that all the rest is whitespaces, in SQL code.
> That also would be consistent with strtoll()/strtoull().

I like this idea, will work on it in v2.


More information about the Tarantool-patches mailing list