Re: svn commit: r1917050 - in /apr/apr/trunk: CHANGES crypto/apr_crypto.c dbd/apr_dbd.c dbm/apr_dbm.c include/private/apu_internal.h util-misc/apu_dso.c

Ruediger Pluem <[email protected]>
Newsgroups gmane.comp.apache.apr.devel
Message-ID <[email protected]>

On 4/22/24 4:07 PM, Graham Leggett via dev wrote:
> On 22 Apr 2024, at 14:05, Ruediger Pluem <[email protected]> wrote:
> 
>>>> Now the caller needs to allocate memory even if it is not interested in the error or if there is no error at all.
>>>> Wouldn't it be better to add an apu_err_t **err instead (which can be NULL) and in case of an error allocate an
>>>> apu_err_t from pool and fill it and return it in **err (provided it was not NULL).
>>>
>>> I originally used this pattern and found it overkill - what I do now is allocate a app_err_t on the stack and immediately
>>> abandon it.
>>
>> Did you commit this?
> 
> Updated in http://svn.apache.org/viewvc?rev=1917271&view=rev

But I don't see where you allocate the structure on the stack on the caller side for apr_crypto and apr_dbm and only copy it to a
pool based alloc in case of an error and that we pass NULL in case of apr_dbd where we don't process it.
Currently we allocate memory for an apu_err_t struct that we don't need in most cases as it only matters in case of an error
which I hope is not the typical code path.

Regards

Rüdiger
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.