Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
pacemaker
bsc#1117934-0000-Low-libcrmcommon-add-new-inter...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc#1117934-0000-Low-libcrmcommon-add-new-internal-function-for-strin.patch of Package pacemaker
From e3776a6a3cac118fdbc1574232cd138a8e971af2 Mon Sep 17 00:00:00 2001 From: Ken Gaillot <kgaillot@redhat.com> Date: Fri, 24 Jun 2016 14:29:32 -0500 Subject: [PATCH] Low: libcrmcommon: add new internal function for "string ends with" --- include/crm/common/internal.h | 1 + lib/common/strings.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) Index: pacemaker/include/crm_internal.h =================================================================== --- pacemaker.orig/include/crm_internal.h +++ pacemaker/include/crm_internal.h @@ -203,6 +203,7 @@ crm_set_bit(const char *function, const void g_hash_destroy_str(gpointer data); long long crm_int_helper(const char *text, char **end_text); +gboolean crm_ends_with(const char *s, const char *match); char *crm_concat(const char *prefix, const char *suffix, char join); char *generate_hash_key(const char *crm_msg_reference, const char *sys); Index: pacemaker/lib/common/utils.c =================================================================== --- pacemaker.orig/lib/common/utils.c +++ pacemaker/lib/common/utils.c @@ -499,6 +499,28 @@ crm_version_helper(const char *text, cha return atoi_result; } +/*! + * \internal + * \brief Check whether a string ends with a certain sequence + * + * \param[in] s String to check + * \param[in] match Sequence to match against end of s + * + * \return TRUE if s ends with match, FALSE otherwise + */ +gboolean +crm_ends_with(const char *s, const char *match) +{ + if ((s == NULL) || (match == NULL)) { + return FALSE; + } else { + size_t slen = strlen(s); + size_t mlen = strlen(match); + + return ((slen >= mlen) && !strcmp(s + slen - mlen, match)); + } +} + /* * version1 < version2 : -1 * version1 = version2 : 0
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