🔧📚 Utility library for C 📝💻
The "llib" library is a collection of standalone modules created for the purpose of reducing the need to rewrite similar code and providing alternative implementations of the standard library. This project was developed for fun and as a learning experience and also as a little challenge.
The library is composed by a series of sub-modules for better code structure and most of them are standalone, so you can just use the module you need.
Every module header is fully commented and can be used as a reference.
Inspired by https://github.com/barrust/c-utils and https://github.com/goToMain/c-utils/.
Note: If you want need the premake5 project, you can find it here
To use the "llib" library, you have two alternatives:
- simply clone the repository and include the necessary header files in your project;
- use single modules by downloading their .h file in the include/llib directory and .c file in the src/llib directory.
- compile llib as a static library and include the .a file in your project.
Make sure to link the library (or the modules) during compilation and update your include path.
- memory - memory-related stuff (safe allocation, copy, swap)
- utils - utility functions (wait, safe fopen)
- string - string struct and related functions (create, delete, copy, compare, concat, input, etc.)
- io - io utilities (i.e. buffer cleaning)
- algorithms - various algorithms (searching, sorting, shuffling)
- list - doubly linked list struct and related basic functions (push, pop, search, remove)
- darray - dynamic-array struct and related functions (push, pop, resize)
You can find examples in the examples directory and compile them using make examples
.
Contains memory related stuff, like safe allocation, swap and copy functions.
Contains utility functions, like wait, safe fopen
Contains string struct and related functions, like create, delete, copy, compare, concat, input, etc. Also contains utility functions for normal char arrays. Note: this module isn't standalone. You will also need memory and io to use it.
Contains io utility functions, like input with buffer cleaning.
Contains implementations of several useful algorithms for arrays, including:
- linear and binary search for arrays;
- sorting (currently merge sort, planning on implementing other algorithms);
- shuffling
Note: this module isn't standalone. You will also need memory to use it.
Provides a list struct implemented as a doubly linked list and related basic functions, like push, pop, search and delete Note this module isn't standalone. You will also need memory to use it.
Provides a darray (dynamic-array) struct, a sort of a clone of C++'s std::vector and related functions. Note: this module isn't standalone. You will also need memory and algorithms to use it.