Web lists-archives.com

Re: [PATCH v8 1/2] json_writer: new routines to create data in JSON format






On 6/8/2018 4:32 PM, René Scharfe wrote:
Am 07.06.2018 um 16:12 schrieb git@xxxxxxxxxxxxxxxxx:
   Makefile                    |   2 +
   json-writer.c               | 419 ++++++++++++++++++++++++++++++++
   json-writer.h               | 113 +++++++++
   t/helper/test-json-writer.c | 572 ++++++++++++++++++++++++++++++++++++++++++++
   t/t0019-json-writer.sh      | 236 ++++++++++++++++++
   5 files changed, 1342 insertions(+)
   create mode 100644 json-writer.c
   create mode 100644 json-writer.h
   create mode 100644 t/helper/test-json-writer.c
   create mode 100755 t/t0019-json-writer.sh

$ git grep 'static inline' '*json*'
json-writer.c:static inline void indent_pretty(struct json_writer *jw)
json-writer.c:static inline void begin(struct json_writer *jw, char ch_open, int pretty)
json-writer.c:static inline void assert_in_object(const struct json_writer *jw, const char *key)
json-writer.c:static inline void assert_in_array(const struct json_writer *jw)
json-writer.c:static inline void maybe_add_comma(struct json_writer *jw)
json-writer.c:static inline void fmt_double(struct json_writer *jw, int precision,
json-writer.c:static inline void object_common(struct json_writer *jw, const char *key)
json-writer.c:static inline void array_common(struct json_writer *jw)
json-writer.c:static inline void assert_is_terminated(const struct json_writer *jw)
t/helper/test-json-writer.c:static inline int scripted(int argc, const char **argv)
t/helper/test-json-writer.c:static inline int my_usage(void)

Do you need all those inline keywords?  I'd rather leave the decision
about inlining to the compiler and (via optimization flags) the user
as much as possible.  Not a biggie, but the high frequency of that
word made me blink..

René


I was just trying to match the patterns I found elsewhere in the code.

    $ grep "static inline" *.c builtin/*.c | wc -l
    111

But yeah, it's no big deal.  I can remove them.

Jeff