News for hackers. Stuff that matters.
Re:Banned C standard library functions in Git source code by vmsp on Sunday August 25, 2019 @11:23AM (#20793463)
Salvatore Sanfilippo, from Redis fame, has a nice one https://github.com/antirez/sds.
Re:Banned C standard library functions in Git source code by chucksmash on Sunday August 25, 2019 @03:43PM (#20795041)
Thanks for linking this, it's always good to see how very strong engineers solve problems. Never in a million years would this approach have occurred to me. For the interested, the README in the linked repo is done well and clearly explains the approach itself as well as pros and cons. This also reminded me that I've been meaning to watch antirez' "Writing System Software"[0] videos on YouTube for quite a while now, so thanks for that too.

[0]: https://www.youtube.com/playlist?list=PLrEMgOSrS_3fghr8ez63x...

Re:Banned C standard library functions in Git source code by megous on Sunday August 25, 2019 @12:33PM (#20793862)
I'd rather make it explicit that returned/passed value is something other than a regular zero terminated string. Otherwise you can easilly make a mess, if you pass zero terminated string to a function that expects some special bytes in the memory before the pointer.
Re:Banned C standard library functions in Git source code by doboyy on Monday August 26, 2019 @12:13AM (#20797416)
I do this, but I like to just return the actual struct and also avoid typedefing pointer semantics. Can double as a dynamic array too. It's true. We all have string libraries...
Re:Banned C standard library functions in Git source code by zsrxx on Sunday August 25, 2019 @01:28PM (#20794203)
I haven't looked much so I can't comment on the quality of the library but that hairdo is glorious. Props to Salvatore!