https://github.com/antirez/redis/tree/unstable/src
I don't personally use the product, but I find the source well written and always share it as an example of nicely done C code.
Here is some nice Erlang code I like -- network packet parsing:
https://github.com/msantos/pkt/tree/master/src
Notice how concise this is:
codec(
<<4:4, HL:4, ToS:8, Len:16,
Id:16, 0:1, DF:1, MF:1, %% RFC791 states it's a MUST
Off:13, TTL:8, P:8, Sum:16,
SA1:8, SA2:8, SA3:8, SA4:8,
DA1:8, DA2:8, DA3:8, DA4:8,
Rest/binary>>
) when HL >= 5 -> ...
This is due to the beauty of binary pattern matching. You could kind of do it in C by casting to a struct but notice here it is also calculating header length (HL) as part of the match operation. So it can do a bit more than just casting a binary blob to a struct.Another thing here is that it is also big endian by default so there is not need for htons(), htonl() and such functions sprinkled throughout the code.