The public API functions(C) and (C++) both call into the function , which calls into .
However,will attempt to allocate memory for a number of things, one of which is the Resource Bundle. This can possibly fail (due to OOM), leading to the APIs returning a pointer to null.
If a stack allocated Resource Bundle could be used instead, then there would be one less thing that needs heap allocation in this code path.
Unfortunately, the internal functiondoes not take a Resource Bundle parameter, which means that it will always allocate.
We can add a similar internal API
(This is similar to the and functions – one of which allocates and the other fills in an existing one).
The proposed internal API would look like this (in the file uresbund.cpp):