foxpy / qc

Quad C: Custom Cruel C Crate
MIT License
4 stars 0 forks source link

sprintf_alloc is unsafe #42

Closed foxpy closed 3 years ago

foxpy commented 3 years ago

What would be better to do is to implement asprintf and vasprintf, since they are safe, still as useful, programmers are probably used to them, but they are non-standard. So, seeing them here would be very nice.

foxpy commented 3 years ago

These signatures look like a good idea:

size_t qc_asprintf(char** dst, char const* format, ...);
size_t qc_asnprintf(char** dst, size_t mlimit, char const* format, ...);
size_t qc_vasprintf(char** dst, char const* format, va_list ap);
size_t qc_vasnprintf(char** dst, size_t mlimit, char const* format, va_list ap);