MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / clone_strip

Function clone_strip

lib/pengine/unpack.c:928–965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

926}
927
928char *
929clone_strip(const char *last_rsc_id)
930{
931 int lpc = 0;
932 char *zero = NULL;
933
934 CRM_CHECK(last_rsc_id != NULL, return NULL);
935 lpc = strlen(last_rsc_id);
936 while (--lpc > 0) {
937 switch (last_rsc_id[lpc]) {
938 case 0:
939 crm_err("Empty string: %s", last_rsc_id);
940 return NULL;
941 break;
942 case '0':
943 case '1':
944 case '2':
945 case '3':
946 case '4':
947 case '5':
948 case '6':
949 case '7':
950 case '8':
951 case '9':
952 break;
953 case ':':
954 zero = calloc(1, lpc + 1);
955 memcpy(zero, last_rsc_id, lpc);
956 zero[lpc] = 0;
957 return zero;
958 default:
959 goto done;
960 }
961 }
962 done:
963 zero = strdup(last_rsc_id);
964 return zero;
965}
966
967char *
968clone_zero(const char *last_rsc_id)

Callers 3

get_failcountFunction · 0.85
unpack_find_resourceFunction · 0.85
anonymous_known_onFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected