static void insertTimer ( sTimer *tp ) { LstLink(sTimer) *tl; sTimer *tip; if (LstEmp(&timer_lh)) { (void)LstIns(LstEnd(&timer_lh), tp, ll); return; } for (tl = LstLas(&timer_lh); tl != LstEnd(&timer_lh); tl = LstPre(tl)) { tip = LstObj(tl); if (tp->wrapped) { if (!tip->wrapped || tip->clock < tp->clock) break; } else if (!tip->wrapped && tip->clock < tp->clock) break; } tl = LstNex(tl); (void)LstIns(tl, tp, ll); }
static void reinit_nodes () { pwr_tStatus sts; LstLink(sNode) *nl; sNode *np; pwr_tObjid oid; /* Mark all links in the NodeLink list */ for (nl= LstFir(&node_l); nl != LstEnd(&node_l); nl = LstNex(nl)) LstObj(nl)->found = FALSE; for ( sts = gdh_GetClassList(pwr_cClass_NodeLinkSup, &oid); ODD(sts); sts = gdh_GetNextObject(oid, &oid) ) { if ((np = get_nodes(oid)) == NULL) { np = init_node(oid, NULL, 1); if (np != NULL) { nl = LstIns(nl, np, node_l); np->found = TRUE; } } else { update_node(np); } } for (nl = LstFir(&node_l); nl != LstEnd(&node_l); nl = LstNex(nl)) { np = LstObj(nl); if (!np->found) { nl = LstPre(&np->node_l); LstRem(&np->node_l); LstNul(&np->node_l); gdh_SubUnrefObjectInfo (np->o->SubId); gdh_DLUnrefObjectInfo(np->dlid); free(np); } } }