There's a recurring pattern walking the ISC_LISTs that just repeats over and over. Add two macros: * ISC_LIST_FOREACH(list, elt, link) - walk the static list * ISC_LIST_FOREACH_SAFE(list, elt, link, next) - walk the list in a manner that's safe against list member deletions