Re:Libsass – C implementation of a Sass compiler
by dchest on Tuesday November 26, 2013 @04:55AM
(#6800201)
Anyway, please don't cast the return value of malloc() in C (http://stackoverflow.com/a/605858/28169).
It's C++.
Anyway, please don't cast the return value of malloc() in C (http://stackoverflow.com/a/605858/28169).
Also, of course len should be const and sizeof (char) should be removed. Also testing whether malloc() succeeded before relying on the result being valid is a good idea (but perhaps there's machinery in place to abort on error), as is deciding what to do if the input string is NULL.