return 0;
}
+#define IN_A_LIST_MSG "Pair %pV is already in a list, and cannot be moved"
+#define NOT_IN_THIS_LIST_MSG "Pair %pV is not in the given list"
+
/** Change a vp's talloc ctx and insert it into a new list
*
* @param[in] list_ctx to move vp into.
*/
int fr_pair_steal_append(TALLOC_CTX *list_ctx, fr_pair_list_t *list, fr_pair_t *vp)
{
- if (fr_pair_order_list_in_list(&list->order, vp)) {
- fr_strerror_printf("Pair %pV is a list member, cannot be moved", vp);
+ if (fr_pair_order_list_in_a_list(vp)) {
+ fr_strerror_printf(IN_A_LIST_MSG, vp);
return -1;
}
*/
int fr_pair_steal_prepend(TALLOC_CTX *list_ctx, fr_pair_list_t *list, fr_pair_t *vp)
{
- if (fr_pair_order_list_in_list(&list->order, vp)) {
- fr_strerror_printf("Pair %pV is a list member, cannot be moved", vp);
+ if (fr_pair_order_list_in_a_list(vp)) {
+ fr_strerror_printf(IN_A_LIST_MSG, vp);
return -1;
}
{
PAIR_VERIFY(to_add);
- if (fr_pair_order_list_in_list(&list->order, to_add)) {
- fr_strerror_printf("Pair %pV already inserted into list", to_add);
+ if (fr_pair_order_list_in_a_list(to_add)) {
+ fr_strerror_printf(IN_A_LIST_MSG, to_add);
return -1;
}
{
PAIR_VERIFY(to_add);
- if (fr_pair_order_list_in_list(&list->order, to_add)) {
- fr_strerror_printf("Pair %pV already inserted into list", to_add);
+ if (fr_pair_order_list_in_a_list(to_add)) {
+ fr_strerror_printf(IN_A_LIST_MSG, to_add);
return -1;
}
{
PAIR_VERIFY(to_add);
- if (fr_pair_order_list_in_list(&list->order, to_add)) {
- fr_strerror_printf("Pair %pV already inserted into list", to_add);
+ if (fr_pair_order_list_in_a_list(to_add)) {
+ fr_strerror_printf(IN_A_LIST_MSG, to_add);
return -1;
}
if (pos && !fr_pair_order_list_in_list(&list->order, pos)) {
- fr_strerror_printf("Pair %pV not in list", pos);
+ fr_strerror_printf(NOT_IN_THIS_LIST_MSG, pos);
return -1;
}
{
PAIR_VERIFY(to_add);
- if (fr_pair_order_list_in_list(&list->order, to_add)) {
- fr_strerror_printf("Pair %pV already inserted into list", to_add);
+ if (fr_pair_order_list_in_a_list(to_add)) {
+ fr_strerror_printf(IN_A_LIST_MSG, to_add);
return -1;
}
if (pos && !fr_pair_order_list_in_list(&list->order, pos)) {
- fr_strerror_printf("Pair %pV not in list", pos);
+ fr_strerror_printf(NOT_IN_THIS_LIST_MSG, pos);
return -1;
}