mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
Merge "core: Fix ABI mismatch of ao2_global_obj."
This commit is contained in:
@@ -786,72 +786,6 @@ unsigned int ao2_options_get(void *obj)
|
||||
return orig_obj->priv_data.options;
|
||||
}
|
||||
|
||||
void *__ao2_global_obj_replace(struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name)
|
||||
{
|
||||
void *obj_old;
|
||||
|
||||
if (!holder) {
|
||||
/* For sanity */
|
||||
ast_log(LOG_ERROR, "Must be called with a global object!\n");
|
||||
ast_assert(0);
|
||||
return NULL;
|
||||
}
|
||||
if (__ast_rwlock_wrlock(file, line, func, &holder->lock, name)) {
|
||||
/* Could not get the write lock. */
|
||||
ast_assert(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (obj) {
|
||||
__ao2_ref(obj, +1, tag, file, line, func);
|
||||
}
|
||||
obj_old = holder->obj;
|
||||
holder->obj = obj;
|
||||
|
||||
__ast_rwlock_unlock(file, line, func, &holder->lock, name);
|
||||
|
||||
return obj_old;
|
||||
}
|
||||
|
||||
int __ao2_global_obj_replace_unref(struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name)
|
||||
{
|
||||
void *obj_old;
|
||||
|
||||
obj_old = __ao2_global_obj_replace(holder, obj, tag, file, line, func, name);
|
||||
if (obj_old) {
|
||||
__ao2_ref(obj_old, -1, tag, file, line, func);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *__ao2_global_obj_ref(struct ao2_global_obj *holder, const char *tag, const char *file, int line, const char *func, const char *name)
|
||||
{
|
||||
void *obj;
|
||||
|
||||
if (!holder) {
|
||||
/* For sanity */
|
||||
ast_log(LOG_ERROR, "Must be called with a global object!\n");
|
||||
ast_assert(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (__ast_rwlock_rdlock(file, line, func, &holder->lock, name)) {
|
||||
/* Could not get the read lock. */
|
||||
ast_assert(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
obj = holder->obj;
|
||||
if (obj) {
|
||||
__ao2_ref(obj, +1, tag, file, line, func);
|
||||
}
|
||||
|
||||
__ast_rwlock_unlock(file, line, func, &holder->lock, name);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
void *__ao2_weakproxy_alloc(size_t data_size, ao2_destructor_fn destructor_fn,
|
||||
const char *tag, const char *file, int line, const char *func)
|
||||
|
Reference in New Issue
Block a user