Hacker GitHub

← All repos

Tarsnap/libcperciva

View on GitHub ↗ ★ 116 C

BSD-licensed C99/POSIX library code shared between tarsnap, scrypt, kivaloo, spiped, and bsdiff.

12 mentions on Hacker News by 5 people: 1 story, 11 comments · first 2016-01-18 · latest 2025-05-13

Mentions per year 12 mentions · busiest year 2016 (4)
20082026
  1. With a few more clever tricks... I did this with my PARSENUM macro ( https://github.com/Tarsnap/libcperciva/blob/master/util/pars... ) to parse strings into floating-point, unsigned integer, or signed integer types (and check bounds) using…
  2. https://github.com/Tarsnap/libcperciva/blob/master/util/geto... https://github.com/Tarsnap/libcperciva/blob/master/util/geto... BSD licensed, of course.
  3. See also "elastic arrays": https://github.com/Tarsnap/libcperciva/blob/master/datastruc... https://github.com/Tarsnap/libcperciva/blob/master/datastruc... ELASTICARRAY_DECL(STR, str, char); creates a type "STR" and the functions str_init,…
    comment by cperciva · 2021-04-09 · in Type-safe generic data structures in C
  4. …the topic of compilers being hard: In my repositories I'm carrying around a 5 year old workaround ( https://github.com/Tarsnap/libcperciva/commit/92e666e59503de... ) for a 6 year old bug ( https://bugs.llvm.org/show_bug.cgi?id=21183 ) in…
    comment by cperciva · 2021-01-21 · in Compilers are hard
  5. realloc(foo, 0) was changed to no longer free in C99. A rant on the subject: https://github.com/Tarsnap/libcperciva/commit/cabe5fca76f6c3...
  6. …the common cases of parsing human-readable values while appropriately checking for overflow ( https://github.com/Tarsnap/libcperciva/blob/master/util/pars... ).
    comment by cperciva · 2020-01-30 · in Let's Destroy C
  7. Here's an example: https://github.com/Tarsnap/libcperciva/blob/master/datastruc... As long as you invoke use it properly, e.g. ELASTICARRAY_DECL(PTRLIST, ptrlist, void *); there's no way it will create non-compliant code.
    comment by cperciva · 2019-07-06 · in So you think you know C? (2016)
  8. …easier, not harder, to understand . A few examples from my own code: 1. My "elastic arrays" ( https://github.com/Tarsnap/libcperciva/blob/master/datastruc... and .c) allow me to write ELASTICARRAY_DECL(STRLIST, strlist, const char *); and…
    comment by cperciva · 2017-03-16 · in Principles for C programming
  9. …computed goto in order to work around a bug in LLVM's handling of sigsetjmp/siglongjmp: https://github.com/Tarsnap/libcperciva/commit/92e666e59503de... 4. Many years ago, I added a spurious 'volatile' into some Tarsnap code in order to…
    comment by cperciva · 2016-09-12 · in Ask HN: Strange bug workarounds?
  10. > Wrong! https://github.com/Tarsnap/libcperciva/commit/cabe5fca76f6c3... . No, of course not "Wrong!" If a user of a library wants to supply their own allocator, they must provide a version of realloc that acts as free() for the (p,0)…
  11. …to rethink everything from the bottom up. when all you need is just a pointer to realloc Wrong! https://github.com/Tarsnap/libcperciva/commit/cabe5fca76f6c3...