buffet
libds
Our great sponsors
buffet | libds | |
---|---|---|
12 | 6 | |
410 | 16 | |
- | - | |
2.5 | 0.0 | |
4 months ago | 15 days ago | |
C | C | |
GNU General Public License v3.0 only | MIT 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.
buffet
-
The case against an alternative to C
Made this C lib for exactly the reasons you mention. I love C but got mad at the constant bounds errors and copying.
-
One String to Rule Them All
Buffet
-
Hacker News top posts: Mar 8, 2022
Buffet – An All-inclusive Buffer for C\ (63 comments)
-
Buffet
(following a discussion from https://github.com/alcover/buffet/commit/eab9648ff19483f57fd...)
> if nobody's looking, we are go
https://github.com/alcover/buffet/blob/dee3eb65f37ca07ea3d27...
And otherwise, when is it freed?
The refcount mechanism looks wrong to me: either the ownership of internal data is shared between instances (it seems it is not the case), either the owner is well defined and does not need a refcount.
It appears that the refcount is used to avoid freeing the owner data if Buffet views are still alive. But using the views after freeing the referenced data is incorrect usage anyway, so it looks like defensive programming, trading a use-after-free for a leak.
libds
-
Common libraries and data structures for C
I may as well throw my hat into the ring: https://github.com/lelanthran/libds
I decided that I wanted to be able to simply drop a single .h file and a single .c file into any project without have to build a `libBlah.so` and link it to every project that needed (for example) a hashmap.
The practical result is that using the hashmap only requires me to copy the header and source files into the calling project.
It does build as a standalone library too, so you can link it if you want.
My primary reason for starting this is that I was pretty unsatisfied with all of the string libraries for C. When all I want to do is concatenate multiple strings together, I don't want to have to convert between `char ` and `struct stringtype ` everywhere.
The string functions are very useful as they all operate on the standard `char *` (nul-terminated) type.
-
Buffet
That would be nice, then I wouldn't have to use non-standard stuff.
I made my own easy-to-incorporate-into-any-project library - https://github.com/lelanthran/libds - just copy the ds_*.h and ds_*.c into a project and you're good to go.
I'm not saying it will work for you, but it works for me.
-
BCHS: OpenBSD, C, httpd and SQLite web stack
> Is there a good string-manipulation C library?
You will have to define "good". My string library[1][2] is "good" for me because:
1. It's compatible with all the usual string functions (doesn't define a new type `string_t` or similar, uses existing `char `).
2. It does what I want: a) Works on multiple strings so repeated operations are easy, and b) Allocates as necessary so that the caller only has to free, and not calculate how much memory is needed beforehand.
The combination of the above means that many common* string operations that I want to do in my programs are both easy to do and easy to visually inspect for correctness in the caller.
Others will say that this is not good, because it still uses and exposes `char *`.
[1] https://github.com/lelanthran/libds/blob/master/src/ds_str.h
[2] Currently the only bug I know of is the quadratic runtime in many of the functions. I intend to fix this at some point.
-
Strings in C... tiring and unsafe. So I just made this lib. Am I doing it right, Reddit ?
As an example of an opaque pointer library, see https://github.com/lelanthran/libds/blob/v1.0.5/src/ds_ll.h - See line 7 for the typedef. - Lines 9, 10, 11 and 67, 68 and 69 for making it callable from C++.
I've done the same thing for my array library - use the first 4 bytes for the length, and everywhere else it behaves like a normal array (https://github.com/lelanthran/libds/blob/v1.0.5/src/ds_array.c)
So, I wrote a new library recently that works produces and consumes strings in the form that C already uses them in (making them more easily usable everywhere) - https://github.com/lelanthran/libds/blob/v1.0.5/src/ds_str.h
What are some alternatives?
asciiMol - Curses based ASCII molecule viewer for terminals.
stb - stb single-file public domain libraries for C/C++
live-bootstrap - Use of a Linux initramfs to fully automate the bootstrapping process
SDS - Simple Dynamic Strings library for C
clib - Package manager for the C programming language.
libderp - C collections. Easy to build, boring algorithms. Dumb is good.
librope - UTF-8 rope library for C
kcgi - minimal CGI and FastCGI library for C/C++
stan - 🕵️ Haskell STatic ANalyser
stricks - Managed C strings library
jumprope-rs