bool Configmgr::LoadModuleConfig() { TiXmlDocument doc; string coreConfigPath = string(tools::GetAppPath()) + "/config/module.xml"; if (!doc.LoadFile(coreConfigPath.c_str())) { TASSERT(false, "can't find module file : %s", coreConfigPath.c_str()); return false; } const TiXmlElement * pRoot = doc.RootElement(); TASSERT(pRoot, "module.xml format error"); const char * pPath = pRoot->Attribute("path"); TASSERT(pPath, "module.xml format error, can't find module path"); m_oModuleConfig.strModulePath = pPath; const TiXmlElement * pModule = pRoot->FirstChildElement("module"); while (pModule) { const char * pName = pModule->Attribute("name"); TASSERT(pName, "module.xml form error, can't find module's name"); m_oModuleConfig.vctModules.push_back(pName); pModule = pModule->NextSiblingElement("module"); } return true; }
void _test_add_paths(dBGraph *graph, AsyncIOData *iodata, CorrectAlnInput *task, GenPathWorker *wrkrs, char *seq, size_t exp_npaths, size_t exp_nkmers, size_t exp_pbytes) { size_t npaths = graph->pstore.num_of_paths; size_t nkmers = graph->pstore.num_kmers_with_paths; uint8_t *next = graph->pstore.next; // Set up asyncio input data seq_read_set(&iodata->r1, seq); seq_read_reset(&iodata->r2); iodata->fq_offset1 = iodata->fq_offset2 = 0; iodata->ptr = NULL; // Add paths gen_paths_worker_seq(wrkrs, iodata, task); // Check we added the right number of paths TASSERT(graph->pstore.num_of_paths == npaths + exp_npaths); TASSERT(graph->pstore.num_kmers_with_paths == nkmers + exp_nkmers); // Check memory used size_t path_mem = sizeof(PathIndex) + graph->pstore.colset_bytes + sizeof(PathLen) + graph->pstore.extra_bytes; size_t exp_mem = path_mem * exp_npaths + exp_pbytes; TASSERT(graph->pstore.next == next + exp_mem); }
void test_klist_append () { TASSERT(l1 != NULL); klist_append(l1, (void *)item2); klist_append(l1, (void *)item3); klist_prepend(l1, (void *)item1); TASSERT(l1->length == 3); }
// `nbuf` and `sbuf` are temporary variables used by this function static void _call_bubble(BubbleCaller *caller, const char *flank5p, const char *flank3p, const char **alleles, size_t num_alleles, dBNodeBuffer *nbuf, StrBuf *sbuf) { const dBGraph *graph = caller->db_graph; const size_t kmer_size = graph->kmer_size; dBNode node5p = db_graph_find_str(graph, flank5p+strlen(flank5p)-kmer_size); dBNode node3p = db_graph_find_str(graph, flank3p); TASSERT(node5p.key != HASH_NOT_FOUND); TASSERT(node3p.key != HASH_NOT_FOUND); Edges edges5p = db_node_get_edges_union(graph, node5p.key); Edges edges3p = db_node_get_edges_union(graph, node3p.key); TASSERT(edges_get_outdegree(edges5p, node5p.orient) > 1); TASSERT(edges_get_indegree(edges3p, node3p.orient) > 1); find_bubbles(caller, node5p); GCacheUnitig *snode3p; Orientation snorient3p; GCacheStepPtrBuf *stepbuf; // Get 3p flank and orientation snode3p = graph_cache_find_unitig(&caller->cache, node3p); TASSERT(snode3p != NULL); snorient3p = gc_unitig_get_orient(&caller->cache, snode3p, node3p); find_bubbles_ending_with(caller, snode3p); stepbuf = (snorient3p == FORWARD ? &caller->spp_forward : &caller->spp_reverse); _check_alleles(&caller->cache, stepbuf, alleles, num_alleles, nbuf, sbuf); }
static void test_binary_seq_rev_cmp() { test_status("binary_seq_reverse_complement() binary_seq_to_str()"); uint8_t data[TLEN], tmp[TLEN]; char str[4*TLEN+1], rev[4*TLEN+1], restore[4*TLEN+1]; size_t i, j, k, nbases; for(i = 0; i < NTESTS; i++) { // Get random sequence, mask top byte, convert to string rand_bytes(data, TLEN); nbases = rand() & (4*TLEN-1); binary_seq_to_str(data, nbases, str); // Reverse complement, convert to string memcpy(tmp, data, TLEN); binary_seq_reverse_complement(tmp, nbases); binary_seq_to_str(tmp, nbases, rev); // Check strings match for(j = 0, k = nbases-1; j < nbases; j++, k--) TASSERT(str[j] == dna_char_complement(rev[k])); // Reverse complement again, check we get back same binary_seq+string binary_seq_reverse_complement(tmp, nbases); binary_seq_to_str(tmp, nbases, restore); TASSERT(memcmp(data, tmp, TLEN) == 0); TASSERT(strncmp(str, restore, nbases) == 0); } }
void resource_pool_t::waiter_wake() { while ( !static_list_is_empty(&_waiters) ) { int num_unreserved = _capacity - _reserved; void* waiter_node; int get_ret = static_list_get_head(&_waiters, &waiter_node); TASSERT(get_ret == 0); struct waiter_node_s* wn = (struct waiter_node_s*)waiter_node; if (num_unreserved < wn->req_reserve_count) /* Not enough resources to let this thread through... */ return; /* Hit another thread that can be allowed to pass. */ /* Remove thread from queue. Wake it. Update rpaphore count. */ int remove_ret = static_list_remove_head(&_waiters, &waiter_node, NULL); TASSERT(remove_ret == 0); wn = (struct waiter_node_s*)waiter_node; _reserved += wn->req_reserve_count; pthread_cond_signal(&wn->request_granted); } }
void vTraceCtor(APG_PARSER_CTX* spParserCtx){ if(!spParserCtx->vpTraceCtx){ apg_uint uiSize; APG_TRACE_CTX* spCtx = (APG_TRACE_CTX*)vpMemAlloc(spParserCtx->vpMemCtx, sizeof(APG_TRACE_CTX)); TASSERT(spCtx); memset((void*)spCtx, 0, sizeof(APG_TRACE_CTX)); spOut = stdout; spCtx->spParserCtx = spParserCtx; spCtx->uiRecordNumber = 0; spCtx->uiTreeDepth = 0; spCtx->uiTraceRootIndex = spParserCtx->uiRuleCount; spCtx->vpVecRecordStack = vpVecCtor(spParserCtx->vpMemCtx, sizeof(apg_uint), 1028); TASSERT(spCtx->vpVecRecordStack); uiSize = sizeof(apg_uint) * spParserCtx->uiRuleCount; spCtx->uipRules = (apg_uint*)vpMemAlloc(spParserCtx->vpMemCtx, uiSize); TASSERT(spCtx->uipRules); if(spParserCtx->uiUdtCount){ uiSize = sizeof(apg_uint) * spParserCtx->uiUdtCount; spCtx->uipUdts = (apg_uint*)vpMemAlloc(spParserCtx->vpMemCtx, uiSize); TASSERT(spCtx->uipUdts); } vEnableDefault(spCtx); spParserCtx->vpTraceCtx = (void*)spCtx; } }
void test_klist_index () { char * item_ptr; klist_get(l1, 0, (void **) &item_ptr); TASSERT(item_ptr == item1); klist_get(l1, 2, (void **) &item_ptr); TASSERT(item_ptr == item3); }
static void test_util_calc_N50() { test_status("Testing calc_N50()"); size_t arr[] = {1,2,3,4,5,6,7,8,9,10}; TASSERT(calc_N50(arr, 3, 6) == 3); TASSERT(calc_N50(arr, 4, 10) == 3); TASSERT(calc_N50(arr, 10, 55) == 8); }
static void test_util_rev_nibble_lookup() { test_status("Testing rev_nibble_lookup()"); size_t i; for(i = 0; i < 16; i++) { TASSERT(rev_nibble_lookup(i) == rev_nibble(i)); TASSERT(rev_nibble_lookup(rev_nibble_lookup(i)) == i); } }
static void _check_node_paths(const char *kmer, const char **path_strs, size_t npaths, size_t colour, const dBGraph *graph) { TASSERT(strlen(kmer) == graph->kmer_size); const GPath *paths[npaths]; // corresponding to path_strs memset(paths, 0, sizeof(paths)); size_t i, num_paths_seen = 0; const GPathStore *gpstore = &graph->gpstore; dBNode node = db_graph_find_str(graph, kmer); const GPath *path = gpath_store_fetch_traverse(gpstore, node.key); dBNodeBuffer nbuf; SizeBuffer jposbuf; db_node_buf_alloc(&nbuf, 64); size_buf_alloc(&jposbuf, 64); #define MAX_SEQ 128 char seq[MAX_SEQ]; for(; path != NULL; path = path->next) { if(path->orient == node.orient && gpath_has_colour(path, gpstore->gpset.ncols, colour)) { TASSERT(num_paths_seen < npaths); db_node_buf_reset(&nbuf); gpath_fetch(node, path, &nbuf, &jposbuf, colour, graph); if(nbuf.len > MAX_SEQ) die("Too many nodes. Cannot continue. %zu", nbuf.len); db_nodes_to_str(nbuf.b, nbuf.len, graph, seq); TASSERT(strlen(seq) == graph->kmer_size + nbuf.len - 1); for(i = 0; i < npaths; i++) { if(strcmp(path_strs[i],seq) == 0) { TASSERT(paths[i] == NULL, "Duplicate paths: %s", seq); paths[i] = path; break; } } TASSERT2(i < npaths, "Path not found: %s", seq); num_paths_seen++; } } TASSERT(num_paths_seen == npaths); for(i = 0; i < npaths; i++) { TASSERT2(paths[i] != NULL, "path not in graph: %s", path_strs[i]); } db_node_buf_dealloc(&nbuf); size_buf_dealloc(&jposbuf); }
static bool handshake(int fd) { TASSERT(write(fd, HANDSHAKE_COMMAND, sizeof(HANDSHAKE_COMMAND)) == sizeof(HANDSHAKE_COMMAND), "Unable to send HFP handshake."); char response[256] = { 0 }; size_t total = 0; while (!strstr(response, HANDSHAKE_RESPONSE) && total < sizeof(response)) { ssize_t len = read(fd, response + total, sizeof(response) - total); TASSERT(len != -1 && len != 0, "Unable to read complete response from socket."); total += len; } TASSERT(strstr(response, HANDSHAKE_RESPONSE) != NULL, "No valid response from HFP audio gateway."); return true; }
void _test_path_store(const dBGraph *graph) { size_t col; GraphPathPairing gp; gp_alloc(&gp, graph->num_of_cols); for(col = 0; col < graph->num_of_cols; col++) gp.ctxcols[col] = gp.ctpcols[col] = col; // Check data store TASSERT(path_store_integrity_check(&graph->pstore)); TASSERT(graph_paths_check_all_paths(&gp, graph)); gp_dealloc(&gp); }
static void _manual_test_pack_cpy_unpack(const char *seq, size_t len, size_t shift) { TASSERT(len >= shift); size_t i, nbytes = (len+3)/4, outlen = len - shift; Nucleotide bases[len], bases2[len]; uint8_t packed[nbytes], packed2[nbytes]; char seq2[len+1]; // convert to bases for(i = 0; i < len; i++) bases[i] = dna_char_to_nuc(seq[i]); // bases -> packed binary_seq_pack(packed, bases, len); // shift cpy binary_seq_cpy(packed2, packed, shift, len); // packed -> bases binary_seq_unpack(packed2, bases2, outlen); // convert to char for(i = 0; i < outlen; i++) seq2[i] = dna_nuc_to_char(bases2[i]); seq2[outlen] = '\0'; TASSERT2(strncmp(seq+shift, seq2, outlen) == 0, "in: %s\nout:%s\n", seq, seq2); }
// Add a function that can be used to transition from native code into lifted // code. // isCallback defaults to false llvm::Function *ArchAddEntryPointDriver(llvm::Module *M, const std::string &name, VA entry, bool isCallback) { //convert the VA into a string name of a function, try and look it up std::stringstream ss; ss << "sub_" << std::hex << entry; auto s = ss.str(); llvm::Function *F = M->getFunction(s); if (!F) { llvm::errs() << "Could not find lifted function " << s << " for entry point " << name; return nullptr; } auto &C = F->getContext(); auto W = M->getFunction(name); if (W) { return W; } auto VoidTy = llvm::Type::getVoidTy(C); auto WTy = llvm::FunctionType::get(VoidTy, false); W = llvm::Function::Create( WTy, llvm::GlobalValue::ExternalLinkage, name, M); W->addFnAttr(llvm::Attribute::NoInline); W->addFnAttr(llvm::Attribute::Naked); const auto Arch = SystemArch(M); const auto OS = SystemOS(M); if (llvm::Triple::Linux == OS) { if (_X86_64_ == Arch) { LinuxAddPushJumpStub(M, F, W, "__mcsema_attach_call"); } else { LinuxAddPushJumpStub(M, F, W, "__mcsema_attach_call_cdecl"); } } else if (llvm::Triple::Win32 == OS) { // if we are creating and entry point for a callback // then we need to decorate the function. // if we are creating an entry point specified via -entrypoint // then the name is pre-decorated, and we don't decorate twice if (_X86_64_ == Arch) { WindowsAddPushJumpStub(isCallback, M, F, W, "__mcsema_attach_call"); } else { WindowsAddPushJumpStub(isCallback, M, F, W, "__mcsema_attach_call_cdecl"); } } else { TASSERT(false, "Unsupported OS for entry point driver."); } F->setLinkage(llvm::GlobalValue::ExternalLinkage); if (F->doesNotReturn()) { W->setDoesNotReturn(); } return W; }
static THREAD_FUN __stdcall ThreadProc(LPVOID lpParam) { CThread * pThis = (CThread *)lpParam; TASSERT(pThis, "a null thread owner point"); pThis->Run(); _endthreadex(0); return 0; }
void vTrace(APG_PARSER_CTX* spParserCtx, APG_OPCODE* spOp, apg_uint uiAction, apg_uint uiId, apg_uint uiOffset, apg_uint uiPhraseLen){ APG_TRACE_CTX* spCtx = (APG_TRACE_CTX*)spParserCtx->vpTraceCtx; apg_uint uiState, uiStrLen; const apg_achar* acpPhrase; if(spParserCtx->vpTraceCtx){ if(uiPhraseLen == APG_UNDEFINED){uiState = NOMATCH;} else if(uiPhraseLen == 0){uiState = EMPTY;} else{uiState = MATCH;} uiStrLen = (uiOffset < spParserCtx->uiInputStringLen) ? spParserCtx->uiInputStringLen - uiOffset: 0; acpPhrase = spParserCtx->acpInputString + uiOffset; switch(uiAction){ case TRACE_ACTION_BEGIN: vTraceBegin(spCtx); break; case TRACE_ACTION_DOWN: vTraceDown(spCtx, spOp, uiId, uiOffset); break; case TRACE_ACTION_UP: vTraceUp(spCtx, spOp, uiId, uiOffset, uiPhraseLen); break; case TRACE_ACTION_END: vTraceEnd(spCtx, uiPhraseLen); break; default: TASSERT(APG_FALSE); break; } fflush(spOut); } }
void vTraceAdmin(APG_PARSER_CTX* spParserCtx, apg_uint uiAction, apg_uint uiId, apg_uint uiEnable, apg_uint* uipConfigured){ if(uipConfigured){*uipConfigured = APG_TRUE;} switch(uiAction){ case TRACE_ACTION_ENABLE: vTraceDtor(spParserCtx); vTraceCtor(spParserCtx); break; case TRACE_ACTION_DISABLE: vTraceDtor(spParserCtx); break; case TRACE_ACTION_OP: if(spParserCtx->vpTraceCtx){vTraceEnableOp((APG_TRACE_CTX*)spParserCtx->vpTraceCtx, uiId, uiEnable);} break; case TRACE_ACTION_RULE: if(spParserCtx->vpTraceCtx){vTraceEnableRule((APG_TRACE_CTX*)spParserCtx->vpTraceCtx, uiId, uiEnable);} break; case TRACE_ACTION_UDT: if(spParserCtx->vpTraceCtx){vTraceEnableUdt((APG_TRACE_CTX*)spParserCtx->vpTraceCtx, uiId, uiEnable);} break; case TRACE_ACTION_RANGE: if(spParserCtx->vpTraceCtx){vTraceSetRange((APG_TRACE_CTX*)spParserCtx->vpTraceCtx, uiId, uiEnable);} break; default: TASSERT(APG_FALSE); break; } }
static int get_parent_chunk_test(int verbose) { /* grab a large chunk indirectly. */ large_chunk_t* prev_lc = fsi.flat_storage_start; large_chunk_t* lc = prev_lc + 1; int i; V_LPRINTF(1, "%s\n", __FUNCTION__); /* we have to hack in the proper flags because we're not actually calling * the proper routines to allocate and break the large chunk. */ if (verbose == 2) { printf(" * before lc->flags = %d\n", lc->flags); } lc->flags |= (LARGE_CHUNK_USED | LARGE_CHUNK_BROKEN); lc->flags &= ~(LARGE_CHUNK_FREE); if (verbose == 2) { printf(" * after lc->flags = %d\n", lc->flags); } for (i = 0; i < SMALL_CHUNKS_PER_LARGE_CHUNK; i ++) { small_chunk_t* sc = &lc->lc_broken.lbc[i]; large_chunk_t* pc = get_parent_chunk(sc); TASSERT(pc == lc); } return 0; }
static void test_pack_unpack() { test_status("Testing binary_seq_pack() / binary_seq_unpack()"); uint8_t packed[TLEN]; Nucleotide bases0[TLEN], bases1[TLEN]; char str[8*TLEN+1]; size_t i, t, len; // Run NTESTS // randomize bases0, pack into packed, unpack into bases1 // compare bases0 vs bases1 for(t = 0; t < NTESTS; t++) { len = rand() % (TLEN/2+1); rand_nucs(bases0, len); memset(packed, 0, TLEN); binary_seq_pack(packed, bases0, len); binary_seq_unpack(packed, bases1, len); for(i = 0; i < len && bases0[i] == bases1[i]; i++); // print output if input != output if(i != len) { bitarr_tostr(packed, (len*2+7)/8, str); printf("bases0: "); print_nucs(bases0, len); printf("\n"); printf("bases1: "); print_nucs(bases1, len); printf("\n"); printf("packed: %s\n", str); } TASSERT(i == len); } }
void resource_pool_t::unreserve(int n) { /* error checking */ TASSERT(_reserved >= n); TRACE(TRACE_RESOURCE_POOL & TRACE_ALWAYS, "%s was %d:%d:%d\n", _name.data(), _capacity, _reserved, _non_idle); /* update the 'reserved' count */ _reserved -= n; TRACE(TRACE_RESOURCE_POOL & TRACE_ALWAYS, "%s now %d:%d:%d\n", _name.data(), _capacity, _reserved, _non_idle); waiter_wake(); TRACE(TRACE_RESOURCE_POOL & TRACE_ALWAYS, "%s after_waking %d:%d:%d\n", _name.data(), _capacity, _reserved, _non_idle); }
bool pan_enable() { int error; // PAN is enabled by default, wait for the first control state change // with default parameters set. We don't want to verify the result since // the implementation could have set any parameters. WAIT(pan_control_state_changed); // Call enable explicitly and verify that the parameters match what we just set. CALL_AND_WAIT(error = pan_interface->enable(local_role), pan_control_state_changed); TASSERT(error == BT_STATUS_SUCCESS, "Error enabling PAN: %d", error); TASSERT(pan_get_control_state() == BTPAN_STATE_ENABLED, "Control state is disabled."); TASSERT(pan_get_local_role() == local_role, "Unexpected local role: %d", pan_get_local_role()); TASSERT(pan_get_error() == BT_STATUS_SUCCESS, "Error in control callback: %d", pan_get_error()); return true; }
bool pan_disconnect() { int error; if (!pan_connect()) { return false; } CALL_AND_WAIT(error = pan_interface->disconnect(&bt_remote_bdaddr), pan_connection_state_changed); TASSERT(error == BT_STATUS_SUCCESS, "Error disconnecting from remote host: %d", error); TASSERT(pan_get_error() == BT_STATUS_SUCCESS, "Error disconnecting from BT device: %d", pan_get_error()); TASSERT(pan_get_connection_state() == BTPAN_STATE_DISCONNECTING, "Invalid PAN state after disconnect: %d", pan_get_connection_state()); WAIT(pan_connection_state_changed); TASSERT(pan_get_error() == BT_STATUS_SUCCESS, "Error disconnecting from BT device: %d", pan_get_error()); TASSERT(pan_get_connection_state() == BTPAN_STATE_DISCONNECTED, "Invalid PAN state after disconnect: %d", pan_get_connection_state()); return true; }
bool rfcomm_repeated_connect() { static const int max_iterations = 128; for (int i = 0; i < max_iterations; ++i) { TASSERT(rfcomm_connect(), "Connection failed on attempt %d/%d", i, max_iterations); } return true; }
void test_klist_iterator_remove() { char * item_ptr; struct klist_iter list_iter; kiter *iter = (kiter *)&list_iter; klist_iter_init(&list_iter, l1); kiter_next(iter, NULL); //go to first element. kiter_next(iter, NULL); //go to second. kiter_remove(iter, (void **) &item_ptr); TASSERT(item_ptr == item2); kiter_get(iter, (void **) &item_ptr); TASSERT(item_ptr == item3); klist_get(l1, 0, (void **) &item_ptr); TASSERT(item_ptr == item1); klist_get(l1, 1, (void **) &item_ptr); TASSERT(item_ptr == item3); }
static void pull_out_supernodes(const char **seq, const char **ans, size_t n, const dBGraph *graph) { dBNodeBuffer nbuf; db_node_buf_alloc(&nbuf, 1024); // 1. Check pulling out supernodes works for iterating over the graph uint64_t *visited; visited = ctx_calloc(roundup_bits2words64(graph->ht.capacity), 8); HASH_ITERATE(&graph->ht, supernode_from_kmer, &nbuf, visited, graph, ans, n); ctx_free(visited); // 2. Check pulling out supernodes works when we iterate over inputs size_t i, j, len; dBNode node; char tmpstr[SNODEBUF]; for(i = 0; i < n; i++) { len = strlen(seq[i]); for(j = 0; j+graph->kmer_size <= len; j++) { // Find node node = db_graph_find_str(graph, seq[i]+j); TASSERT(node.key != HASH_NOT_FOUND); // Fetch supernode db_node_buf_reset(&nbuf); supernode_find(node.key, &nbuf, graph); supernode_normalise(nbuf.b, nbuf.len, graph); // Compare TASSERT(nbuf.len < SNODEBUF); db_nodes_to_str(nbuf.b, nbuf.len, graph, tmpstr); if(strcmp(tmpstr, ans[i]) != 0) { test_status("Got: %s from ans[i]:%s\n", tmpstr, ans[i]); } TASSERT(strcmp(tmpstr, ans[i]) == 0); } } db_node_buf_dealloc(&nbuf); }
void resource_pool_t::notify_non_idle() { TASSERT(_non_idle < _reserved); _non_idle++; TRACE(TRACE_RESOURCE_POOL & TRACE_ALWAYS, "%s NON_IDLE %d:%d:%d\n", _name.data(), _capacity, _reserved, _non_idle); }
void test_klist_iterator() { int i=0; int d1 = 1; int d2 = 2; int *d; klist_reset(l1); klist_append(l1, &d1); klist_append(l1, &d2); struct klist_iter iter; klist_iter_init(&iter, l1); kiter_next(&iter, NULL); while (kiter_remove(&iter, &d) == 0) { i++; TASSERT(*d == i); } TASSERT(i == 2); }
static int slackspace_test(int verbose) { unsigned ksize, vsize; int ksizes[] = { sizeof( ((small_title_chunk_t*) 0)->data ) - 1, sizeof( ((small_title_chunk_t*) 0)->data ), sizeof( ((small_title_chunk_t*) 0)->data ) + 1, ( sizeof( ((small_title_chunk_t*) 0)->data ) ) + ( (SMALL_CHUNKS_PER_LARGE_CHUNK - 2) * sizeof( ((small_body_chunk_t*) 0)->data ) ) - 1, ( sizeof( ((small_title_chunk_t*) 0)->data ) ) + ( (SMALL_CHUNKS_PER_LARGE_CHUNK - 2) * sizeof( ((small_body_chunk_t*) 0)->data ) ), ( sizeof( ((small_title_chunk_t*) 0)->data ) ) + ( (SMALL_CHUNKS_PER_LARGE_CHUNK - 2) * sizeof( ((small_body_chunk_t*) 0)->data ) ), }; V_LPRINTF(1, "%s\n", __FUNCTION__); for (vsize = 0; vsize < 16 * 1024; vsize ++) { for (ksize = 0; ksize < (sizeof(ksizes) / sizeof(*ksizes)); ksize ++) { size_t slack = slackspace(ksizes[ksize], vsize); if (vsize % 1024 == 0) { V_PRINTF(2, "\r * allocating object value size=%u", vsize); V_FLUSH(2); } if (vsize == 0 && ksizes[ksize] == 0) { continue; } TASSERT( is_large_chunk(ksizes[ksize], vsize) == is_large_chunk(ksizes[ksize], vsize + slack) ); TASSERT( chunks_needed(ksizes[ksize], vsize) == chunks_needed(ksizes[ksize], vsize + slack) ); } } V_PRINTF(2, "\n"); return 0; }
GROUPSHDR CGroups::CGroups(const CGroups& other) { TASSERT(other.m_pGroups != null); try { m_pGroups = new GROUPVEC(*other.m_pGroups); } catch (std::exception &e) { TTHROW(e.what()); } }