• source navigation  • diff markup  • identifier search  • freetext search  • 


  1 In general:
  2 For minor changes to a function, copy the existing formatting.
  3 When changing the style, commit that separately from other changes.
  4 For new code and major changes to a function, switch to the official json-c style.
  6 Official json-c style:
  8 Aim for readability, not strict conformance to fixed style rules.
  9 Formatting is tab based; previous attempts at proper alignment with
 10 spaces for continuation lines have been abandoned in favor of the
 11 convenience of using clang-format.
 12 Refer to the .clang-format file for details, and run the tool before commit:
 14     clang-format -i somefile.c foo.h
 16 For sections of code that would be significantly negatively impacted, surround
 17 them with magic comments to disable formatting:
 19     /* clang-format off */
 20     ...code...
 21     /* clang-format on */
 24 Naming:
 25 Words within function and variable names are separated with underscores.  Avoid camel case.
 26 Prefer longer, more descriptive names, but not excessively so.  No single letter variable names.
 28 Other:
 29 Variables should be defined for the smallest scope needed.
 30 Functions should be defined static when possible.
 31 When possible, avoid exposing internals in the public API.

This page was automatically generated by LXR 0.3.1.  •  OpenWrt