if (_ret != 0) return _ret; \
} while (0)
+/** Return the comparison of two opaque fields of a structure
+ *
+ * @param[in] _a pointer to first structure.
+ * @param[in] _b pointer to second structure.
+ * @param[in] _field within the structs to compare.
+ * @param[in] _len_field within the structs, specifying the length of the data.
+ * @return The result of the comparison.
+ */
+#define MEMCMP_FIELDS(_a, _b, _field, _len_field) \
+ memcmp_return((_a)->_field, (_b)->_field, (_a)->_len_field, (_b)->_len_field)
+
/** Remove const qualification from a pointer
*
* @param[in] _type The non-const version of the type.
{
map_proc_t const *a = one, *b = two;
- MEMCMP_RETURN(a, b, name, length);
- return 0;
+ return MEMCMP_FIELDS(a, b, name, length);
}
/** Unregister a map processor
*/
static inline int8_t terminal_cmp(fr_sbuff_term_elem_t const *a, fr_sbuff_term_elem_t const *b)
{
- MEMCMP_RETURN(a, b, str, len);
- return 0;
+ return MEMCMP_FIELDS(a, b, str, len);
}
#if 0
{
rlm_cache_entry_t const *a = one, *b = two;
- MEMCMP_RETURN(a, b, key.vb_strvalue, key.vb_length);
- return 0;
+ return MEMCMP_FIELDS(a, b, key.vb_strvalue, key.vb_length);
}
/** Compare two entries by expiry time