Commit 7bcc5540 authored by Pekka Pessi's avatar Pekka Pessi

Added su_home_destructor() (in addition to su_home_desctructor()), using it.

darcs-hash:20061016155721-65a35-41d051b0d35383b7cb6a7ea5d7f92b5e6ea9c534.gz
parent d91344b0
......@@ -27,6 +27,8 @@ libsofia-sip-ua:
sip_headers_as_url_query(), sip_url_query_as_taglist(),
url_query_as_header_string(), url_unescape_to(),
msg_header_parse_str()
- Added su_home_destructor(), deprecated su_home_desctructor(). See
documentation of su_home_desctructor() for more information.
- Added NUTAG_INCLUDE_EXTRA_SDP()
- Added nua_handle_by_replaces(), nua_handle_make_replaces(),
nua_handle_magic() and nua_magic() functions
......
......@@ -137,7 +137,7 @@ nua_handle_t *nh_create_handle(nua_t *nua,
else {
_handle_lifetime = 2;
SU_DEBUG_0(("nh_handle_create(%p)\n", nh));
su_home_desctructor(nh->nh_home, nh_destructor);
su_home_destructor(nh->nh_home, nh_destructor);
}
}
}
......
......@@ -706,7 +706,7 @@ sres_resolver_new_internal(sres_cache_t *cache,
o = memccpy(array[i] = o, options[i], '\0', len - (end - o));
assert(o == end);
su_home_desctructor(res->res_home, sres_resolver_destructor);
su_home_destructor(res->res_home, sres_resolver_destructor);
while (res->res_id == 0) {
#if HAVE_DEV_URANDOM
......
......@@ -67,7 +67,14 @@ SU_DLL void *su_home_new(isize_t size)
SU_DLL void *su_home_ref(su_home_t const *);
SU_DLL int su_home_unref(su_home_t *);
SU_DLL int su_home_destructor(su_home_t *, void (*)(void *));
SU_DLL int su_home_desctructor(su_home_t *, void (*)(void *));
#ifndef su_home_desctructor
/* This has typo in before 1.12.4 */
#define su_home_desctructor(home, destructor) \
su_home_destructor((home), (destructor))
#endif
SU_DLL void *su_home_clone(su_home_t *parent, isize_t size)
__attribute__((__malloc__));
......
......@@ -106,7 +106,7 @@
* function su_home_create() creates a home object with infinite reference
* count. Likewise, su_home_init() does the same.
*
* @section su_home_desctructor_usage Destructors
* @section su_home_destructor_usage Destructors
*
* It is possible to give a destructor function to a home object. The
* destructor releases other resources associated with the home object
......@@ -559,8 +559,16 @@ void *su_home_ref(su_home_t const *home)
return (void *)home;
}
/** Set destructor function */
SU_DLL int su_home_desctructor(su_home_t *home, void (*destructor)(void *))
/** Set destructor function.
*
* The destructor function is called after the reference count of a
* #su_home_t object reaches zero or a home object is deinitialized, but
* before any of the memory areas within the home object are freed.
*
* @since New in @VERSION_1_12_4.
* Earlier versions had su_home_desctructor() (spelling).
*/
int su_home_destructor(su_home_t *home, void (*destructor)(void *))
{
int retval = -1;
......@@ -578,6 +586,24 @@ SU_DLL int su_home_desctructor(su_home_t *home, void (*destructor)(void *))
return retval;
}
#undef su_home_desctructor
/** Set destructor function.
*
* @deprecated The su_home_destructor() was added in @VERSION_1_12_4. The
* su_home_desctructor() is now defined as a macro expanding as
* su_home_destructor(). If you want to compile an application as binary
* compatible with earlier versions, you have to define su_home_desctructor
* as itself, e.g.,
* @code
* #define su_home_desctructor su_home_desctructor
* #include <sofia-sip/su_alloc.h>
* @endcode
*/
int su_home_desctructor(su_home_t *home, void (*destructor)(void *))
{
return su_home_destructor(home, destructor);
}
/**Unreference a su_home_t object.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment