X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsn_comparator.h;h=6e3f7f52e79add024891aedda2215f9468787179;hb=664f1e7c27a7bcea7ebb5a4329087bad22a87a01;hp=db46982c9c5b676a82b46a724fd1922714f52d11;hpb=b9df6bb2cfb6e6cc2b88cb1e5e9fcd68e83c8639;p=sort-networks.git diff --git a/src/sn_comparator.h b/src/sn_comparator.h index db46982..6e3f7f5 100644 --- a/src/sn_comparator.h +++ b/src/sn_comparator.h @@ -35,6 +35,8 @@ struct sn_comparator_s { int min; /**< Index of the line onto which the smaller element will be put. */ int max; /**< Index of the line onto which the larger element will be put. */ + void *user_data; /**< Pointer to user data. */ + void (*free_func) (void *); /**< Pointer to a function used to free the user data pointer. */ }; typedef struct sn_comparator_s sn_comparator_t; @@ -47,6 +49,11 @@ typedef struct sn_comparator_s sn_comparator_t; /** Returns the index of the line onto which the larger element will be put. */ #define SN_COMP_MAX(c) (c)->max +/** Expands to the user data pointer. */ +#define SN_COMP_USER_DATA(c) (c)->user_data +/** Expands to the free-function pointer. */ +#define SN_COMP_FREE_FUNC(c) (c)->free_func + /** * Allocates, initializes and returns a new comparator object. The returned * pointer must be freed by sn_comparator_destroy().