Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
pacemaker.13547
pacemaker-libcib-functionize-destroying-op-call...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker-libcib-functionize-destroying-op-callback-table.patch of Package pacemaker.13547
commit 33b3b7e7004e3ec5501c32a2217ec32775a5a487 Author: Ken Gaillot <kgaillot@redhat.com> Date: Mon Apr 24 10:38:50 2017 -0500 Refactor: libcib: functionize destroying op callback table reduces code duplication diff --git a/lib/cib/cib_client.c b/lib/cib/cib_client.c index 5ded9434f..0f533309f 100644 --- a/lib/cib/cib_client.c +++ b/lib/cib/cib_client.c @@ -206,6 +206,15 @@ cib_destroy_op_callback(gpointer data) free(blob); } +static void +destroy_op_callback_table() +{ + if (cib_op_callback_table != NULL) { + g_hash_table_destroy(cib_op_callback_table); + cib_op_callback_table = NULL; + } +} + char * get_shadow_file(const char *suffix) { @@ -348,14 +357,7 @@ cib_new_variant(void) new_cib = calloc(1, sizeof(cib_t)); - if (cib_op_callback_table != NULL) { - g_hash_table_destroy(cib_op_callback_table); - cib_op_callback_table = NULL; - } - if (cib_op_callback_table == NULL) { - cib_op_callback_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, - NULL, cib_destroy_op_callback); - } + remove_cib_op_callback(0, TRUE); /* remove all */ new_cib->call_id = 1; new_cib->variant = cib_undefined; @@ -419,10 +421,7 @@ cib_delete(cib_t * cib) free(client); } - if(cib_op_callback_table) { - g_hash_table_destroy(cib_op_callback_table); - cib_op_callback_table = NULL; - } + destroy_op_callback_table(); if(cib) { cib->cmds->free(cib); @@ -639,13 +638,9 @@ void remove_cib_op_callback(int call_id, gboolean all_callbacks) { if (all_callbacks) { - if (cib_op_callback_table != NULL) { - g_hash_table_destroy(cib_op_callback_table); - } - + destroy_op_callback_table(); cib_op_callback_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, cib_destroy_op_callback); - } else { g_hash_table_remove(cib_op_callback_table, GINT_TO_POINTER(call_id)); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor