Lucien Cartier-Tilet
fbed1b21d6
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. |
||
---|---|---|
src | ||
.clang-format | ||
.gitignore | ||
README.org |
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 Rust’s std::vec::Vec
. It doesn’t try to be on par with these in terms of
features, but simply tries to provide basic features most people will find
useful.