static int string_compare(const iodef_value_type_t *t1, const iodef_value_type_t *t2, size_t size, iodef_criterion_operator_t op) { const char *s1 = NULL, *s2 = NULL; if ( t1 && t1->data.string_val ) s1 = libiodef_string_get_string(t1->data.string_val); if ( t2 && t2->data.string_val ) s2 = libiodef_string_get_string(t2->data.string_val); return charstring_compare(s1, s2, op); }
static int enum_compare(const idmef_value_type_t *src, const idmef_value_type_t *dst, size_t size, idmef_criterion_operator_t op) { const char *s1; if ( dst->id == IDMEF_VALUE_TYPE_STRING ) { s1 = idmef_class_enum_to_string(src->data.enum_val.class_id, src->data.enum_val.value); if ( ! s1 ) return requiem_error_verbose(REQUIEM_ERROR_IDMEF_VALUE_TYPE_PARSE, "Enumeration conversion from numeric to string failed"); return charstring_compare(s1, requiem_string_get_string(dst->data.string_val), op); } return generic_compare(src, dst, size, op); }
static int enum_compare(const iodef_value_type_t *src, const iodef_value_type_t *dst, size_t size, iodef_criterion_operator_t op) { const char *s1; if ( (src && ! dst) || (dst && ! src) ) return -1; if ( dst->id == IODEF_VALUE_TYPE_STRING ) { s1 = iodef_class_enum_to_string(src->data.enum_val.class_id, src->data.enum_val.value); if ( ! s1 ) return libiodef_error_verbose(LIBIODEF_ERROR_IODEF_VALUE_TYPE_PARSE, "Enumeration conversion from numeric to string failed"); return charstring_compare(s1, libiodef_string_get_string(dst->data.string_val), op); } return generic_compare(src, dst, size, op); }