void HashBase::Set(int i, unsigned _hash) { if(map) { Link& lnk = link[i]; Unlink(i, lnk); int& mi = Maph(_hash & ~UNSIGNED_HIBIT); int ii = mi; if(ii < 0) mi = lnk.prev = lnk.next = i; else if(i < ii) { LinkBefore(i, lnk, ii); mi = i; } else { int l = ii; int h = link[ii].prev; if(h - i < i - l) { while(i < h) { h = link[h].prev; } LinkBefore(i, lnk, link[h].next); } else { l = link[l].next; while(i > l && l != ii) { l = link[l].next; } LinkBefore(i, lnk, l); } } } hash[i] = _hash & ~UNSIGNED_HIBIT; }
DisplayPopup::DisplayPopup() { SetFrame(BlackFrame()); display = NULL; paper = ink = Null; style = 0; item = slim = Null; margin = 0; ONCELOCK { InstallStateHook(StateHook); } LinkBefore(all()); }
void Ipv4SendIntf(NetIntf *intf, const Ipv4Addr *nextAddr, const Ipv4Addr *dstAddr, u8 protocol, NetBuf *pkt) { uint len = pkt->end - pkt->start; Packet *packet = malloc(sizeof(Packet)); packet->phdr.src = intf->ipAddr; packet->phdr.dst = *dstAddr; packet->phdr.reserved = 0; packet->phdr.protocol = protocol; packet->phdr.len = NetSwap16(len); memcpy(packet->data, pkt->start, len); packet->end = packet->data + len; LinkBefore(&s_outPackets, &packet->link); NetReleaseBuf(pkt); }
Sqlite3Connection::Sqlite3Connection(Sqlite3Session& the_session, sqlite3 *the_db) : session(the_session), db(the_db), current_stmt(NULL), got_first_row(false), got_row_data(false) { LinkBefore(&session.clink); }