/* * Copyright (c) 1992, 1993 by the University of Southern California * * For copying and distribution information, please see the file * */ #include #include /* def of PATTRIB */ #include /* prototype for delete_matching_at() */ #include /* EXTRACT_ITEM macro */ #include /* Looks for an attribute equal to the key according to the equal function. Deletes & frees it. Returns: PSUCCESS or PFAILURE This is currently only used in ed_link_info.c and ed_obj_info.c */ int delete_matching_at(PATTRIB key, PATTRIB *headp, int (*equal)(PATTRIB, PATTRIB)) { /* ick - this was "index" which is defined as a macro */ PATTRIB ind; /* Find the match. */ for (ind = *headp; ind; ind = ind->next) { if ((*equal)(key, ind)) { EXTRACT_ITEM(ind, (*headp)); atfree(ind); return PSUCCESS; } } RETURNPFAILURE; } int delete_matching_fl(FILTER key, FILTER *headp) { FILTER ind; /* Find the match. */ for (ind = *headp; ind; ind = ind->next) { if (equal_filters(key, ind)) { EXTRACT_ITEM(ind, (*headp)); flfree(ind); return PSUCCESS; } } RETURNPFAILURE; }