void *PoolMemoryAllocator::allocate(size_t nBytes) {
#if !defined(OGDF_MEMORY_POOL_NTS) && defined(OGDF_NO_COMPILER_TLS)
	MemElemPtr *pFreeBytes = ((MemElemPtr*)pthread_getspecific(s_tpKey))+nBytes;
#else
	MemElemPtr *pFreeBytes = s_tp+nBytes;
#endif
	if (OGDF_LIKELY(*pFreeBytes != 0)) {
		MemElemPtr p = *pFreeBytes;
		*pFreeBytes = p->m_next;
		return p;
	} else {
		return fillPool(*pFreeBytes,__uint16(nBytes));
	}
}
Esempio n. 2
0
void FilePool::fillPool(const QString &folder)
{
    QDir    dir(folder);

    dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::NoSymLinks);

    for (const QFileInfo &entry : dir.entryInfoList())
    {
        if (entry.isDir())
        {
            fillPool(entry.filePath());
        }
        else if (entry.isFile())
        {
            m_files.append(entry.filePath());
        }
    }
}
Esempio n. 3
0
FilePool::FilePool(const QString &folder)
    : m_folder(folder)
{
    fillPool(m_folder);
}