Go to file
Lucien Cartier-Tilet fbed1b21d6
Better error handling, inline functions, new PERR
Functions that end up calling a `malloc' or `realloc' return the new
struct `Result' which indicates if the memory allocation or reallocation
worked or not. If not, it holds a message, otherwise it holds the value
the function is meant to return (can be a null pointer if the function
returned a `void' before). The library will no longer forcibly exit the
program on such error in case it can be recovered by the code calling
it.

The modifications described above lead to vector-creating functions
returning a pointer to the newly created vector, and the function for
deleting vectors also frees the vector.

This commit also inlines some functions to make the compiled code a bit
lighter and calls to these functions possibly a bit faster.

`PDEB' is redefined following the new `PCOMMON' macro that is also used
by `PERR' for desplaying debug error messages.

Some lines are also modified to avoid potential memory leaks in case of
a memory (re)allocation.
2020-10-26 20:48:00 +01:00
src Better error handling, inline functions, new PERR 2020-10-26 20:48:00 +01:00
.clang-format Huge refactor, documentation incoming 2020-10-07 17:14:23 +02:00
.gitignore Huge refactor, documentation incoming 2020-10-07 17:14:23 +02:00
README.org Huge refactor, documentation incoming 2020-10-07 17:14:23 +02:00

CVec: A Simple Vector Implementation in C

What is this project?

CVec is a simple Vector implementation in C, inspired by C++s std::vector and Rusts std::vec::Vec. It doesnt try to be on par with these in terms of features, but simply tries to provide basic features most people will find useful.