git pre-commit clang-format hook

Most of my company projects have a requirement that we run clang-format on all commits to keep a consistent style. Unfortunately, I’m as forgetful as the fabled goldfish (which actually isn’t that forgetful it turns out) so I often forget to run clang-format. After the umpteenth time of forgetting and suffering some quite deepseated rage from my colleagues, I decided to investigate a way to automate the process. It turns out git has a really cool feature introduced in 1.

Full Simplified JSON support in json.h

In a previous post (Partial) Simplified JSON support in json.h I covered the partially added simplified JSON support I had added to json.h. One of the things I covered was my unwillingness to implement two of the features of simplified JSON, commas being optional and replacing : with =. I argued that both of these were unnecessary and stupid additions to the library. I was wrong. The immediate feedback I received detailed good reasons why these were useful, but more importantly - why did I half-arse implementing a feature that was requested by a user!

Introducing utest.h!

So as you may (or may not) already know - I’ve written two tiny C libraries - utf8.h and json.h. One of the questions that most plagued me when writing these libraries was ‘How should I write the tests for them?’ I could put them in a separate repository, I could put them within the repository, should I create a new testing framework every time? It would be useful to be able to have test cases spread across multiple files… and the thoughts went on and on.

(Partial) Simplified JSON support in json.h

With the help of the rather awesome @ocornut - I’ve managed to get a variant of simplified JSON support into json.h! So first off - what is simplified JSON? Taken straight from the Bitsquid blog; Assume an object definition at the root level (no need to surround entire file with { }) Commas are optional Quotes around object keys are optional if the keys are valid identifiers Replace : with = Of the four points above, I’m going to argue that only 1.

json.h performance (update!)

So previously I tested my json.h library’s performance against other JSON libraries in the wild (json.h performance (vs other C/C++ JSON parsers). My JSON parser wasn’t performing as I’d expect in the tests, so I’ve spent a good amount of time looking at why. Before we begin, you can find the sources to my public domain, one .c/one .h file json.h library here - https://github.com/sheredom/json.h A little information on my initial approach.