]> git.ozlabs.org Git - ccan/blobdiff - ccan/order/order.h
order: total_order_cmp() helper and better tests
[ccan] / ccan / order / order.h
index edceab5551e2e68dd14bee39bf7ac4a12663841b..23f030b2c8c1e9e3e50751ec275f3a882eb3daec 100644 (file)
@@ -31,6 +31,9 @@ struct _total_order {
                _ctx ctx;                               \
        } _name
 
+#define total_order_cmp(_order, _a, _b)                                        \
+       ((_order).cb((_a), (_b), (_order).ctx))
+
 #define _DECL_ONAME(_oname, _itype)                                    \
        extern int _order_##_oname(const void *, const void *, void *); \
        extern int order_##_oname(const _itype *, const _itype *, void *); \