void logfile_clear(logfile *log) { ght_iterator_t iterator; const void *p_key; void *p_e; for(p_e = ght_first(log->errortypes, &iterator, &p_key); p_e; p_e = ght_next(log->errortypes, &iterator, &p_key)) { logerror_destroy((logerror *)p_e); } ght_finalize(log->errortypes); ght_hash_table_t *map = ght_create(256); if (map == NULL) { free(log); exit(EXIT_FAILURE); } log->errortypes = map; log->errors = NULL; log->filtered_errors = NULL; log->worstNewLine = 0; log->worstNewType = 0; log->filtered_entries = 0; log->empty_entries = 0; }
int bansiteop(struct in_addr *from) { struct bansite *b; ght_iterator_t iterator; ght_hash_table_t *tmptable; void *key; static time_t last = 0; time_t now_t = time(NULL); FILE *fp; if (!bansitetable) bansitetable = ght_create(200); if (!bansitetable) return -1; if (from) { if ((b = ght_get(bansitetable, sizeof (*from), from))) { b->t = now_t; return 0; } b = malloc(sizeof (*b)); if (!b) return -1; b->t = time(NULL); b->from = *from; if (ght_insert(bansitetable, b, sizeof (*from), from) < 0) { free(b); return -1; } } if (!from && now_t - last < 100) return 0; fp = fopen(MY_BBS_HOME "/bbstmpfs/dynamic/bansite", "w"); if (!fp) return -1; last = now_t; tmptable = bansitetable; bansitetable = ght_create(200); if (!bansitetable) { bansitetable = tmptable; return -1; } for (b = ght_first(tmptable, &iterator, &key); b; b = ght_next(tmptable, &iterator, &key)) { if (b->t < now_t - 6000) { free(b); continue; } fprintf(fp, "%s\n", inet_ntoa(b->from)); if (ght_insert(bansitetable, b, sizeof (b->from), &b->from) < 0) { free(b); } } ght_finalize(tmptable); fclose(fp); return 0; }
void TextResource_free(TextResource tr) { ght_iterator_t iterator; const void *p_key; void *p_e; for (p_e = ght_first(tr->parameters, &iterator, &p_key); p_e; p_e = ght_next(tr->parameters, &iterator, &p_key)) { free(p_e); } ght_finalize(tr->parameters); for (p_e = ght_first(tr->strings, &iterator, &p_key); p_e; p_e = ght_next(tr->strings, &iterator, &p_key)) { free(p_e); } ght_finalize(tr->strings); free(tr); }
void logfile_close(logfile *log) { ght_iterator_t iterator; const void *p_key; void *p_e; for(p_e = ght_first(log->errortypes, &iterator, &p_key); p_e; p_e = ght_next(log->errortypes, &iterator, &p_key)) { logerror_destroy((logerror *)p_e); } ght_finalize(log->errortypes); if (log->file != NULL) { linereader_close(log->file); } destroyLogParser(log->logformat); free(log); }
struct boardmem * getbcache(char *board) { int i, j; static int num = 0; char upperstr[STRLEN]; static ght_hash_table_t *p_table = NULL; static time_t uptime = 0; struct boardmem *ptr; if (board[0] == 0) return NULL; if (p_table && (num != shm_bcache->number || shm_bcache->uptime > uptime)) { ght_finalize(p_table); p_table = NULL; } if (p_table == NULL) { num = 0; p_table = ght_create(MAXBOARD); for (i = 0; i < MAXBOARD && i < shm_bcache->number; i++) { num++; if (!shm_bcache->bcache[i].header.filename[0]) continue; strsncpy(upperstr, shm_bcache->bcache[i].header.filename, sizeof (upperstr)); for (j = 0; upperstr[j]; j++) upperstr[j] = toupper(upperstr[j]); ght_insert(p_table, &shm_bcache->bcache[i], j, upperstr); } uptime = now_t; } strsncpy(upperstr, board, sizeof (upperstr)); for (j = 0; upperstr[j]; j++) upperstr[j] = toupper(upperstr[j]); ptr = ght_get(p_table, j, upperstr); if (!ptr) return numboard(board); return ptr; }
int main(int argc, char *argv[]) { ght_hash_table_t *p_table; ght_iterator_t iterator; const void *p_key; int *p_data; /* Create a new hash table */ if ( !(p_table = ght_create(128)) ) { fprintf(stderr, "Could not create hash table!\n"); return 1; } /* Insert a number of entries */ insert_entry(p_table, 0, "zero"); insert_entry(p_table, 1, "one"); insert_entry(p_table, 2, "two"); insert_entry(p_table, 3, "three"); insert_entry(p_table, 4, "four"); insert_entry(p_table, 5, "five"); insert_entry(p_table, 6, "six"); insert_entry(p_table, 7, "seven"); insert_entry(p_table, 8, "eight"); for (p_data = (int*)ght_first(p_table, &iterator, &p_key); p_data; p_data = (int*)ght_next(p_table, &iterator, &p_key)) { /* Print out the entry */ printf("%s: \t%d\n", (char*)p_key, *p_data); /* Free the data (the meta-data will be removed in ght_finalize below) */ free(p_data); } /* Remove the hash table */ ght_finalize(p_table); return 0; }
/*! Empty Hash Table. */ void clear() { if (m_ht) { ght_finalize(m_ht); m_ht = nullptr; } }
/* * This is an example program that reads words from a text-file (a * book or something like that) and uses those as keys in a hash table * (the actual data stored is unimportant). The words are case * sensitive. * * After this, the program opens another text-file and tries to match * the words in that with the words stored in the table. * * The meaning with this program is to test the speed of the table and * to provide an example of its use. */ int main(int argc, char *argv[]) { FILE *p_file; char *p_dict_name; char *p_text_name; ght_hash_table_t *p_table; ght_iterator_t iterator; struct stat stat_struct; int i_found; int i_cnt; char *p_buf; char *p_tok; const void *p_key; void *p_e; /* Create a new hash table */ if ( !(p_table = ght_create(1000)) ) { return 1; } ght_set_rehash(p_table, TRUE); /* Parse the arguments */ if (argc < 3) { printf("Usage: dict_example [-m|-t|-b] dictfile textfile\n\n" "Reads words from `dictfile' and looks up these words in `textfile'.\n" "Options:\n" " -m Use move-to-front heuristics\n" " -t Use transpose heuristics\n" " -b Use bounded buckets (use the hash table as a cache)\n" ); return 0; } else if (argc > 3) { if(strcmp(argv[1], "-m") == 0) ght_set_heuristics(p_table, GHT_HEURISTICS_MOVE_TO_FRONT); else if(strcmp(argv[1], "-t") == 0) ght_set_heuristics(p_table, GHT_HEURISTICS_TRANSPOSE); else if (strcmp(argv[1], "-b") == 0) { /* Rehashing makes no sense in "cache" mode */ ght_set_rehash(p_table, FALSE); ght_set_bounded_buckets(p_table, 3, bucket_free_callback); } p_dict_name = argv[2]; p_text_name = argv[3]; } else { /* 2 arguments */ p_dict_name = argv[1]; p_text_name = argv[2]; } /* Open the dictionary file (first check its size) */ if (stat(p_dict_name, &stat_struct) < 0) { perror("stat"); return 1; } if (!(p_buf = (char*)malloc(stat_struct.st_size))) { perror("malloc"); return 1; } /* Open the dictionary file and read that into the buffer. */ if (! (p_file = fopen(p_dict_name, "r")) ) { perror("fopen"); return 1; } fread(p_buf, sizeof(char), stat_struct.st_size, p_file); fclose(p_file); /* For each word in the dictionary file, insert it into the hash table. */ p_tok = strtok(p_buf, DELIMS); i_cnt = 0; i_found = 0; while (p_tok) { int *p_data; if ( !(p_data = (int*)malloc(sizeof(int))) ) { perror("malloc"); return 1; } *p_data = i_cnt++; /* Insert the word into the table */ if (ght_insert(p_table, p_data, strlen(p_tok), p_tok) < 0) free(p_data); /* Could not insert the item (already exists), free it. */ else i_found++; p_tok = strtok(NULL, DELIMS); } printf("Done reading %d unique words from the wordlist.\n" "Total number of words is %d.\n\n", i_found, i_cnt); free(p_buf); /* Check the size of the text file. */ if (stat(p_text_name, &stat_struct) < 0) { perror("stat"); return 1; } if (!(p_buf = (char*)malloc(stat_struct.st_size))) { perror("malloc"); return 1; } /* Open the text file and read that into the buffer. */ if (! (p_file = fopen(p_text_name, "r")) ) { perror("fopen"); return 1; } fread(p_buf, sizeof(char), stat_struct.st_size, p_file); fclose(p_file); /* For each word in the text file, check if it exists in the hash table. */ p_tok = strtok(p_buf, DELIMS); i_cnt = 0; i_found = 0; while (p_tok) { printf(" searching %s ;", p_tok); if (ght_get(p_table, strlen(p_tok), p_tok)) { i_found++; } i_cnt++; p_tok = strtok(NULL, DELIMS); } free(p_buf); printf("Found %d words out of %d words\n", i_found, i_cnt); /* Free the entry data in the table */ for(p_e = ght_first(p_table, &iterator, &p_key); p_e; p_e = ght_next(p_table, &iterator, &p_key)) { free(p_e); } /* Free the table */ ght_finalize(p_table); return 0; }
int main(int argc,char *argv[]) { int rc; char *k, *v, *line, buf[BUFSIZ]; ght_hash_table_t *p_table=NULL; /* create hash table of size 256 */ p_table=ght_create(256); if (p_table == NULL) { print_it("Error: Could not create hash table\n"); return(1); } print_menu(); for (;;) { print_prompt(); line=fgets(buf,sizeof(buf)-1,stdin); if (line == NULL) break; switch(*line) { case 'i': { k=read_data("Enter key: "); v=read_data("Enter value: "); if (k && v) { /* insert to hash table */ rc=ght_insert(p_table, v, strlen(k), k); if (rc == 0) { print_it("Inserted: Key=%s, Value=%s\n", k,v); free(k); } else { print_it("Error: ght_insert() failed\n"); (void) free((char *) k); (void) free((char *) v); } } else { if (k) (void) free((char *) k); if (v) (void) free((char *) v); } break; } case 'r': /* replace */ { k=read_data("Enter key: "); v=read_data("Enter new value: "); if (k && v) { char * old_val; /* Replace a key in the hash table */ old_val = (char*)ght_replace(p_table, v, strlen(k), k); if (old_val != NULL) { print_it("Replaced: Key=%s, Old Value=%s, Value=%s\n", k,old_val, v); free(old_val); free(k); } else { print_it("Error: ght_replace() failed\n"); (void) free((char *) k); (void) free((char *) v); } } else { if (k) (void) free((char *) k); if (v) (void) free((char *) v); } break; } case 'h': { print_menu(); break; } case 'n': /* number of elements */ { print_it("Number elements in hash table: %d\n", ght_size(p_table)); break; } case 's': /* size of hash table */ { print_it("Hash table size: %d\n", ght_table_size(p_table)); break; } case 't': /* dump */ { const void *pk, *pv; ght_iterator_t iterator; for (pv=(char *) ght_first(p_table,&iterator, &pk); pv; pv=(char *) ght_next(p_table,&iterator, &pk)) { print_it("%s => %s\n",(char *) pk,(char *) pv); } break; } case 'd': { k=read_data("Enter key to delete: "); if (k) { v=ght_remove(p_table, strlen(k), k); if (v) { print_it("Removed %s => %s",k,v); (void) free((char *) v); } else { print_it("Error: could not find data for key %s\n", k); } (void) free((char *) k); } break; } case 'l': { k=read_data("Enter key: "); if (k) { v=(char *) ght_get(p_table,strlen(k),k); if (v) { print_it("Found: %s => %s\n",k,v); } else { print_it("No data found for key: %s\n",k); } (void) free((char *) k); } break; } case 'q': { if (p_table) { const void *pv, *pk; ght_iterator_t iterator; for (pv=(char *) ght_first(p_table,&iterator, &pk); pv; pv=(char *) ght_next(p_table,&iterator, &pk)) { (void) free((char *) pv); } ght_finalize(p_table); } return(0); break; } default: { print_it("Unknown option\n"); break; } } } return(0); }
/******************************************************* * WriteMmdModelMaterials関数 * * PMDとPMXのテクスチャ画像データを書き出す * * 引数 * * model : テクスチャ画像データを書き出すモデル * * out_data_size : 書き出したデータのバイト数格納先 * * 返り値 * * 書き出したデータ * *******************************************************/ uint8* WriteMmdModelMaterials( MODEL_INTERFACE* model, size_t* out_data_size ) { // 画像データをまとめて書き出すバッファ MEMORY_STREAM *stream = CreateMemoryStream(1024 * 1024); // 作成結果のストリーム MEMORY_STREAM result_stream = {0}; // 作成結果データ uint8 *result; // テクスチャ画像配列へのポインタ MATERIAL_INTERFACE **materials; // 画像データの格納先 uint8 *image_data = NULL; // 画像データ格納バッファのサイズ size_t image_data_buffer_size = 0; // UTF-8での画像ファイルへのパス char utf8_path[8192]; // OSでの画像ファイルへのパス char *system_path; // 画像ファイルの読み込み、ファイルサイズ、存在確認用 FILE *fp; // 画像ファイルの数 int num_images = 0; // テクスチャ画像配列のサイズ int num_materials; // 32ビット書き出し用 uint32 data32; // 画像データの開始位置 long image_start = sizeof(data32); // 画像データの合計サイズ long total_image_size = 0; int counter; // 書き出す画像ファイルの名前・サイズ配列 MATERIAL_ARCHIVE_DATA *names; // 重複書き出し防止用 ght_hash_table_t *name_table; unsigned int name_length; uint32 diff; // for文用のカウンタ int i; // モデルに設定されているテクスチャ画像を取得 materials = (MATERIAL_INTERFACE**)model->get_materials(model, &num_materials); name_table = ght_create(num_materials+1); ght_set_hash(name_table, (ght_fn_hash_t)GetStringHash); // それぞれの画像ファイルのファイル名サイズを取得 for(i=0; i<num_materials; i++) { MATERIAL_INTERFACE *material = materials[i]; if(material->main_texture != NULL) { name_length = (unsigned int)strlen(material->main_texture); if(ght_get(name_table, name_length, material->main_texture) == NULL) { (void)ght_insert(name_table, (void*)1, name_length, material->main_texture); image_start += (long)name_length+1; image_start += sizeof(uint32) + sizeof(uint32) + sizeof(uint32); num_images++; } } if(material->sphere_texture != NULL) { name_length = (unsigned int)strlen(material->sphere_texture); if(ght_get(name_table, name_length, material->sphere_texture) == NULL) { (void)ght_insert(name_table, (void*)1, name_length, material->sphere_texture); image_start += (long)name_length+1; image_start += sizeof(uint32) + sizeof(uint32) + sizeof(uint32); num_images++; } } if(material->toon_texture != NULL) { // トゥーンテクスチャの場合はモデルのディレクトリに画像があるか確認 (void)sprintf(utf8_path, "%s/%s", model->model_path, material->toon_texture); system_path = LocaleFromUTF8(utf8_path); if((fp = fopen(system_path, "rb")) != NULL) { // 画像有 name_length = (unsigned int)strlen(material->toon_texture); if(ght_get(name_table, name_length, material->toon_texture) == NULL) { (void)ght_insert(name_table, (void*)1, name_length, material->toon_texture); image_start += (long)name_length+1; image_start += sizeof(uint32) + sizeof(uint32) + sizeof(uint32); num_images++; (void)fclose(fp); } } MEM_FREE_FUNC(system_path); } } ght_finalize(name_table); // 画像ファイルを一つのデータにまとめる name_table = ght_create(num_materials+1); ght_set_hash(name_table, (ght_fn_hash_t)GetStringHash); names = (MATERIAL_ARCHIVE_DATA*)MEM_ALLOC_FUNC(sizeof(*names)*num_images); counter = 0; for(i=0; i<num_materials; i++) { MATERIAL_INTERFACE *material = materials[i]; if(material->main_texture != NULL) { name_length = (unsigned int)strlen(material->main_texture); if(ght_get(name_table, name_length, material->main_texture) == NULL) { (void)ght_insert(name_table, (void*)1, name_length, material->main_texture); names[counter].data_start = image_start + total_image_size; (void)sprintf(utf8_path, "%s/%s", model->model_path, material->main_texture); system_path = LocaleFromUTF8(utf8_path); if((fp = fopen(system_path, "rb")) != NULL) { (void)fseek(fp, 0, SEEK_END); names[counter].name = material->main_texture; names[counter].data_size = ftell(fp); names[counter].data_start = total_image_size + image_start; total_image_size += names[counter].data_size; rewind(fp); if(image_data_buffer_size < names[counter].data_size) { image_data = (uint8*)MEM_REALLOC_FUNC(image_data, names[counter].data_size); image_data_buffer_size = names[counter].data_size; } (void)fread(image_data, 1, names[counter].data_size, fp); (void)MemWrite(image_data, 1, names[counter].data_size, stream); counter++; (void)fclose(fp); } else { char sp_path[8192] = {0}; char *extention = sp_path; char *p = extention; (void)strcpy(sp_path, system_path); while(*p != '\0') { if(*p == '.') { extention = p; } p++; } extention[1] = 's'; extention[2] = 'p'; extention[3] = 'a'; extention[4] = '\0'; if((fp = fopen(sp_path, "rb")) != NULL) { (void)fseek(fp, 0, SEEK_END); names[counter].name = material->main_texture; names[counter].data_size = ftell(fp); names[counter].data_start = total_image_size + image_start; total_image_size += names[counter].data_size; rewind(fp); if(image_data_buffer_size < names[counter].data_size) { image_data = (uint8*)MEM_REALLOC_FUNC(image_data, names[counter].data_size); image_data_buffer_size = names[counter].data_size; } (void)fread(image_data, 1, names[counter].data_size, fp); (void)MemWrite(image_data, 1, names[counter].data_size, stream); counter++; (void)fclose(fp); } else { extention[3] = 'h'; if((fp = fopen(sp_path, "rb")) != NULL) { (void)fseek(fp, 0, SEEK_END); names[counter].name = material->main_texture; names[counter].data_size = ftell(fp); names[counter].data_start = total_image_size + image_start; total_image_size += names[counter].data_size; rewind(fp); if(image_data_buffer_size < names[counter].data_size) { image_data = (uint8*)MEM_REALLOC_FUNC(image_data, names[counter].data_size); image_data_buffer_size = names[counter].data_size; } (void)fread(image_data, 1, names[counter].data_size, fp); (void)MemWrite(image_data, 1, names[counter].data_size, stream); counter++; (void)fclose(fp); } } } MEM_FREE_FUNC(system_path); } } if(material->sphere_texture != NULL) { name_length = (unsigned int)strlen(material->sphere_texture); if(ght_get(name_table, name_length, material->sphere_texture) == NULL) { (void)ght_insert(name_table, (void*)1, name_length, material->sphere_texture); names[counter].data_start = image_start + total_image_size; (void)sprintf(utf8_path, "%s/%s", model->model_path, material->sphere_texture); system_path = LocaleFromUTF8(utf8_path); if((fp = fopen(system_path, "rb")) != NULL) { (void)fseek(fp, 0, SEEK_END); names[counter].name = material->sphere_texture; names[counter].data_size = ftell(fp); names[counter].data_start = total_image_size + image_start; total_image_size += names[counter].data_size; rewind(fp); if(image_data_buffer_size < names[counter].data_size) { image_data = (uint8*)MEM_REALLOC_FUNC(image_data, names[counter].data_size); image_data_buffer_size = names[counter].data_size; } (void)fread(image_data, 1, names[counter].data_size, fp); (void)MemWrite(image_data, 1, names[counter].data_size, stream); counter++; (void)fclose(fp); } MEM_FREE_FUNC(system_path); } } if(material->toon_texture != NULL) { // トゥーンテクスチャの場合はモデルのディレクトリに画像があるか確認 (void)sprintf(utf8_path, "%s/%s", model->model_path, material->toon_texture); system_path = LocaleFromUTF8(utf8_path); name_length = (unsigned int)strlen(material->toon_texture); if(ght_get(name_table, name_length, material->toon_texture) == NULL) { if((fp = fopen(system_path, "rb")) != NULL) { // 画像有 (void)ght_insert(name_table, (void*)1, name_length, material->toon_texture); (void)fseek(fp, 0, SEEK_END); names[counter].name = material->toon_texture; names[counter].data_size = ftell(fp); names[counter].data_start = total_image_size + image_start; total_image_size += names[counter].data_size; rewind(fp); if(image_data_buffer_size < names[counter].data_size) { image_data = (uint8*)MEM_REALLOC_FUNC(image_data, names[counter].data_size); image_data_buffer_size = names[counter].data_size; } (void)fread(image_data, 1, names[counter].data_size, fp); (void)MemWrite(image_data, 1, names[counter].data_size, stream); counter++; (void)fclose(fp); } } MEM_FREE_FUNC(system_path); } } num_images = counter; ght_finalize(name_table); result = (uint8*)MEM_ALLOC_FUNC(image_start + total_image_size + sizeof(uint32)); result_stream.buff_ptr = result; result_stream.data_size = image_start + total_image_size; result_stream.block_size = 1; data32 = num_images; (void)MemWrite(&data32, sizeof(data32), 1, &result_stream); for(i=0; i<num_images; i++) { data32 = (uint32)strlen(names[i].name)+1; (void)MemWrite(&data32, sizeof(data32), 1, &result_stream); (void)MemWrite(names[i].name, 1, data32, &result_stream); data32 = names[i].data_start; (void)MemWrite(&data32, sizeof(data32), 1, &result_stream); data32 = names[i].data_size; (void)MemWrite(&data32, sizeof(data32), 1, &result_stream); } if((diff = (uint32)(image_start - result_stream.data_point)) > 0) { (void)MemSeek(&result_stream, sizeof(data32), SEEK_SET); for(i=0; i<num_images; i++) { data32 = (uint32)strlen(names[i].name)+1; (void)MemWrite(&data32, sizeof(data32), 1, &result_stream); (void)MemWrite(names[i].name, 1, data32, &result_stream); data32 = names[i].data_start - diff; (void)MemWrite(&data32, sizeof(data32), 1, &result_stream); data32 = names[i].data_start - diff; (void)MemWrite(&data32, sizeof(data32), 1, &result_stream); } image_start -= diff; } (void)MemWrite(stream->buff_ptr, 1, stream->data_point, &result_stream); if(out_data_size != NULL) { *out_data_size = image_start + total_image_size; } MEM_FREE_FUNC(image_data); MEM_FREE_FUNC(names); MEM_FREE_FUNC(materials); (void)DeleteMemoryStream(stream); return result; }
int main() { struct CLElemQMHS4 cLElemQMHS4; double* VecSig = 0; double* VecStr = 0; double* VecDsig = 0; double* VecDstr = 0; double* InvF = 0; double* InvFT = 0; double* G = 0; double* P11q = 0; double* P22 = 0; double* P21 = 0; double* T3 = 0; double* Fe1q = 0; double* Fe2 = 0; double* Fs = 0; double* ppu = 0; double* lBase = 0; double* XG = 0; size_t* nrOfOrder = 0; ght_hash_table_t* icoShellSections = 0; //new std::map<const char*, icoSSData* > ght_hash_table_t* elsets = 0; //new std::map<const char*, int* >; ght_hash_table_t* issSizes = 0; ght_hash_table_t* elsetSizes = 0; ght_hash_table_t* matMap = 0; constructCLElemQMHS4(&cLElemQMHS4); // set up path to files char path[256]; #ifdef WIN32 sprintf(path, "C:/Users/klois/uni/OpenCore/save/"); #else sprintf(path, "/home/klaus/dpsnfs/save/"); #endif char filenameAddition[128]; sprintf(filenameAddition, "before-1-0.5-"); printf("Reading input data from files\n"); size_t elements = setAll(path, filenameAddition, &VecSig, &VecStr, &VecDsig, &VecDstr, &InvF, &InvFT, &G, &P11q, &P22, &P21, &T3, &Fe1q, &Fe2, &Fs, &ppu, &lBase, &XG, &nrOfOrder, &icoShellSections, &elsets, &issSizes, &elsetSizes, &matMap, &cLElemQMHS4); double* Kt = (double*)malloc(24 * 24 * elements * sizeof(double)); double* fin = (double*)malloc(24 * elements * sizeof(double)); int* elementsIntex = (int*)malloc(elements * sizeof(int)); int* numDOFperIndex = (int*)malloc(elements * sizeof(int)); printf("Calling initCalcQMHS4firstTime\n"); if(initCalcQMHS4firstTime(&cLElemQMHS4, 1024, 1) != 0) { printf("initCalcQMHS4firstTime FAILED!\n"); return -1; } printf("Calling calcQMHS4\n"); if(calcQMHS4(&cLElemQMHS4, Kt, fin, elementsIntex, numDOFperIndex)) { printf("calcQMHS4 FAILED!\n"); return -1; } printf("Checking result\n"); // sprintf(path, "/home/klaus/dpsnfs/save/"); sprintf(filenameAddition, "after-1-0.5-"); if(checkResult(path, filenameAddition, VecSig, VecStr, VecDsig, VecDstr, InvF, InvFT, G, P11q, P22, P21, T3, Fe1q, Fe2, Fs, elements) == 0) printf("\tResult is correct\n"); printf("Writing output files\n"); // sprintf(path, "/home/klaus/dpsnfs/save/gc/"); sprintf(filenameAddition, "gc/c-"); saveAll(path, filenameAddition, VecSig, VecStr, VecDsig, VecDstr, InvF, InvFT, G, P11q, P22, P21, T3, Fe1q, Fe2, Fs, elements, 1088); destructCLElemQMHS4(&cLElemQMHS4); free( VecSig ); free( VecStr ); free( VecDsig ); free( VecDstr ); free( InvF ); free( InvFT ); free( G ); free( P11q ); free( P22 ); free( P21 ); free( T3 ); free( Fe1q ); free( Fe2 ); free( Fs ); free( ppu ); free( lBase ); free( XG ); free( nrOfOrder ); free(Kt); free(fin); free(elementsIntex); free(numDOFperIndex); // take care of correctly removing double pointers void* tmpPtr = 0; void* tmpKey = 0; ght_iterator_t iterator; for(tmpPtr = ght_first(elsets, &iterator, (const void**)&tmpKey); tmpPtr; tmpPtr = ght_next(elsets, &iterator, (const void**)&tmpKey)) { free(*(int**)tmpPtr); free(tmpPtr); } ght_finalize(icoShellSections); ght_finalize(elsets); ght_finalize(issSizes); ght_finalize(elsetSizes); ght_finalize(matMap); return 0; }