[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: HEADS-UP: pvt API change in ldap_pvt_thread_pool_setkey()?



Pierangelo Masarati wrote:
> Occasionally, I need to modify an already set value, which needs
> de-allocation.  This right now seems to require a call to
> ldap_pvt_thread_pool_getkey() to get the old value first, followed by a
> call to ldap_pvt_thread_pool_setkey().  This requires running twice
> through the list of keys (not much a hassle, but not a clean interface
> either).  I see two options:
> 
> 1) let ldap_pvt_thread_pool_setkey() call the free handler, if defined,
> passing the old value if not null

I realize option (1) is a nonsense, since it would free the stored value
any time ldap_pvt_thread_pool_setkey() is called with a NULL value to
reset it.

> 
> 2) change the API of ldap_pvt_thread_pool_setkey() so that it returns
> the old value, if passed a non-null pointer to hold it.
> 
> Option 2 is more intrusive (requires multiple changes to existing code)
> but possibly more versatile.

At this stage, option (2) seems to be the only choice.  Maybe a modified
version, sort of ldap_pvt_thread_pool_setkey_x() that returns the stored
value, wrapped by a macro ldap_pvt_thread_pool_setkey() that passes a
NULL for the pointer to the stored value?

p.



Ing. Pierangelo Masarati
OpenLDAP Core Team

SysNet s.r.l.
via Dossi, 8 - 27100 Pavia - ITALIA
http://www.sys-net.it
---------------------------------------
Office:  +39 02 23998309
Mobile:  +39 333 4963172
Email:   pierangelo.masarati@sys-net.it
---------------------------------------