[prev in list] [next in list] [prev in thread] [next in thread] 

List:       subversion-dev
Subject:    Re: Subversion Exception!
From:       Branko_Čibej <brane () apache ! org>
Date:       2018-12-28 10:21:00
Message-ID: efa45f74-1a64-5697-0275-9ea3a0c24140 () apache ! org
[Download RAW message or body]

On 28.12.2018 11:19, Branko Čibej wrote:
> On 28.12.2018 11:05, Bert Huijben wrote:
>> +svn_error_t *
>> +svn_error__malfunction_f(svn_boolean_t can_return,
>> +                         const char *file, int line,
>> +                         const char *fmt, ...)
>> +{
>> +  apr_pool_t *pool = svn_pool_create(NULL);
>> +  va_list ap;
>> +  const char *expr;
>> +
>> +  va_start(ap, fmt);
>> +  expr = apr_pvsprintf(pool, fmt, ap);
>> +  va_end(ap);
>> +  return malfunction_handler(can_return, file, line, expr);
>> +}
>> +
>>
>> Can we somehow use a smarter pool (perhaps just require passing an existing
>> scratch pool as some similar apr apis do). Some library users do use the
>> can_return feature and/or exception handling and we would introduce a minor
>> memory leak.
> We'd have to somehow tweak the malfunction_handler to create its own
> svn_error_t* from the provided pool.
>
> Another option is to check if can_return is set, and only then, call the
> malfunction_handler first and then change the message stored in the
> returned svn_error_t, using the error pool for formatting.

... but that might cause the expression to not be dispayed to the user ...
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic