+/* use the macro */
+TR_RP_REALM *tr_rp_realm_remove_func(TR_RP_REALM *head, TR_RP_REALM *remove)
+{
+ TALLOC_CTX *list_ctx=talloc_parent(head);
+ TR_RP_REALM *this=NULL;
+
+ if (head==NULL)
+ return NULL;
+
+ if (head==remove) {
+ /* if we're removing the head, put the next element (if present) into the context
+ * the list head was in. */
+ head=head->next;
+ if (head!=NULL) {
+ talloc_steal(list_ctx, head);
+ /* now put all the other elements in the context of the list head */
+ for (this=head->next; this!=NULL; this=this->next)
+ talloc_steal(head, this);
+ }
+ } else {
+ /* not removing the head; no need to play with contexts */
+ for (this=head; this->next!=NULL; this=this->next) {
+ if (this->next==remove) {
+ this->next=remove->next;
+ break;
+ }
+ }
+ }
+ return head;
+}
+