- Belgium
- https://www.rustybever.be
-
Computer science student from Belgium who loves playing around with servers.
- Joined on
2021-03-28
Vieter doesn't only supports zstd-compressed archives. Currently it also accepts xz- or gzip-compressed archives, so this should be accounted for.
Returning NULL when a function fails doesn't say anything about why the function failed. A better API imo (which I also use in the heap module) is for the function to return an enum value intead, indicating the success of the function. The output is written to a pointer-to-pointer that is passed as the first argument of the function.
This check is not safe, the dynarray code doesn't make any guarantees about empty fields being NULL, they're simply malloc'ed and not initialised.
General note for snprintf usage: what happens if the value is larger than the buffer? Is it simply cut off? Cuz if so, we shouldn't be making assumptions about the length of the input.
I'm not quite sure yet where I'd like to place third-party code (in case we start adding more stuff like this), but considering this is the only place this is used, just leaving it here for now is fine.
In general, the code isn't formatted at all, but that can be fixed by a simple make fmt.