if(version1 != NULL) rest1 = crm_strdup(version1); if(version2 != NULL) rest2 = crm_strdup(version2);
if(version1 != NULL) { rest1 = crm_strdup(version1); } else { version1 = "<null>"; } if(version2 != NULL) { rest2 = crm_strdup(version2); } else { version2 = "<null>"; }
compare_version(const char *version1, const char *version2){	int lpc = 0;	char *step1 = NULL, *step2 = NULL;	char *rest1 = NULL, *rest2 = NULL;	if(version1 != NULL) rest1 = crm_strdup(version1);	if(version2 != NULL) rest2 = crm_strdup(version2);	while(1) {		int cmp = 0;		int step1_i = 0;		int step2_i = 0;		char *tmp1 = NULL, *tmp2 = NULL;				decodeNVpair(rest1, '.', &step1, &tmp1);		decodeNVpair(rest2, '.', &step2, &tmp2);		if(step1 != NULL) {			step1_i = atoi(step1);		}		if(step2 != NULL) {			step2_i = atoi(step2);		}		if(step1_i < step2_i){			cmp = -1;		} else if (step1_i > step2_i){			cmp = 1;		}		crm_trace("compare[%d (%d)]: %d(%s)  %d(%s)",			  lpc++, cmp,			  step1_i, step1, step2_i, step2);		crm_free(rest1);		crm_free(rest2);		rest1 = tmp1;		rest2 = tmp2;		if(step1 == NULL && step2 == NULL) {			break;		}		crm_free(step1);		crm_free(step2);				if(cmp < 0) {			crm_verbose("%s < %s", version1, version2);			return -1;					} else if(cmp > 0) {			crm_verbose("%s > %s", version1, version2);			return 1;		}	}	crm_verbose("%s == %s", version1, version2);	return 0;}