ccan
sc
ccan | sc | |
---|---|---|
13 | 17 | |
1,046 | 2,168 | |
- | - | |
3.4 | 6.3 | |
2 months ago | about 1 month ago | |
C | C | |
- | BSD 3-clause "New" or "Revised" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
ccan
-
Memory leak proof every C program
Hilarious!
But I remember the first time I saw such a program which never freed anything: jitterbug, the simple bug tracker which ran as a CGI script.
It indeed allows a very simple style!
Meanwhile, use ccan/tal (https://github.com/rustyrussell/ccan/blob/master/ccan/tal/_i...) and be happy :)
-
Popular Data Structure Libraries in C ?
There's CCAN, maintained by kernel hacker Rusty Russell: http://ccodearchive.net/
-
My review of the C standard library in practice
Please note that the above link has been claimed by squatters and isn’t the right link for CCAN anymore! The maintainer suggests [1] just using the GitHub repo [2] instead.
[1] https://lists.ozlabs.org/pipermail/ccan/2022-September/00141...
[2] https://github.com/rustyrussell/ccan/
-
[ROAST MY CODE] Implementing generic vector in C
This is a great learning exercise but not very useful because using void* creates practical problems that the compiler cant help you with. IMHO, for a nice vector in C look at https://github.com/rustyrussell/ccan/blob/master/ccan/darray/darray.h
- Common libraries and data structures for C
-
Toward a better list iterator for the Linux kernel
For more advanced intrusive lists in C, I've found that ccan's tlist2 (https://github.com/rustyrussell/ccan/blob/master/ccan/tlist2...) provides a decent model here.
Compared to the linux kernel's intrusive lists, it also tracks the offset of the list_node within the structure contained by the list, which eliminates another class of problems. It does still have the "using the iterator after the for loop is over" issue discussed in this article, but it also already tracks the types as Linus proposed doing in the article to resolve the issue.
-
Good C Source Code
ccan library https://github.com/rustyrussell/ccan I think it is used also in the linux kernel(?)
-
What are your favorite C resources? They can be either for learning or reference.
ccan (analagous to cpan, but for C rather than Perl.)
-
Dynamic link list
You could use a discriminated union in your list node. You could use a void pointer in your list node, allocate space as needed and memcpy the date into this space, or don't allocate and store pointers to the original data. You could use an intrusive list, like this.
-
The Byte Order Fiasco
The fallacy in the article is that anyone should code these functions. There's plenty of public domain libraries that do this correctly.
https://github.com/rustyrussell/ccan/blob/master/ccan/endian...
sc
- A simple hash table in C
- Advice for bigger c projects?
- sc - Common libraries and data structures for C
-
Hacker News top posts: May 17, 2022
Common libraries and data structures for C\ (107 comments)
-
Common libraries and data structures for C
Can someone tell me what is this line from sc_signal.c:247 in sc/signal/
If the way it is used requires the user to break the abstraction/encapsulation and manually buffer some fields in order not to break the data structure and leak memory, I would call that a bug.
There is one use of sc_array_clear() in the test code [1] which really makes it look as if it is being used in a way that I think (again, I haven't single-stepped this code, only read it) leaks memory.
I agree on the pain of everything being macros, it's more pain than it's worth I think and will likely lead to code duplication (and more pain in debugging, probably).
I would even go so far as to think that this kind of single-file design, where each file is independent of the others, makes it harder and more annoying to implement more complicated data structures.
[1]: https://github.com/tezc/sc/blob/master/array/array_test.c#L3...
-
Uthash – C macros for hash tables and more
https://github.com/tezc/sc/tree/master/map
For those who are interested in faster hashmaps, I tried bunch of hashmaps and this one performs better than others. This is for C. Maybe C++ has better hashmaps.
What are some alternatives?
SQLite - Official Git mirror of the SQLite source tree
frr - The FRRouting Protocol Suite
STC - A modern, user friendly, generic, type-safe and fast C99 container library: String, Vector, Sorted and Unordered Map and Set, Deque, Forward List, Smart Pointers, Bitset and Random numbers.
wazero - wazero: the zero dependency WebAssembly runtime for Go developers
stage0 - A set of minimal dependency bootstrap binaries
chibicc - A small C compiler
stb - stb single-file public domain libraries for C/C++
limine - Modern, advanced, portable, multiprotocol bootloader.
pottery - Pottery - A container and algorithm template library in C
gcc