3 ms·
At that point you can just ditch both randstr and keyval entirely and encode directly into &heads[3].val since it allocates anyway. You still have to pass in a
by stefan_ 3y ago
At that point you can just ditch both randstr and keyval entirely and encode directly into &heads[3].val since it allocates anyway. You still have to pass in a useless randlen because it will otherwise crash, oh well, the beauty of C "output" parameters.
This "copy from heap into stack variable" dance doesn't save on cleanups either since there is only one unconditional return after the encode.
(But I can see how you arrive at this current code if you "laid out" your needed variables at the top and then realized later Curl_base64_encode always allocates)