Пример #1
0
bool HashList::resync()
{
    XDebug(DebugAll,"HashList::resync() [%p]",this);
    bool moved = false;
    for (unsigned int n = 0; n < m_size; n++) {
        ObjList* l = m_lists[n];
        while (l) {
            GenObject* obj = l->get();
            if (obj) {
                unsigned int i = obj->toString().hash() % m_size;
                if (i != n) {
                    bool autoDel = l->autoDelete();
                    m_lists[n]->remove(obj,false);
                    if (!m_lists[i])
                        m_lists[i] = new ObjList;
                    m_lists[i]->append(obj)->setDelete(autoDel);
                    moved = true;
                    continue;
                }
            }
            l = l->next();
        }
    }
    return moved;
}
Пример #2
0
NamedList& NamedList::copyParams(const NamedList& original, ObjList* list, char childSep)
{
    XDebug(DebugInfo,"NamedList::copyParams(%p,%p,'%.1s') [%p]",
	&original,list,&childSep,this);
    for (; list; list = list->next()) {
	GenObject* obj = list->get();
	if (!obj)
	    continue;
	String name = obj->toString();
	name.trimBlanks();
	if (name)
	    copyParam(original,name,childSep);
    }
    return *this;
}