[tarantool-patches] Re: [PATCH v5 4/9] lib: introduce json_path_cmp routine

Konstantin Osipov kostja at tarantool.org
Mon Dec 3 20:37:41 MSK 2018


* Vladimir Davydov <vdavydov.dev at gmail.com> [18/11/30 17:01]:
> > + * Compare two JSON paths using Lexer class.
> > + * - @a path must be valid
> > + * - at the case of paths that have same token-sequence prefix,
> > + *   the path having more tokens is assumed to be greater
> > + * - when @b path contains an error, the path "a" is assumed to
> > + *   be greater
> > + */
> > +int
> > +json_path_cmp(const char *a, uint32_t a_len, const char *b, uint32_t b_len);
> > +
> 
> One typically expects cmp(a, b) to be equivalent to -cmp(b, a).
> Can't we make json_path_cmp satisfy this property, for example, by
> requiring both strings to be valid json paths with an assertion?

Why bother?


-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov




More information about the Tarantool-patches mailing list