Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
pacemaker
pacemaker-liblrmd-add-function-to-create-resour...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker-liblrmd-add-function-to-create-resource-info-structure.patch of Package pacemaker
commit 71d01e9707c592e2955e02da51e1b908fc60ad1e Author: Ken Gaillot <kgaillot@redhat.com> Date: Thu Mar 1 12:36:23 2018 -0600 Refactor: liblrmd: add function to create resource info structure reduces code duplication, enhances readability, and allows reuse Index: pacemaker-1.1.18+20180126.bfe4e8042/include/crm/lrmd.h =================================================================== --- pacemaker-1.1.18+20180126.bfe4e8042.orig/include/crm/lrmd.h +++ pacemaker-1.1.18+20180126.bfe4e8042/include/crm/lrmd.h @@ -265,6 +265,8 @@ typedef struct lrmd_rsc_info_s { char *provider; } lrmd_rsc_info_t; +lrmd_rsc_info_t *lrmd_new_rsc_info(const char *rsc_id, const char *standard, + const char *provider, const char *type); lrmd_rsc_info_t *lrmd_copy_rsc_info(lrmd_rsc_info_t * rsc_info); void lrmd_free_rsc_info(lrmd_rsc_info_t * rsc_info); Index: pacemaker-1.1.18+20180126.bfe4e8042/lib/lrmd/lrmd_client.c =================================================================== --- pacemaker-1.1.18+20180126.bfe4e8042.orig/lib/lrmd/lrmd_client.c +++ pacemaker-1.1.18+20180126.bfe4e8042/lib/lrmd/lrmd_client.c @@ -1455,20 +1455,36 @@ lrmd_api_unregister_rsc(lrmd_t * lrmd, c } lrmd_rsc_info_t * -lrmd_copy_rsc_info(lrmd_rsc_info_t * rsc_info) +lrmd_new_rsc_info(const char *rsc_id, const char *standard, + const char *provider, const char *type) { - lrmd_rsc_info_t *copy = NULL; - - copy = calloc(1, sizeof(lrmd_rsc_info_t)); + lrmd_rsc_info_t *rsc_info = calloc(1, sizeof(lrmd_rsc_info_t)); - copy->id = strdup(rsc_info->id); - copy->type = strdup(rsc_info->type); - copy->class = strdup(rsc_info->class); - if (rsc_info->provider) { - copy->provider = strdup(rsc_info->provider); + CRM_ASSERT(rsc_info); + if (rsc_id) { + rsc_info->id = strdup(rsc_id); + CRM_ASSERT(rsc_info->id); + } + if (standard) { + rsc_info->class = strdup(standard); + CRM_ASSERT(rsc_info->class); + } + if (provider) { + rsc_info->provider = strdup(provider); + CRM_ASSERT(rsc_info->provider); } + if (type) { + rsc_info->type = strdup(type); + CRM_ASSERT(rsc_info->type); + } + return rsc_info; +} - return copy; +lrmd_rsc_info_t * +lrmd_copy_rsc_info(lrmd_rsc_info_t * rsc_info) +{ + return lrmd_new_rsc_info(rsc_info->id, rsc_info->class, + rsc_info->provider, rsc_info->type); } void @@ -1515,14 +1531,7 @@ lrmd_api_get_rsc_info(lrmd_t * lrmd, con return NULL; } - rsc_info = calloc(1, sizeof(lrmd_rsc_info_t)); - rsc_info->id = strdup(rsc_id); - rsc_info->class = strdup(class); - if (provider) { - rsc_info->provider = strdup(provider); - } - rsc_info->type = strdup(type); - + rsc_info = lrmd_new_rsc_info(rsc_id, class, provider, type); free_xml(output); return rsc_info; }
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