Changeset 5725
- Timestamp:
- 09/01/09 23:34:50 (3 years ago)
- Location:
- trunk
- Files:
-
- 124 modified
-
ALIV3/a3_arbdb.cxx (modified) (1 diff)
-
ARBDB/adTest.c (modified) (3 diffs)
-
ARBDB/ad_config.c (modified) (2 diffs)
-
ARBDB/ad_core.c (modified) (6 diffs)
-
ARBDB/ad_load.c (modified) (4 diffs)
-
ARBDB/ad_prot.h (modified) (2 diffs)
-
ARBDB/ad_save_load.c (modified) (10 diffs)
-
ARBDB/adcomm.c (modified) (4 diffs)
-
ARBDB/adhash.c (modified) (4 diffs)
-
ARBDB/adindex.c (modified) (1 diff)
-
ARBDB/adlang1.c (modified) (4 diffs)
-
ARBDB/adlmacros.h (modified) (8 diffs)
-
ARBDB/admalloc.c (modified) (3 diffs)
-
ARBDB/admap.c (modified) (7 diffs)
-
ARBDB/admath.c (modified) (1 diff)
-
ARBDB/adoptimize.c (modified) (3 diffs)
-
ARBDB/adquery.c (modified) (2 diffs)
-
ARBDB/adseqcompr.c (modified) (5 diffs)
-
ARBDB/adsocket.c (modified) (8 diffs)
-
ARBDB/adstring.c (modified) (28 diffs)
-
ARBDB/adsystem.c (modified) (1 diff)
-
ARBDB/adtcp.c (modified) (8 diffs)
-
ARBDB/adtools.c (modified) (15 diffs)
-
ARBDB/arbdb.c (modified) (7 diffs)
-
ARBDB/arbdb_base.h (modified) (1 diff)
-
ARB_GDE/GDE_arbdb_io.cxx (modified) (1 diff)
-
ARB_GDE/GDE_event.cxx (modified) (8 diffs)
-
AWT/AWT_advice.cxx (modified) (1 diff)
-
AWT/AWT_asciiprint.cxx (modified) (1 diff)
-
AWT/AWT_config_manager.cxx (modified) (1 diff)
-
AWT/AWT_db_browser.cxx (modified) (1 diff)
-
AWT/AWT_dtree.cxx (modified) (2 diffs)
-
AWT/AWT_file_selection.cxx (modified) (6 diffs)
-
AWT/AWT_filter.cxx (modified) (1 diff)
-
AWT/AWT_imp_exp.cxx (modified) (5 diffs)
-
AWT/AWT_nds.cxx (modified) (3 diffs)
-
AWT/AWT_nei.cxx (modified) (1 diff)
-
AWT/AWT_pro_a_nucs.cxx (modified) (1 diff)
-
AWT/AWT_query_and_functions.cxx (modified) (6 diffs)
-
AWT/AWT_sel_boxes.cxx (modified) (1 diff)
-
AWT/AWT_seq_colors.cxx (modified) (1 diff)
-
AWT/AWT_tree.cxx (modified) (1 diff)
-
AWTC/AWTC_ClustalV.cxx (modified) (2 diffs)
-
AWTC/AWTC_constructSequence.cxx (modified) (2 diffs)
-
AWTC/AWTC_fast_aligner.cxx (modified) (5 diffs)
-
AWTI/AWTI_export.cxx (modified) (6 diffs)
-
AWTI/AWTI_import.cxx (modified) (1 diff)
-
CONSENSUS_TREE/CT_ntree.cxx (modified) (1 diff)
-
DIST/DI_matr.cxx (modified) (2 diffs)
-
EDIT4/ED4_base.cxx (modified) (1 diff)
-
EDIT4/ED4_cursor.cxx (modified) (2 diffs)
-
EDIT4/ED4_edit_string.cxx (modified) (3 diffs)
-
EDIT4/ED4_main.cxx (modified) (2 diffs)
-
EDIT4/ED4_members.cxx (modified) (1 diff)
-
EDIT4/ED4_no_class.cxx (modified) (7 diffs)
-
EDIT4/ED4_protein_2nd_structure.cxx (modified) (1 diff)
-
EDIT4/ED4_root.cxx (modified) (1 diff)
-
EDIT4/ED4_search.cxx (modified) (3 diffs)
-
EDIT4/ED4_text_terminals.cxx (modified) (2 diffs)
-
GENOM/EXP_interface.cxx (modified) (3 diffs)
-
GENOM/GEN_interface.cxx (modified) (3 diffs)
-
GENOM/GEN_map.cxx (modified) (2 diffs)
-
GENOM/GEN_nds.cxx (modified) (2 diffs)
-
MERGE/MG_gene_species.cxx (modified) (7 diffs)
-
MERGE/MG_preserves.cxx (modified) (1 diff)
-
MERGE/MG_species.cxx (modified) (4 diffs)
-
MULTI_PROBE/MP_Window.cxx (modified) (1 diff)
-
MULTI_PROBE/MP_probe.cxx (modified) (2 diffs)
-
MULTI_PROBE/MP_sonde.cxx (modified) (1 diff)
-
NALIGNER/ali_main.cxx (modified) (3 diffs)
-
NALIGNER/ali_pathmap.cxx (modified) (1 diff)
-
NAMES/names.cxx (modified) (5 diffs)
-
NTREE/AP_cprofile.cxx (modified) (3 diffs)
-
NTREE/AP_csp_2_gnuplot.cxx (modified) (6 diffs)
-
NTREE/AP_pos_var_pars.cxx (modified) (1 diff)
-
NTREE/NT_concatenate.cxx (modified) (3 diffs)
-
NTREE/NT_extern.cxx (modified) (1 diff)
-
NTREE/NT_main.cxx (modified) (2 diffs)
-
PARSIMONY/AP_tree_edge.cxx (modified) (1 diff)
-
PGT/config_dialog.cxx (modified) (1 diff)
-
PGT/dialog.cxx (modified) (1 diff)
-
PGT/image_dialog.cxx (modified) (1 diff)
-
PGT/import_dialog.cxx (modified) (1 diff)
-
PGT/main_dialog.cxx (modified) (1 diff)
-
PHYLO/PH_data.cxx (modified) (1 diff)
-
PHYLO/PH_main.cxx (modified) (1 diff)
-
PRIMER_DESIGN/primer_design.cxx (modified) (1 diff)
-
PROBE/PT_etc.cxx (modified) (2 diffs)
-
PROBE/PT_io.cxx (modified) (1 diff)
-
PROBE/PT_match.cxx (modified) (5 diffs)
-
PROBE_DESIGN/SaiProbeVisualization.hxx (modified) (1 diff)
-
PROBE_DESIGN/probe_design.cxx (modified) (5 diffs)
-
PROBE_SERVER/PROBE_GROUP/pg_main.cxx (modified) (3 diffs)
-
PROBE_SERVER/PROBE_GROUP/pg_search.cxx (modified) (5 diffs)
-
PROBE_SERVER/PROBE_GROUP_DESIGN/pgd_main.cxx (modified) (6 diffs)
-
SECEDIT/SEC_abspos.cxx (modified) (3 diffs)
-
SECEDIT/SEC_graphic.cxx (modified) (1 diff)
-
SECEDIT/SEC_paint.cxx (modified) (1 diff)
-
SERVERCNTRL/servercntrl.c (modified) (1 diff)
-
SL/AW_NAME/AW_names_admin.cxx (modified) (1 diff)
-
SL/AW_NAME/AW_rename.cxx (modified) (2 diffs)
-
SL/HELIX/BI_helix.hxx (modified) (1 diff)
-
TOOLS/arb_export_rates.cxx (modified) (2 diffs)
-
TOOLS/arb_gene_probe.cxx (modified) (1 diff)
-
TOOLS/arb_proto_2_xsub.cxx (modified) (2 diffs)
-
TOOLS/arb_read_tree.cxx (modified) (1 diff)
-
TRS/tree_lib.cxx (modified) (1 diff)
-
WINDOW/AW_at.cxx (modified) (2 diffs)
-
WINDOW/AW_button.cxx (modified) (3 diffs)
-
WINDOW/AW_nawar.cxx (modified) (2 diffs)
-
WINDOW/AW_preset.cxx (modified) (2 diffs)
-
WINDOW/AW_question.cxx (modified) (1 diff)
-
WINDOW/AW_status.cxx (modified) (16 diffs)
-
WINDOW/AW_window.cxx (modified) (12 diffs)
-
WINDOW/AW_xfont.cxx (modified) (1 diff)
-
ptpan/PT_buildtree.cxx (modified) (4 diffs)
-
ptpan/PT_cachehandler.cxx (modified) (2 diffs)
-
ptpan/PT_etc.cxx (modified) (1 diff)
-
ptpan/PT_findEx.cxx (modified) (3 diffs)
-
ptpan/PT_hashing.cxx (modified) (1 diff)
-
ptpan/PT_io.cxx (modified) (6 diffs)
-
ptpan/PT_new_design.cxx (modified) (3 diffs)
-
ptpan/PT_treepack.cxx (modified) (4 diffs)
-
ptpan/pt_prototypes.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ALIV3/a3_arbdb.cxx
r5340 r5725 47 47 { 48 48 GB_exit(gb_main); 49 50 if (alignment) free(alignment); 51 alignment = 0; 49 freeset(alignment, 0); 52 50 } 53 51 -
trunk/ARBDB/adTest.c
r5665 r5725 162 162 case GB_DB: { type_name = "GB_DB"; break; } 163 163 default: { 164 static char *unknownType; 165 if (unknownType) free(unknownType); 166 unknownType = strdup(GBS_global_string("<unknown GB_TYPE=%i>", type)); 167 type_name = unknownType; 164 static char *unknownType = 0; 165 freeset(unknownType, GBS_global_string_copy("<unknown GB_TYPE=%i>", type)); 166 type_name = unknownType; 168 167 break; 169 168 } … … 177 176 178 177 if (gb_father) { 179 static char *result; 180 char *father_path = strdup(GB_get_db_path(gb_father)); 181 int key_quark = GB_KEY_QUARK(gbd); 182 183 if (result) { 184 free(result); 185 result = 0; 186 } 187 188 if (key_quark == 0) { // illegal 189 result = strdup(GBS_global_string("%s/<illegal quark=0>", father_path)); 190 } 191 else { 192 const char *key = GB_KEY(gbd); 193 result = strdup(GBS_global_string("%s/%s", father_path, key)); 194 } 195 178 char *father_path = strdup(GB_get_db_path(gb_father)); 179 int key_quark = GB_KEY_QUARK(gbd); 180 181 static char *result; // careful! used recursively 182 freeset(result, GBS_global_string_copy("%s/%s", father_path, key_quark ? GB_KEY(gbd) : "<illegal quark=0>")); 183 free(father_path); 184 196 185 return result; 197 186 } … … 336 325 if (!lines_allowed || (*lines_allowed)>0) { 337 326 printf("%*s Showing %s:\n", indent, "", whatto_show_later); 338 free (whatto_show_later); whatto_show_later = 0;327 freeset(whatto_show_later, NULL); 339 328 ++indent; 340 329 GB_dump_internal(gb_show_later, lines_allowed); -
trunk/ARBDB/ad_config.c
r5708 r5725 156 156 GBT_config_parser *parser = GB_calloc(1, sizeof(*parser)); 157 157 158 parser->config_string = GB_strdup(config_string);158 parser->config_string = nulldup(config_string); 159 159 parser->parse_pos = 0; 160 160 … … 181 181 int pos = parser->parse_pos; 182 182 183 free(item->name); 184 item->name = 0; 183 freeset(item->name, NULL); 185 184 item->type = CI_END_OF_CONFIG; 186 185 -
trunk/ARBDB/ad_core.c
r5708 r5725 243 243 244 244 Main = (struct gb_main_type *)gbm_get_mem(sizeof(struct gb_main_type),0); 245 if (path) Main->path = GB_STRDUP((char*)path);245 if (path) Main->path = strdup((char*)path); 246 246 Main->key_2_index_hash = GBS_create_hash(20000, GB_MIND_CASE); 247 247 Main->compression_mask = -1; /* allow all compressions */ … … 320 320 case GB_STRING_SHRT: type = GB_STRING; 321 321 case GB_STRING: 322 if (!buffer) buffer = GB_STRDUP("1234");322 if (!buffer) buffer = strdup("1234"); 323 323 p = buffer; 324 324 while ( !(++(*p) )) { (*p)++;p++; if (!(*p)) break; } … … 505 505 else 506 506 { 507 GB_MEMCPY(&(ts->info), &(gbd->info), sizeof(gbd->info));507 memcpy(&(ts->info), &(gbd->info), sizeof(gbd->info)); 508 508 } 509 509 … … 562 562 else 563 563 { 564 GB_MEMCPY(&(gbd->info), &(old->info),sizeof(old->info));564 memcpy(&(gbd->info), &(old->info),sizeof(old->info)); 565 565 } 566 566 gb_del_ref_and_extern_gb_transaction_save(old); … … 688 688 689 689 if (s){ 690 Main->keys[index].key = GB_STRDUP(s);690 Main->keys[index].key = strdup(s); 691 691 GBS_write_hash(Main->key_2_index_hash,s,index); 692 692 if (Main->gb_key_data && create_gb_key){ … … 709 709 for (index = 1; index < Main->keycnt; index++) { 710 710 if (Main->keys[index].key){ 711 GBS_write_hash(Main->key_2_index_hash,Main->keys[index].key,0); 712 free(Main->keys[index].key); 713 } 714 Main->keys[index].key = 0; 711 GBS_write_hash(Main->key_2_index_hash, Main->keys[index].key, 0); 712 freeset(Main->keys[index].key, 0); 713 } 715 714 Main->keys[index].nref = 0; 716 715 Main->keys[index].next_free_key = 0; -
trunk/ARBDB/ad_load.c
r5708 r5725 357 357 358 358 for (i=Main->last_updated; i<=lu; ++i) { 359 Main->dates[i] = GB_STRDUP("unknown date");359 Main->dates[i] = strdup("unknown date"); 360 360 Main->last_updated = lu+1; 361 361 } … … 1144 1144 *(p++) = c; 1145 1145 } 1146 *p =0;1146 *p = 0; 1147 1147 if (p == buffer) break; 1148 if (Main->dates[j]) free(Main->dates[j]); 1149 Main->dates[j] = GB_STRDUP(buffer); 1148 freedup(Main->dates[j], buffer); 1150 1149 } 1151 1150 if (j>=255) { … … 1387 1386 if (strchr(opent,'R')) ignoreMissingMaster = 1; 1388 1387 }else { 1389 char *base = GB_STRDUP(path);1388 char *base = strdup(path); 1390 1389 char *ext = gb_findExtension(base); 1391 1390 { … … 1493 1492 fprintf(stderr, "Using properties from %s\n", found_path); 1494 1493 #endif /* DEBUG */ 1495 free(path); 1496 path = found_path; 1494 freeset(path, found_path); 1497 1495 input = fopen(path, "rb"); 1498 1496 } -
trunk/ARBDB/ad_prot.h
r5711 r5725 205 205 int GB_testlocal P_((GBDATA *gbd)); 206 206 int GB_nsons P_((GBDATA *gbd)); 207 GB_ERRORGB_disable_quicksave P_((GBDATA *gbd, const char *reason));207 void GB_disable_quicksave P_((GBDATA *gbd, const char *reason)); 208 208 GB_ERROR GB_resort_data_base P_((GBDATA *gb_main, GBDATA **new_order_list, long listsize)); 209 209 GB_ERROR GB_resort_system_folder_to_top P_((GBDATA *gb_main)); … … 393 393 /* admalloc.c */ 394 394 NOT4PERL void *GB_calloc P_((unsigned int nelem, unsigned int elsize)); 395 char *GB_deprStrdup P_((const char *p)) __ATTR__DEPRECATED; 395 396 char *GB_strdup P_((const char *p)); 396 397 char *GB_strduplen P_((const char *p, unsigned len)); -
trunk/ARBDB/ad_save_load.c
r5698 r5725 230 230 if (i!=j) /* otherwise the filename is correct */ 231 231 { 232 char *qdup = GB_STRDUP((char *)qsave);233 GB_CSTR qnew = gb_quicksaveName(path,j);232 char *qdup = strdup(qsave); 233 GB_CSTR qnew = gb_quicksaveName(path,j); 234 234 235 235 GB_rename_file(qdup,qnew); … … 873 873 if (path && strchr(savetype, 'S') == 0) // 'S' dumps to stdout -> do not change path 874 874 { 875 free(GB_MAIN(gb)->path); 876 GB_MAIN(gb)->path = GB_STRDUP(path); 875 freedup(GB_MAIN(gb)->path, path); 877 876 } 878 877 return GB_save_as(gb,path,savetype); … … 968 967 if (gb_check_saveable(gb,path,savetype)) goto error; 969 968 970 sec_path = GB_STRDUP(gb_overwriteName(path));969 sec_path = strdup(gb_overwriteName(path)); 971 970 972 971 if (strchr(savetype,'S')) { … … 1001 1000 fprintf(out,"/*ARBDB ASCII*/\n"); 1002 1001 erg = gb_write_rek(out,(GBCONTAINER *)gb,0,1); 1003 if (erg==0) 1004 { 1005 if (Main->qs.quick_save_disabled) free(Main->qs.quick_save_disabled); 1006 Main->qs.quick_save_disabled = strdup("Database saved in ASCII mode"); 1002 if (erg==0) { 1003 freedup(Main->qs.quick_save_disabled, "Database saved in ASCII mode"); 1007 1004 if (deleteQuickAllowed && gb_remove_all_but_main(Main,path)) goto error; 1008 1005 } … … 1028 1025 if (erg==0){ 1029 1026 if (!strchr(savetype,'f')){ /* allow quick saving unless saved in 'f' mode */ 1030 if (Main->qs.quick_save_disabled) free(Main->qs.quick_save_disabled); 1031 Main->qs.quick_save_disabled = 0; /* and allow quicksaving */ 1027 freeset(Main->qs.quick_save_disabled, NULL); /* delete reason, why quicksaving is disallowed */ 1032 1028 } 1033 1029 if (deleteQuickAllowed && gb_remove_quick_saved(Main,path)) goto error; … … 1072 1068 } 1073 1069 } 1074 free (sec_path);sec_path = 0;1070 freeset(sec_path, NULL); 1075 1071 if (!strchr(savetype,'f')){ /* reset values unless out of order save */ 1076 1072 Main->last_saved_transaction = GB_read_clock(gb); … … 1144 1140 org_master = GB_follow_unix_link(Main->path); 1145 1141 }else{ 1146 org_master = GB_STRDUP(Main->path);1142 org_master = strdup(Main->path); 1147 1143 } 1148 1144 … … 1169 1165 full_path_of_source = gb_full_path(org_master); 1170 1166 }else{ 1171 full_path_of_source = GB_STRDUP(org_master);1167 full_path_of_source = strdup(org_master); 1172 1168 } 1173 1169 … … 1189 1185 } 1190 1186 1191 free(Main->path); /* Symlink created -> rename allowed */ 1192 Main->path = GB_STRDUP(path); 1187 freedup(Main->path, path); /* Symlink created -> rename allowed */ 1193 1188 1194 1189 free(full_path_of_source); … … 1284 1279 const char *cwd; 1285 1280 char *res; 1286 if (path[0] == '/') return GB_STRDUP(path);1281 if (path[0] == '/') return strdup(path); 1287 1282 1288 1283 cwd = GB_getcwd(); 1289 1284 1290 if (path[0] == 0) return GB_STRDUP(cwd);1291 res = GB _STRDUP(GBS_global_string("%s/%s",cwd,path));1285 if (path[0] == 0) return strdup(cwd); 1286 res = GBS_global_string_copy("%s/%s",cwd,path); 1292 1287 1293 1288 return res; -
trunk/ARBDB/adcomm.c
r5708 r5725 84 84 85 85 void g_bcms_delete_Socinf(struct Socinf *THIS){ 86 if (THIS->username) free(THIS->username); 87 THIS->username = NULL; 86 freeset(THIS->username, NULL); 88 87 THIS->next = 0; 89 free ((char *)THIS);88 free(THIS); 90 89 } 91 90 … … 228 227 if (hs->unix_name){ 229 228 unlink(hs->unix_name); 230 free(hs->unix_name); 231 hs->unix_name = 0; 229 freeset(hs->unix_name, NULL); 232 230 } 233 231 close(hs->hso); 234 free ((char *)Main->server_data);235 Main->server_data = 0; 232 freeset(Main->server_data, NULL); 233 236 234 return 0; 237 235 } … … 2015 2013 if (Main->users[i]) continue; 2016 2014 Main->users[i] = (struct gb_user_struct *) GB_calloc(sizeof(struct gb_user_struct),1); 2017 Main->users[i]->username = GB_STRDUP(user);2015 Main->users[i]->username = strdup(user); 2018 2016 Main->users[i]->userid = i; 2019 2017 Main->users[i]->userbit = 1<<i; … … 2057 2055 if (Main->users[i]->nusers<=0) {/* kill user and his projects */ 2058 2056 free(Main->users[i]->username); 2059 free((char *)Main->users[i]); 2060 Main->users[i] = 0; 2057 freeset(Main->users[i], NULL); 2061 2058 fprintf(stdout,"The User %s has logged out\n",user); 2062 2059 } -
trunk/ARBDB/adhash.c
r5690 r5725 437 437 e = (struct gbs_hash_entry *)gbm_get_mem(sizeof(struct gbs_hash_entry),GBM_HASH_INDEX); 438 438 e->next = hs->entries[i]; 439 e->key = copyKey ? GB_STRDUP(key) : key;439 e->key = copyKey ? strdup(key) : key; 440 440 e->val = val; 441 441 … … 473 473 e = (struct gbs_hash_entry *)gbm_get_mem(sizeof(struct gbs_hash_entry),GBM_HASH_INDEX); 474 474 e->next = hs->entries[i]; 475 e->key = (char *)GB_STRDUP(key);475 e->key = strdup(key); 476 476 e->val = 1; 477 477 … … 964 964 /* check validity */ 965 965 if (GB_GET_EXT_UPDATE_DATE(gbd) > cs->entries[i].clock) { 966 free( cs->entries[i].data) ; 967 cs->entries[i].data = 0; 966 freeset(cs->entries[i].data, NULL); 968 967 cs->sum_data_size -= cs->entries[i].sizeof_data; 969 968 … … 1000 999 1001 1000 /* free cache */ 1002 free( cs->entries[i].data) ; 1003 cs->entries[i].data = 0; 1001 freeset(cs->entries[i].data, NULL); 1004 1002 cs->sum_data_size -= cs->entries[i].sizeof_data; 1005 1003 -
trunk/ARBDB/adindex.c
r5625 r5725 367 367 gbd->flags2.extern_data = ue->d.ts->flags2.extern_data; 368 368 369 GB_MEMCPY(&gbd->info,&ue->d.ts->info,sizeof(gbd->info)); /* restore old information */369 memcpy(&gbd->info,&ue->d.ts->info,sizeof(gbd->info)); /* restore old information */ 370 370 if (type >= GB_BITS) { 371 371 if (gbd->flags2.extern_data){ -
trunk/ARBDB/adlang1.c
r5695 r5725 158 158 GBS_strcat(str,"\n"); 159 159 } 160 GB_DELETE(params);160 freeset(params, NULL); 161 161 res = GBS_strclose(str); 162 162 err = GB_export_error("Unknown Parameter '%s' in command '%s'\n\tPARAMETERS:\n%s",argv[i].str,com,res); … … 175 175 static char *unEscapeString(const char *escapedString) { 176 176 /* replaces all \x by x */ 177 char *result = GB_strdup(escapedString);177 char *result = nulldup(escapedString); 178 178 char *to = result; 179 179 char *from = result; … … 1763 1763 else { 1764 1764 static char *parent = 0; 1765 if (parent) free(parent);1766 parent = get_taxonomy_string(tax_hash, parent_group, depth, error);1767 result = parent;1765 1766 freeset(parent, get_taxonomy_string(tax_hash, parent_group, depth, error)); 1767 result = parent; 1768 1768 } 1769 1769 } … … 1785 1785 1786 1786 if (found) { 1787 static char *full_group = 0; 1787 1788 const char *group_id = (const char *)found; 1788 static char *full_group = 0; 1789 if (full_group) free(full_group); 1790 full_group = get_taxonomy_string(tax_hash, group_id, depth, error); 1791 result = full_group; 1789 1790 freeset(full_group, get_taxonomy_string(tax_hash, group_id, depth, error)); 1791 result = full_group; 1792 1792 } 1793 1793 else { -
trunk/ARBDB/adlmacros.h
r5708 r5725 3 3 #define A_TO_I(c) if(c>'9') c-='A'-10; else c-='0'; 4 4 5 # define GB_MEMALIGN(a,b) memalign(a,b) 6 7 # define GB_MEMCPY(d,s,n) memcpy(d,s,n) 8 # define GB_FREE(d) free(d)9 # define GB_STRDUP(s) strdup(s)10 # define GB_MEMSET(d,v,n) memset(d,v,n)11 12 # define GB_DELETE(a) if (a) GB_FREE(a); a = 05 6 // GB_STRDUP does no longer exist! 7 // its only here to avoid my own versioning problems.. will disappear soon 8 #if defined(DEVEL_RALF) 9 #define GB_STRDUP(str) GB_deprStrdup(str) 10 #else 11 #define GB_STRDUP(str) strdup(str) 12 #endif // DEVEL_RALF 13 13 14 14 #if defined(DIGITAL) || defined(DARWIN) 15 # undef GB_MEMALIGN16 15 # define GB_MEMALIGN(a,b) malloc(b) 16 #else 17 # define GB_MEMALIGN(a,b) memalign(a,b) 17 18 #endif 18 19 … … 24 25 # define GB_GET_SECURITY_READ(gb) ((gb)->flags.security_read) 25 26 # define GB_GET_SECURITY_WRITE(gb) ((gb)->flags.security_write) 26 # define GB_GET_SECURITY_DELETE(gb) ((gb)->flags.security_delete)27 28 # define GB_PUT_SECURITY_READ(gb,i) do { (gb)->flags.security_read = (i); } while(0)29 # define GB_PUT_SECURITY_WRITE(gb,i) do { (gb)->flags.security_write = (i); } while(0)30 # define GB_PUT_SECURITY_DELETE(gb,i) do { (gb)->flags.security_delete = (i); } while(0)27 # define GB_GET_SECURITY_DELETE(gb) ((gb)->flags.security_delete) 28 29 # define GB_PUT_SECURITY_READ(gb,i) ((gb)->flags.security_read = (i)) 30 # define GB_PUT_SECURITY_WRITE(gb,i) ((gb)->flags.security_write = (i)) 31 # define GB_PUT_SECURITY_DELETE(gb,i) ((gb)->flags.security_delete = (i)) 31 32 32 33 /********************* RELATIVE ADRESSING **********/ … … 473 474 gbd->info.istr.size = (unsigned char)siz; 474 475 gbd->info.istr.memsize = (unsigned char)memsiz; 475 if (dat) GB_MEMCPY(&(gbd->info.istr.data[0]), (char *)dat, (size_t)(memsiz));476 if (dat) memcpy(&(gbd->info.istr.data[0]), (char *)dat, (size_t)(memsiz)); 476 477 }else{ 477 478 char *exData; … … 481 482 exData = gbm_get_mem((size_t)memsiz,GB_GBM_INDEX(gbd)); 482 483 SET_GB_EXTERN_DATA_DATA(gbd->info.ex,exData); 483 if (dat) GB_MEMCPY(exData, (char *)dat, (size_t)(memsiz));484 if (dat) memcpy(exData, (char *)dat, (size_t)(memsiz)); 484 485 } 485 486 GB_INDEX_CHECK_IN(gbd); … … 525 526 (gbd)->info.istr.size = (unsigned char)(siz); \ 526 527 (gbd)->info.istr.memsize = (unsigned char)(memsiz); \ 527 if (dat) GB_MEMCPY(&((gbd)->info.istr.data[0]), (char *)(dat), (size_t)(memsiz));\528 if (dat) memcpy(&((gbd)->info.istr.data[0]), (char *)(dat), (size_t)(memsiz)); \ 528 529 }else{ \ 529 530 char *exData; \ … … 533 534 exData = gbm_get_mem((size_t)(memsiz),GB_GBM_INDEX(gbd)); \ 534 535 SET_GB_EXTERN_DATA_DATA((gbd)->info.ex,exData); \ 535 if (dat) GB_MEMCPY(exData, (char *)(dat), (size_t)(memsiz));\536 if (dat) memcpy(exData, (char *)(dat), (size_t)(memsiz)); \ 536 537 } \ 537 538 GB_INDEX_CHECK_IN(gbd); \ … … 578 579 inline void STATIC_BUFFER(char*& strvar, int minlen) { 579 580 ad_assert(minlen > 0); 580 if (strvar && (strlen(strvar) < (size_t)(minlen-1))) { free ((void*)(strvar)); strvar=NULL; }581 if (strvar && (strlen(strvar) < (size_t)(minlen-1))) { freeset(strvar, NULL); } 581 582 if (!strvar) strvar=(char*)GB_calloc(minlen,1); 582 583 } … … 600 601 } while(0) 601 602 602 #define STATIC_BUFFER(strvar,static_buffer_minlen) \ 603 do { \ 604 ad_assert(static_buffer_minlen > 0); \ 605 size_t static_buffer_len = (static_buffer_minlen); \ 606 if ((strvar) && (strlen(strvar) < (static_buffer_len-1))) { free(strvar); (strvar)=NULL; } \ 607 if (!(strvar)) (strvar)=(char*)GB_calloc(static_buffer_len,1); \ 608 } while(0) 609 610 #endif 603 #define STATIC_BUFFER(strvar,static_buffer_minlen) \ 604 do { \ 605 ad_assert(static_buffer_minlen > 0); \ 606 size_t static_buffer_len = (static_buffer_minlen); \ 607 if ((strvar) && (strlen(strvar) < (static_buffer_len-1))) { \ 608 freeset(strvar, NULL); \ 609 } \ 610 if (!(strvar)) (strvar)=(char*)GB_calloc(static_buffer_len,1); \ 611 } while(0) 612 613 #endif -
trunk/ARBDB/admalloc.c
r5708 r5725 110 110 } 111 111 112 112 #if defined(DEVEL_RALF) 113 char *GB_deprStrdup(const char *p) { 114 /* goes to header: __ATTR__DEPRECATED */ 115 return strdup(p); 116 } 117 #endif /* DEVEL_RALF */ 113 118 114 119 char *GB_strdup(const char *p) { 115 /* does strdup(), but working with NULL */ 116 if (p) return GB_STRDUP(p); 117 return NULL; 120 /* does strdup(), but working with NULL 121 * (Note: use nulldup() instead!) 122 */ 123 return p ? strdup(p) : NULL; 118 124 } 119 125 … … 155 161 } 156 162 else { /* end = 0 -> return copy of complete string */ 157 result = GB_strdup(start);163 result = nulldup(start); 158 164 } 159 165 … … 479 485 480 486 ggi->useditems[pos]++; 481 GB_MEMSET(erg,0,nsize);487 memset(erg,0,nsize); 482 488 483 489 return erg; -
trunk/ARBDB/admap.c
r5493 r5725 276 276 277 277 iecopy = (GB_REL_IFES *)malloc(iesize); 278 GB_MEMCPY(iecopy,ie,iesize);278 memcpy(iecopy,ie,iesize); 279 279 280 280 /* write index entries an calc absolute offsets */ … … 294 294 *offset += iesize; 295 295 296 GB_FREE(iecopy);296 free(iecopy); 297 297 } 298 298 … … 374 374 headercopy = (struct gb_header_list_struct*) malloc(headermemsize); 375 375 ad_assert(sizeof(*headercopy)==ALIGN(sizeof(*headercopy))); 376 GB_MEMSET(headercopy,0x0,headermemsize);376 memset(headercopy,0x0,headermemsize); 377 377 378 378 for (item=0; item<nitems; item++) … … 404 404 headermemsize = ALIGN(valid * sizeof(*header)); 405 405 ftwrite_aligned(headercopy, headermemsize, out); 406 GB_FREE(headercopy);406 free(headercopy); 407 407 408 408 }else{ /* Calc new indizes and size of header */ … … 609 609 err2: while (idx>=0) 610 610 { 611 GB_FREE(gbk[idx].gbdoff);611 free(gbk[idx].gbdoff); 612 612 idx--; 613 613 } 614 GB_FREE(gbk);614 free(gbk); 615 615 err1: GB_memerr(); 616 616 return NULL; … … 621 621 int idx; 622 622 623 for (idx=0; idx<Main->keycnt; idx++) GB_FREE(gbk[idx].gbdoff);624 GB_FREE(gbk);623 for (idx=0; idx<Main->keycnt; idx++) free(gbk[idx].gbdoff); 624 free(gbk); 625 625 } 626 626 … … 649 649 650 650 ad_assert(ADMAP_ID_LEN <= strlen(ADMAP_ID)); 651 GB_MEMSET(&mheader,0,sizeof(mheader));651 memset(&mheader,0,sizeof(mheader)); 652 652 strcpy(mheader.mapfileID,ADMAP_ID); /* header */ 653 653 -
trunk/ARBDB/admath.c
r5406 r5725 19 19 double sum = 0; 20 20 int i; 21 GB_DELETE(res);21 freeset(res, NULL); 22 22 max_n = n + 100; 23 23 res = (double *)GB_calloc(sizeof(double),max_n); -
trunk/ARBDB/adoptimize.c
r5625 r5725 177 177 int idx; 178 178 GBUSE(Main); 179 for (idx=0; idx<gbdByKey_cnt; idx++) GB_FREE(gbk[idx].gbds);180 GB_FREE(gbk);179 for (idx=0; idx<gbdByKey_cnt; idx++) free(gbk[idx].gbds); 180 free(gbk); 181 181 } 182 182 … … 2407 2407 2408 2408 data = gbm_get_mem(size, GBM_DICT_INDEX); 2409 GB_MEMCPY(data, d, size);2409 memcpy(data, d, size); 2410 2410 ad_assert(data[size-1] == 0); 2411 2411 } … … 2545 2545 for (n=0; n<dict->words; n++) *nint++ = htonl(dict->resort[n]); 2546 2546 2547 GB_MEMCPY(nint, dict->text, dict->textlen);2547 memcpy(nint, dict->text, dict->textlen); 2548 2548 } 2549 2549 -
trunk/ARBDB/adquery.c
r5708 r5725 469 469 return NULL; 470 470 } 471 GB_MEMCPY(buffer,str,len);471 memcpy(buffer,str,len); 472 472 } 473 473 … … 1045 1045 for (j = 0; j<args.cparam; ++j) { 1046 1046 if (!paramlist) paramlist = strdup(args.vparam[j].str); 1047 else { 1048 char *conc = GBS_global_string_copy("%s,%s", paramlist, args.vparam[j].str); 1049 free(paramlist); 1050 paramlist = conc; 1051 } 1047 else freeset(paramlist, GBS_global_string_copy("%s,%s", paramlist, args.vparam[j].str)); 1052 1048 } 1053 1049 for (j = 0; j<args.cinput; ++j) { 1054 1050 if (!inputstreams) inputstreams = strdup(args.vinput[j].str); 1055 else { 1056 char *conc = GBS_global_string_copy("%s;%s", inputstreams, args.vinput[j].str); 1057 free(inputstreams); 1058 inputstreams = conc; 1059 } 1051 else freeset(inputstreams, GBS_global_string_copy("%s;%s", inputstreams, args.vinput[j].str)); 1060 1052 } 1061 1053 -
trunk/ARBDB/adseqcompr.c
r5390 r5725 251 251 252 252 #if defined(SAVE_COMPRESSION_TREE_TO_DB) 253 if (node->name) { 254 free(node->name); 255 node->name = 0; 256 } 257 253 freeset(node->name, 0); 258 254 if (node->index2 != -1) { 259 255 node->name = GBS_global_string_copy("master_%03i", node->index2); … … 548 544 sumorg += seq_len; 549 545 550 GB_FREE(seqm);551 GB_FREE(seq);546 free(seqm); 547 free(seq); 552 548 } 553 549 … … 588 584 GB_write_string(gbd,""); 589 585 GB_write_string(gbd,data); 590 GB_FREE(data);586 free(data); 591 587 592 588 sumold += size; … … 671 667 672 668 if (!error) { 673 char *sizeOrg = GB_STRDUP(GBS_readable_size(sumorg));674 char *sizeOld = GB_STRDUP(GBS_readable_size(sumold));675 char *sizeNew = GB_STRDUP(GBS_readable_size(sumnew));669 char *sizeOrg = strdup(GBS_readable_size(sumorg)); 670 char *sizeOld = strdup(GBS_readable_size(sumold)); 671 char *sizeNew = strdup(GBS_readable_size(sumnew)); 676 672 677 673 GB_warning("Alignment '%s':\n" … … 698 694 699 695 // free data 700 GB_FREE(seqs);701 for (si=0;si<mastercount;si++) GB_FREE(masters[si]);702 GB_FREE(masters);696 free(seqs); 697 for (si=0;si<mastercount;si++) free(masters[si]); 698 free(masters); 703 699 } 704 700 } -
trunk/ARBDB/adsocket.c
r5711 r5725 133 133 } 134 134 if (size>holding) size = holding; 135 GB_MEMCPY(ptr,gb_local->write_ptr,(int)size);135 memcpy(ptr,gb_local->write_ptr,(int)size); 136 136 gb_local->write_ptr += size; 137 137 gb_local->write_free+= size; … … 203 203 204 204 while (size >= gb_local->write_free){ 205 GB_MEMCPY(gb_local->write_ptr, ptr, (int)gb_local->write_free);205 memcpy(gb_local->write_ptr, ptr, (int)gb_local->write_free); 206 206 gb_local->write_ptr += gb_local->write_free; 207 207 size -= gb_local->write_free; … … 211 211 if (gbcm_write_flush(socket)) return GBCM_SERVER_FAULT; 212 212 } 213 GB_MEMCPY(gb_local->write_ptr, ptr, (int)size);213 memcpy(gb_local->write_ptr, ptr, (int)size); 214 214 gb_local->write_ptr += size; 215 215 gb_local->write_free -= size; … … 244 244 return GB_export_error("OPEN_ARB_DB_CLIENT ERROR: missing ':' in %s",path); 245 245 } 246 *m_name = GB_STRDUP(p+1);246 *m_name = strdup(p+1); 247 247 *id = -1; 248 248 return 0; … … 455 455 { 456 456 char *key; 457 long strlen = gbcm_read_long(socket);458 459 if ( strlen) {460 if ( strlen>0) {461 key = (char *)GB_calloc(sizeof(char), (size_t) strlen+1);462 gbcm_read(socket, key, strlen);457 long len = gbcm_read_long(socket); 458 459 if (len) { 460 if (len>0) { 461 key = (char *)GB_calloc(sizeof(char), (size_t)len+1); 462 gbcm_read(socket, key, len); 463 463 } 464 464 else { … … 467 467 } 468 468 else { 469 key = GB_strdup("");469 key = strdup(""); 470 470 } 471 471 … … 610 610 if (len<0) return 0; 611 611 buffer[len] = 0; 612 if (path[0] == '/') return GB_STRDUP(buffer);613 614 path2 = GB_STRDUP(path);612 if (path[0] == '/') return strdup(buffer); 613 614 path2 = strdup(path); 615 615 pos = strrchr(path2,'/'); 616 616 if (!pos){ 617 617 free(path2); 618 return GB_STRDUP(buffer);618 return strdup(buffer); 619 619 } 620 620 *pos = 0; 621 res = GB_STRDUP(GBS_global_string("%s/%s",path2,buffer));621 res = GBS_global_string_copy("%s/%s",path2,buffer); 622 622 free(path2); 623 623 return res; … … 1172 1172 } while((step_size=step_size/2) > sizeof(void*)); 1173 1173 1174 while(head) { 1175 void *tmp; 1176 tmp=*(void**)head; 1177 free(head); 1178 head=tmp; 1179 } 1180 1174 while (head) freeset(head, *(void**)head); 1181 1175 max_malloc /= 1024; 1182 1176 } -
trunk/ARBDB/adstring.c
r5708 r5725 37 37 GB_ERROR gb_scan_directory(char *basename, struct gb_scandir *sd) { /* goes to header: __ATTR__USERESULT */ 38 38 /* look for quick saves (basename = yyy/xxx no arb ending !!!!) */ 39 char *path = GB_STRDUP(basename);39 char *path = strdup(basename); 40 40 const char *fulldir = "."; 41 41 char *file = strrchr(path,'/'); … … 136 136 if (filename_only) strcpy(buffer, dp->d_name); 137 137 if (result) { 138 char *neu = GB_strdup(GBS_global_string("%s*%s", result, buffer)); 139 free(result); 140 result = neu; 138 freeset(result, GBS_global_string_copy("%s*%s", result, buffer)); 141 139 } 142 140 else { 143 result = GB_strdup(buffer);141 result = strdup(buffer); 144 142 } 145 143 } … … 170 168 if ((GB_ULONG)st.st_mtime > newest){ 171 169 newest = st.st_mtime; 172 if (result) free(result); 173 result = GB_STRDUP(&dp->d_name[0]); 170 freedup(result, dp->d_name); 174 171 } 175 172 } … … 239 236 vsprintf(p,templat,parg); 240 237 241 if (GB_error_buffer) free(GB_error_buffer); 242 GB_error_buffer = GB_STRDUP(buffer); 238 freedup(GB_error_buffer, buffer); 243 239 return GB_error_buffer; 244 240 } … … 274 270 } 275 271 276 if (GB_error_buffer) free(GB_error_buffer); 277 GB_error_buffer = GB_STRDUP(buffer); 272 freedup(GB_error_buffer, buffer); 278 273 } 279 274 return GB_error_buffer; … … 299 294 300 295 void GB_clear_error() { /* clears the error buffer */ 301 free(GB_error_buffer); 302 GB_error_buffer = 0; 296 freeset(GB_error_buffer, 0); 303 297 } 304 298 … … 500 494 for (;i<GB_KEY_LEN_MIN;i++) buf[i] = '_'; 501 495 buf[i] = 0; 502 return GB_STRDUP(buf);496 return strdup(buf); 503 497 } 504 498 … … 543 537 char *dest; 544 538 dest = (char *)malloc((size_t)len); 545 GB_MEMCPY(dest,source,(int)len);539 memcpy(dest,source,(int)len); 546 540 return dest; 547 541 } … … 863 857 int ch; 864 858 865 s = d = result = GB_STRDUP(com);859 s = d = result = strdup(com); 866 860 while ( (ch = *(s++)) ){ 867 861 switch (ch) { … … 899 893 int ch; 900 894 901 s = d = result = GB_STRDUP(com);895 s = d = result = strdup(com); 902 896 while ( (ch = *(s++)) ){ 903 897 switch (ch) { … … 1121 1115 1122 1116 gbs_strensure_mem(strstr,len); 1123 GB_MEMCPY(strstr->GBS_strcat_data+strstr->GBS_strcat_pos,ptr,(int)len);1117 memcpy(strstr->GBS_strcat_data+strstr->GBS_strcat_pos,ptr,(int)len); 1124 1118 strstr->GBS_strcat_pos += len; 1125 1119 strstr->GBS_strcat_data[strstr->GBS_strcat_pos] = 0; … … 1131 1125 */ 1132 1126 gbs_strensure_mem(strstr,len+2); 1133 GB_MEMCPY(strstr->GBS_strcat_data+strstr->GBS_strcat_pos,ptr,(int)len);1127 memcpy(strstr->GBS_strcat_data+strstr->GBS_strcat_pos,ptr,(int)len); 1134 1128 strstr->GBS_strcat_pos += len; 1135 1129 strstr->GBS_strcat_data[strstr->GBS_strcat_pos] = 0; … … 1225 1219 if (!gb_entry || gb_entry == gb_container) { 1226 1220 GBS_reference_not_found = 1; 1227 entry =GB_STRDUP("");1221 entry = strdup(""); 1228 1222 }else{ 1229 1223 entry = GB_read_as_string(gb_entry); … … 1363 1357 char *command; 1364 1358 1365 if (!icommand || !icommand[0]) return GB_STRDUP(insource);1359 if (!icommand || !icommand[0]) return strdup(insource); 1366 1360 1367 1361 command = gbs_compress_command(icommand); 1368 in = GB_STRDUP(insource); /* copy insource to allow to destroy it */1362 in = strdup(insource); /* copy insource to allow to destroy it */ 1369 1363 1370 1364 for (doppelpunkt = command; doppelpunkt; doppelpunkt = nextdp) { /* loop over command string */ … … 1395 1389 if ( (!*in) && doppelpunkt[0] == GBS_MWILD && doppelpunkt[1] == 0) { /* empty string -> pars myself */ 1396 1390 /* * matches empty string !!!! */ 1397 mwildcard[max_mwildcard++] = GB_STRDUP(""); 1398 gbs_build_replace_string(strstruct,bar,wildcard, max_wildcard, 1399 mwildcard, max_mwildcard,gb_container); 1391 mwildcard[max_mwildcard++] = strdup(""); 1392 gbs_build_replace_string(strstruct,bar,wildcard, max_wildcard, mwildcard, max_mwildcard,gb_container); 1400 1393 goto gbs_pars_unsuccessfull; /* successfull search*/ 1401 1394 } … … 1412 1405 start_of_wildcard = search; 1413 1406 if ( !(c = *(search++) ) ) { /* last character is a wildcard -> that was it */ 1414 mwildcard[max_mwildcard++] = GB_STRDUP(source);1407 mwildcard[max_mwildcard++] = strdup(source); 1415 1408 source += strlen(source); 1416 1409 goto gbs_pars_successfull; /* successfull search and end wildcard*/ … … 1474 1467 already_transferred = source; 1475 1468 1476 for (i = 0; i < max_mwildcard; i++) {1477 free (mwildcard[i]);1478 mwildcard[i] = 0;1479 }1480 max_ wildcard = 0; max_mwildcard = 0;1469 for (i = 0; i < max_mwildcard; i++) { 1470 freeset(mwildcard[i], 0); 1471 } 1472 max_wildcard = 0; 1473 max_mwildcard = 0; 1481 1474 1482 1475 if (error) { … … 1492 1485 1493 1486 for (i = 0; i < max_mwildcard; i++){ 1494 free (mwildcard[i]); 1495 mwildcard[i] = 0; 1496 } 1497 max_wildcard = 0; max_mwildcard = 0; 1498 1499 free(in); 1500 in = GBS_strclose(strstruct); 1487 freeset(mwildcard[i], 0); 1488 } 1489 max_wildcard = 0; 1490 max_mwildcard = 0; 1491 1492 freeset(in, GBS_strclose(strstruct)); 1501 1493 } 1502 1494 free(command); … … 1603 1595 gb_assert(dir); // dir == NULL was allowed before 12/2008, forbidden now! 1604 1596 1605 char *fulldir = GB_strdup(GB_get_full_path(dir));1597 char *fulldir = nulldup(GB_get_full_path(dir)); 1606 1598 DIR *dirstream = opendir(fulldir); 1607 1599 char **names = NULL; … … 1787 1779 1788 1780 char *GBS_extract_words( const char *source,const char *chars, float minlen, GB_BOOL sort_output ) { 1789 char *s = GB_STRDUP(source);1781 char *s = strdup(source); 1790 1782 char **ps = (char **)GB_calloc(sizeof(char *), (strlen(source)>>1) + 1); 1791 1783 void *strstruct = GBS_stropen(1000); … … 2082 2074 char *res; 2083 2075 int rl = strlen(regexprin)-2; 2076 2084 2077 if (regexprin[0] != '/' || regexprin[rl+1] != '/') { 2085 2078 GB_export_error("RegExprSyntax: '/searchterm/'"); … … 2087 2080 return 0; 2088 2081 } 2089 if (regexpr && !strncmp( regexpr, regexprin+1, rl)) 2090 goto already_compiled;2091 if (regexpr) free(regexpr);2092 regexpr = GB_STRDUP(regexprin+1);2093 regexpr[rl]= 0;2094 2095 regerrno = 0;2096 res = compile(regexpr,&expbuf[0],&expbuf[8000],0);2097 if (!res|| regerrno){2098 gbs_regerror(regerrno);2099 return 0;2100 } 2101 already_compiled: 2082 2083 if (!regexpr || strncmp(regexpr, regexprin+1, rl) != 0) { // first or new regexpr 2084 freedup(regexpr, regexprin+1); 2085 regexpr[rl] = 0; 2086 regerrno = 0; 2087 2088 res = compile(regexpr,&expbuf[0],&expbuf[8000],0); 2089 if (!res|| regerrno){ 2090 gbs_regerror(regerrno); 2091 return 0; 2092 } 2093 } 2094 2102 2095 if (step((char *)in,expbuf)) return loc1; 2103 2096 return 0; … … 2118 2111 } 2119 2112 /* Copy regexpr and remove leading + trailing '/' */ 2120 regexpr = GB_STRDUP(regexprin+1);2113 regexpr = strdup(regexprin+1); 2121 2114 regexpr[rl] = 0; 2122 2115 … … 2200 2193 2201 2194 regerrno = 0; 2202 if (!old_reg_expr || strcmp (old_reg_expr ,regexpr)){ 2203 if (expbuf) free(expbuf); 2204 expbuf = compile(regexpr,0,0); 2205 } 2206 if (old_reg_expr) free(old_reg_expr); 2207 old_reg_expr = regexpr; 2208 regexpr = 0; 2195 if (!old_reg_expr || strcmp(old_reg_expr ,regexpr) != 0) { 2196 freeset(expbuf, compile(regexpr,0,0)); 2197 } 2198 2199 reassign(old_reg_expr, regexpr); 2209 2200 2210 2201 if (regerrno){ … … 2417 2408 2418 2409 char *GBS_merge_tagged_strings(const char *s1, const char *tag1, const char *replace1, const char *s2, const char *tag2, const char *replace2){ 2419 char *str1 = GB_STRDUP(s1);2420 char *str2 = GB_STRDUP(s2);2410 char *str1 = strdup(s1); 2411 char *str2 = strdup(s2); 2421 2412 char *t1 = GBS_string_2_key(tag1); 2422 2413 char *t2 = GBS_string_2_key(tag2); … … 2442 2433 2443 2434 char *GBS_string_eval_tagged_string(GBDATA *gb_main,const char *s, const char *dt, const char *tag, const char *srt, const char *aci, GBDATA *gbd){ 2444 char *str = GB_STRDUP(s);2435 char *str = strdup(s); 2445 2436 char *default_tag = GBS_string_2_key(dt); 2446 2437 GB_HASH *hash = GBS_create_hash(16, GB_MIND_CASE); … … 2503 2494 notfound: 2504 2495 /* Nothing found */ 2505 free(buf); s = 0; 2496 free(buf); 2497 s = 0; 2506 2498 found: 2507 2499 free(tag); … … 2527 2519 2528 2520 void GB_delete_set(GBDATA_SET *set){ 2529 GB_FREE(set->items);2530 GB_FREE(set);2521 free(set->items); 2522 free(set); 2531 2523 } 2532 2524 -
trunk/ARBDB/adsystem.c
r5628 r5725 81 81 82 82 void delete_gb_dictionary(GB_DICTIONARY *dict){ 83 GB_FREE(dict);83 free(dict); 84 84 } 85 85 -
trunk/ARBDB/adtcp.c
r5675 r5725 81 81 int c; 82 82 for (c = 0; ATD_content[c]; c++) free(ATD_content[c]); 83 free(ATD_content); 84 ATD_content = 0; 83 freeset(ATD_content, 0); 85 84 } 86 85 } … … 130 129 if (tok[0] == '#') break; /* EOL comment -> stop */ 131 130 if (tokCount >= MAXTOKENS) { error = "Too many tokens"; break; } 132 tokens[tokCount] = tokCount ? GBS_eval_env(tok) : GB_strdup(tok);131 tokens[tokCount] = tokCount ? GBS_eval_env(tok) : strdup(tok); 133 132 if (!tokens[tokCount]) { error = GB_get_error(); break; } 134 133 tokCount++; … … 179 178 } 180 179 181 if (error) { 182 error = GBS_global_string("%s (in line %i of '%s')", error, lineNumber, filename); 183 } 184 185 for (t = 0; t<tokCount; t++) { 186 free(tokens[t]); 187 tokens[t] = 0; 188 } 180 if (error) error = GBS_global_string("%s (in line %i of '%s')", error, lineNumber, filename); 181 for (t = 0; t<tokCount; t++) freeset(tokens[t], 0); 189 182 } 190 183 … … 319 312 if (strchr(env,':')){ 320 313 static char *resBuf = 0; 321 322 free(resBuf); 323 resBuf = GB_STRDUP(env); 314 freedup(resBuf, env); 324 315 result = resBuf; 325 316 } … … 372 363 373 364 if (matchingEntriesSize != count) { 374 free(matchingEntries); 375 matchingEntries = malloc((count+1)*sizeof(*matchingEntries)); 365 freeset(matchingEntries, malloc((count+1)*sizeof(*matchingEntries))); 376 366 matchingEntriesSize = count; 377 367 } … … 399 389 static char *serverlog = 0; 400 390 if (!serverlog) { 401 serverlog = GB_strdup(GB_path_in_ARBLIB("pts/ptserver.log", NULL));391 serverlog = nulldup(GB_path_in_ARBLIB("pts/ptserver.log", NULL)); 402 392 gb_assert(serverlog); 403 393 } … … 436 426 437 427 { 438 char *remote = GB_strdup(ipPort);428 char *remote = strdup(ipPort); 439 429 char *colon = strchr(remote, ':'); 440 430 if (colon) *colon = 0; /* hide port */ 441 431 442 432 if (strcmp(remote, "localhost") == 0) { /* hide localhost */ 443 result = GB_strdup(nameOnly);433 result = nulldup(nameOnly); 444 434 } 445 435 else { … … 478 468 } 479 469 480 if (newResult) { free(result); result = newResult; }470 if (newResult) freeset(result, newResult); 481 471 free(serverDB); 482 472 } -
trunk/ARBDB/adtools.c
r5660 r5725 60 60 for (counter = 1; !ali_other; ++counter) { 61 61 ali_other = GBS_global_string_copy("ali_x%i", counter); 62 if (GBT_get_alignment(gbMain, ali_other) != 0) { 63 free(ali_other); 64 ali_other = 0; 65 } 62 if (GBT_get_alignment(gbMain, ali_other) != 0) freeset(ali_other, 0); // exists -> continue 66 63 } 67 64 … … 575 572 576 573 if (pos>len){ /* no place to insert / delete */ 577 GB_MEMCPY(newval,source,(size_t)len);574 memcpy(newval,source,(size_t)len); 578 575 return NULL; 579 576 } … … 584 581 585 582 if (nchar > 0) { /* insert */ 586 GB_MEMCPY(newval,source,(size_t)pos);583 memcpy(newval,source,(size_t)pos); 587 584 memset(newval+pos,insert_what,(size_t)nchar); 588 GB_MEMCPY(newval+pos+nchar,source+pos,(size_t)(len-pos));585 memcpy(newval+pos+nchar,source+pos,(size_t)(len-pos)); 589 586 }else{ 590 GB_MEMCPY(newval,source,(size_t)pos);591 GB_MEMCPY(newval+pos,source+pos-nchar, (size_t)(len - pos + nchar));587 memcpy(newval,source,(size_t)pos); 588 memcpy(newval+pos,source+pos-nchar, (size_t)(len - pos + nchar)); 592 589 } 593 590 return newval; … … 862 859 to delete the tree in Database 863 860 just call GB_delete((GBDATA *)gb_tree); 864 */861 */ 865 862 { 866 GB_ERROR error;867 if (tree->name) free(tree->name);868 if (tree->remark_branch) free(tree->remark_branch); 863 free(tree->name); 864 free(tree->remark_branch); 865 869 866 if (tree->is_leaf == 0) { 867 GB_ERROR error; 868 870 869 gb_assert(tree->leftson); 871 870 gb_assert(tree->rightson); … … 874 873 } 875 874 if (!tree->father || !tree->tree_is_one_piece_of_memory){ 876 free( (char *)tree);875 free(tree); 877 876 } 878 877 return 0; … … 1480 1479 TreeReader *reader = GB_calloc(1, sizeof(*reader)); 1481 1480 1482 reader->tree_file_name = GB_strdup(file_name);1481 reader->tree_file_name = strdup(file_name); 1483 1482 reader->in = input; 1484 1483 reader->tree_comment = GBS_stropen(2048); … … 1610 1609 1611 1610 assert(node->remark_branch == 0); 1612 node->remark_branch = GB _strdup(GBS_global_string("%i%%", (int)bootstrap));1611 node->remark_branch = GBS_global_string_copy("%i%%", (int)bootstrap); 1613 1612 1614 1613 if (end[0] != 0) { // sth behind bootstrap value 1615 1614 if (end[0] == ':') ++end; // ARB format for nodes with bootstraps AND node name is 'bootstrap:nodename' 1616 node->name = GB_strdup(end);1615 node->name = strdup(end); 1617 1616 } 1618 1617 free(name); … … 1722 1721 } 1723 1722 1724 if (right) GB_FREE(right);1723 free(right); 1725 1724 1726 1725 break; … … 1736 1735 } 1737 1736 1738 if (left) GB_FREE(left);1737 free(left); 1739 1738 } 1740 1739 } … … 1776 1775 GB_BOOL is_bootstrap = end[0] == '%' && end[1] == 0; 1777 1776 1778 free(tree->remark_branch); 1779 tree->remark_branch = 0; 1777 freeset(tree->remark_branch, 0); 1780 1778 1781 1779 if (is_bootstrap) { 1782 1780 bootstrap = bootstrap*bootstrap_scale+0.5; 1783 tree->remark_branch = GB _strdup(GBS_global_string("%i%%", (int)bootstrap));1781 tree->remark_branch = GBS_global_string_copy("%i%%", (int)bootstrap); 1784 1782 } 1785 1783 } … … 1913 1911 long *nnodes = GBT_read_int(gb_tree, "nnodes"); 1914 1912 if (nnodes && *nnodes>maxnodes) { 1915 free(largest); 1916 largest = GB_read_key(gb_tree); 1913 freeset(largest, GB_read_key(gb_tree)); 1917 1914 maxnodes = *nnodes; 1918 1915 } … … 3064 3061 newname = &rns->data[0]; 3065 3062 } 3066 free(tree->name); 3067 tree->name = GB_STRDUP(newname); 3063 freedup(tree->name, newname); 3068 3064 rns->used_by = tree_index; 3069 3065 } … … 3140 3136 struct gbt_renamed_struct *rns = (struct gbt_renamed_struct *)GBS_read_hash(gbtrst.renamed_hash, item->name); 3141 3137 if (rns) { // species was renamed 3142 const char *newname = &rns->data[0]; 3143 3144 free(item->name); 3145 item->name = GB_STRDUP(newname); 3146 need_save = 1; 3138 freedup(item->name, rns->data); 3139 need_save = 1; 3147 3140 } 3148 3141 } … … 3151 3144 } 3152 3145 3153 if (!error) { 3154 free(*configStrPtr); 3155 *configStrPtr = GBS_strclose(strstruct); 3156 } 3146 if (!error) freeset(*configStrPtr, GBS_strclose(strstruct)); 3157 3147 3158 3148 GBT_free_config_item(item); … … 3692 3682 } 3693 3683 } 3694 if (error) { 3695 free(result); 3696 result = 0; 3697 } 3684 if (error) freeset(result, 0); 3698 3685 } 3699 3686 -
trunk/ARBDB/arbdb.c
r5655 r5725 202 202 old_buffer = gb_local->buffer; 203 203 gb_local->buffer = (char *)GB_calloc((size_t)size,1); 204 GB_MEMCPY(gb_local->buffer,old_buffer, gb_local->bufsize);204 memcpy(gb_local->buffer,old_buffer, gb_local->bufsize); 205 205 gb_local->bufsize = size; 206 206 free(old_buffer); … … 380 380 if (da) { 381 381 ca = gb_alloc_cache_index(gbd,size); 382 GB_MEMCPY(ca,da,size);382 memcpy(ca,da,size); 383 383 } 384 384 } … … 457 457 da = gb_uncompress_bits(data,size,c_0,c_1); 458 458 if (ca) { 459 GB_MEMCPY(ca,da,size+1);459 memcpy(ca,da,size+1); 460 460 return ca; 461 461 }else{ … … 1381 1381 p[0] = 0; 1382 1382 1383 free(result); 1384 result = neu_result; 1383 freeset(result, neu_result); 1385 1384 result_length += keylen+1; 1386 1385 } … … 1400 1399 } 1401 1400 else { 1402 result = GB_strdup(";");1401 result = strdup(";"); 1403 1402 } 1404 1403 … … 2043 2042 } 2044 2043 2045 GB_ERROR GB_disable_quicksave(GBDATA *gbd,const char *reason){ 2046 GB_MAIN_TYPE * Main = GB_MAIN(gbd); 2047 if (Main->qs.quick_save_disabled) free(Main->qs.quick_save_disabled); 2048 Main->qs.quick_save_disabled = strdup(reason); 2049 return 0; 2044 void GB_disable_quicksave(GBDATA *gbd,const char *reason) { 2045 freedup(GB_MAIN(gbd)->qs.quick_save_disabled, reason); 2050 2046 } 2051 2047 /******************************************************************************************** … … 2124 2120 } 2125 2121 error = GB_resort_data_base(gb_main,new_order_list,len); 2126 GB_FREE(new_order_list);2122 free(new_order_list); 2127 2123 return error; 2128 2124 } -
trunk/ARBDB/arbdb_base.h
r5708 r5725 28 28 typedef enum { GB_FALSE = 0 , GB_TRUE = 1 } GB_BOOL; 29 29 30 31 /* -------------------------------------------------------------------------------- 32 * The following function handle char*'s, which either own a heap copy or are NULL. 33 * 34 * freeset: assigns a heap-copy to a variable (variable is automatically free'd) 35 * freedup: similar to freeset, but strdup's the rhs-expression 36 * reassign: similar to freeset, but rhs must be variable and will be set to NULL 37 * nulldup: like strdup, but pass-through NULL 38 * 39 * Note: freeset, freedup and reassign may safely use the changed variable in the rhs-expression! 40 * 41 * @@@ the complete section could go into a seperate header, 42 * but it makes no sense atm, cause we need GB_strdup anyway 43 * (using a macro would evaluate 'str' in nulldup twice - which is not ok) 44 */ 45 46 #define freeset(var,str) do { typeof(var) freesetvar = (str); free(var); (var) = freesetvar; } while(0) 47 48 #ifdef __cplusplus 49 50 #ifndef _CPP_CSTRING 51 #include <cstring> 52 #endif 53 #ifndef _CPP_CSTDLIB 54 #include <cstdlib> 55 #endif 56 57 inline char *nulldup(const char *str) { return str ? strdup(str) : NULL; } // this does the same as GB_strdup 58 inline void freedup(char *& strvar, const char *no_heapcopy) { char *tmp_copy = nulldup(no_heapcopy); free(strvar); strvar = tmp_copy; } 59 inline void reassign(char *& dstvar, char *& srcvar) { freeset(dstvar, srcvar); srcvar = NULL; } 60 61 #else 62 63 #define nulldup(str) GB_strdup(str) 64 #define freedup(var,str) freeset(var, nulldup(str)) 65 #define reassign(dvar,svar) do { freeset(dvar, svar); (svar) = NULL; } while(0) 66 67 #endif 68 /* -------------------------------------------------------------------------------- */ 69 70 30 71 #ifndef P_ 31 72 #define P_(s) s -
trunk/ARB_GDE/GDE_arbdb_io.cxx
r5330 r5725 216 216 { 217 217 AppendNA((NA_Base *)sequfilt[number],strlen((const char *)sequfilt[number]),this_elem); 218 free(sequfilt[number]); 219 sequfilt[number] = 0; 218 freeset(sequfilt[number], 0); 220 219 } 221 220 -
trunk/ARB_GDE/GDE_event.cxx
r5708 r5725 139 139 strncat(temp,textvalue,strlen(textvalue)); 140 140 strcat( temp,&(Action[i+strlen(symbol)]) ); 141 free(Action); 142 Action = temp; 143 } 144 else 145 { 141 freeset(Action, temp); 142 } 143 else { 146 144 if (warned_about.find(symbol) == warned_about.end()) { 147 145 fprintf(stderr, … … 151 149 warned_about.insert(symbol); 152 150 } 153 // newlen = strlen(Action)-strlen(symbol)154 // +strlen(method)+1;155 // temp = (char *)calloc(newlen,1);156 // if (temp == NULL)157 // Error("ReplaceArgs():Error in calloc");158 // strncat(temp,Action,i);159 // strncat(temp,method,strlen(method));160 // strcat( temp,&(Action[i+strlen(symbol)]) );161 // free(Action);162 // Action = temp;163 151 } 164 152 } … … 183 171 } 184 172 185 static void GDE_free(void **p) 186 { 187 if(*p!=0) 188 { 189 //delete *p; 190 free(*p); 191 *p=0; 192 } 193 } 194 195 /*void GDE_freemask(GMask *mask) 196 { 197 if(mask==0) return; 198 GDE_free((void**)&mask->name); 199 for(long i=0;i<mask->listlen;i++) 200 { 201 NumList numl=mask->list[i]; 202 GDE_free((void**)&numl.valu); 203 } 204 GDE_free((void**)&mask->list); 205 }*/ 173 static void GDE_free(void **p) { 174 freeset(*p, NULL); 175 } 206 176 207 177 static char *ReplaceFile(char *Action,GfileFormat file) … … 221 191 strncat(temp,method,strlen(method)); 222 192 strcat( temp,&(Action[i+strlen(symbol)]) ); 223 free(Action); 224 Action = temp; 193 freeset(Action, temp); 225 194 } 226 195 return(Action); … … 246 215 strncat(temp,method,strlen(method)); 247 216 strcat( temp,&(Action[i+strlen(symbol)]) ); 248 free(Action); 249 Action = temp; 217 freeset(Action, temp); 250 218 } 251 219 return(Action); … … 253 221 254 222 255 static void GDE_freesequ(NA_Sequence *sequ) 256 { 257 if(sequ==0) return; 258 GDE_free((void**)&sequ->comments); 259 /* GDE_free((void**)&sequ->col_lut); OLIVER STRUNK */ 260 GDE_free((void**)&sequ->cmask); 261 /*GDE_freemask(sequ->mask);*/ 262 GDE_free((void**)&sequ->baggage); 263 GDE_free((void**)&sequ->sequence); 264 /*if(sequ->groupf) 265 { 266 GDE_freesequ(sequ->groupf); 267 GDE_free((void**)&sequ->groupf); 268 }*/ 269 } 270 271 static void GDE_freeali(NA_Alignment *dataset) 272 { 273 if(dataset==0) return; 274 GDE_free((void**)&dataset->id); 275 GDE_free((void**)&dataset->description); 276 GDE_free((void**)&dataset->authority); 277 GDE_free((void**)&dataset->cmask); 278 GDE_free((void**)&dataset->selection_mask); 279 GDE_free((void**)&dataset->alignment_name); 280 281 /* maybe not correct: 282 GMask *mask=dataset->mask; 283 GDE_freemask(dataset->mask); 284 GDE_free((void**)&dataset->mask);*/ 285 286 unsigned long i; 287 // **maybe not correct: 288 //NA_Sequence **group=dataset->group; 289 //for(long i=0;i<dataset->numgroups;i++) 290 // GDE_freesequ(dataset->group[i]); 291 //GDE_free((void**)&dataset->group); 292 // **correction: this was not correct 293 294 for(i=0;i<dataset->numelements;i++) 295 GDE_freesequ(&(dataset->element[i])); 223 static void GDE_freesequ(NA_Sequence *sequ) { 224 if (sequ) { 225 GDE_free((void**)&sequ->comments); 226 GDE_free((void**)&sequ->cmask); 227 GDE_free((void**)&sequ->baggage); 228 GDE_free((void**)&sequ->sequence); 229 } 230 } 231 232 static void GDE_freeali(NA_Alignment *dataset) { 233 if (dataset) { 234 GDE_free((void**)&dataset->id); 235 GDE_free((void**)&dataset->description); 236 GDE_free((void**)&dataset->authority); 237 GDE_free((void**)&dataset->cmask); 238 GDE_free((void**)&dataset->selection_mask); 239 GDE_free((void**)&dataset->alignment_name); 240 241 unsigned long i; 242 for(i=0;i<dataset->numelements;i++) GDE_freesequ(&(dataset->element[i])); 243 } 296 244 } 297 245 … … 524 472 DataSet->gb_main = GLOBAL_gb_main; 525 473 GB_begin_transaction(DataSet->gb_main); 526 delete DataSet->alignment_name; 527 DataSet->alignment_name = GBT_get_default_alignment(DataSet->gb_main); 528 free(alignment_name); 529 alignment_name = strdup(DataSet->alignment_name); 474 freeset(DataSet->alignment_name, GBT_get_default_alignment(DataSet->gb_main)); 475 freedup(alignment_name, DataSet->alignment_name); 530 476 531 477 aw_status("reading database"); … … 673 619 674 620 GDE_freeali(DataSet); 675 free(DataSet); 676 DataSet = 0; 677 DataSet = (NA_Alignment *) Calloc(1,sizeof(NA_Alignment)); 621 freeset(DataSet, (NA_Alignment *)Calloc(1,sizeof(NA_Alignment))); 678 622 DataSet->rel_offset = 0; 679 680 // aw->hide(); 681 } 682 623 } 624 -
trunk/AWT/AWT_advice.cxx
r5675 r5725 115 115 size_t message_len = strlen(message); awt_assert(message_len>0); 116 116 long crc32 = GB_checksum(message, message_len, true, " .,-!"); // checksum is used to test if advice was shown 117 char *advice_id = GB _strdup(GBS_global_string("%lx", crc32));117 char *advice_id = GBS_global_string_copy("%lx", crc32); 118 118 119 119 bool show_advice = !advice_disabled(advice_id); -
trunk/AWT/AWT_asciiprint.cxx
r5695 r5725 160 160 AW_root *awr = aww->get_root(); 161 161 char *text = awr->awar(AWAR_APRINT_TEXT)->read_string(); 162 { 163 char *rtext = GBS_replace_tabs_by_spaces(text); 164 free(text); 165 text = rtext; 166 } 162 163 freeset(text, GBS_replace_tabs_by_spaces(text)); 167 164 168 165 AWT_asciiprint_destination dest = (AWT_asciiprint_destination)awr->awar(AWAR_APRINT_PRINTTO)->read_int(); -
trunk/AWT/AWT_config_manager.cxx
r5675 r5725 105 105 char *corrected = GBS_string_2_key(name); 106 106 107 if (strcmp(corrected, "__") == 0) { 108 free(corrected); 109 corrected = strdup(""); 110 } 111 107 if (strcmp(corrected, "__") == 0) freedup(corrected, ""); 112 108 return corrected; 113 109 } -
trunk/AWT/AWT_db_browser.cxx
r5675 r5725 561 561 if (strlen(content)>(ENTRY_MAX_LENGTH+15)) { 562 562 content[ENTRY_MAX_LENGTH] = 0; 563 char *shortened_content = GBS_global_string_copy("%s [rest skipped]", content); 564 free(content); 565 content = shortened_content; 563 freeset(content, GBS_global_string_copy("%s [rest skipped]", content)); 566 564 } 567 565 -
trunk/AWT/AWT_dtree.cxx
r5660 r5725 671 671 char *new_gname = aw_input("Rename group", 0, at->name); 672 672 if (new_gname) { 673 free(at->name); 674 at->name = new_gname; 673 freeset(at->name, new_gname); 675 674 GB_write_string(gb_name, new_gname); 676 675 } … … 2514 2513 use_ellipse = aw_root->awar(AWAR_DTREE_USE_ELLIPSE)->read_int(); 2515 2514 2516 free(species_name); 2517 species_name = aw_root->awar(AWAR_SPECIES_NAME)->read_string(); 2515 freeset(species_name, aw_root->awar(AWAR_SPECIES_NAME)->read_string()); 2518 2516 2519 2517 x_cursor = y_cursor = 0.0; -
trunk/AWT/AWT_file_selection.cxx
r5695 r5725 146 146 if (!lslash) return 0; 147 147 148 char *result = GB_strdup(path);148 char *result = strdup(path); 149 149 result[lslash-path] = 0; 150 150 … … 304 304 305 305 if (name[0] == '/' && AWT_is_dir(name)) { 306 free(fulldir); 307 fulldir = strdup(name); 306 freedup(fulldir, name); 308 307 name_only = ""; 309 308 } … … 474 473 } 475 474 else { 476 free(cbs->previous_filename); 477 cbs->previous_filename = 0; 475 freeset(cbs->previous_filename, 0); 478 476 aw_root->awar(cbs->def_name)->write_string(newName); 479 477 } 480 478 481 free(newName); 482 newName = aw_root->awar(cbs->def_name)->read_string(); 479 freeset(newName, aw_root->awar(cbs->def_name)->read_string()); 483 480 } 484 481 else { … … 512 509 if (suffix[-1] == '.') suffix[-1] = 0; 513 510 } 514 515 char *n = set_suffix(newName, pfilter); 516 free(newName); 517 newName = n; 511 freeset(newName, set_suffix(newName, pfilter)); 518 512 } 519 513 } … … 524 518 aw_root->awar(cbs->def_name)->write_string(newName); // loops back if changed !!! 525 519 } 526 527 free(cbs->previous_filename); 528 cbs->previous_filename = newName; // this releases newName 520 521 freeset(cbs->previous_filename, newName); 529 522 } 530 523 } … … 663 656 if (!dir[0]) { // empty -> fillin current dir 664 657 awar_dir->write_string(GB_getcwd()); 665 free(dir); 666 dir = awar_dir->read_string(); 658 freeset(dir, awar_dir->read_string()); 667 659 } 668 660 -
trunk/AWT/AWT_filter.cxx
r5660 r5725 316 316 317 317 if (strstr(content, "none")==0) { // don't add filters named 'none' 318 char *new_combined_name = (char*)malloc(strlen(combined_name)+1+strlen(content)+1); 319 sprintf(new_combined_name, "%s/%s", combined_name, content); 320 free(combined_name); 321 combined_name = new_combined_name; 318 freeset(combined_name, GBS_global_string_copy("%s/%s", combined_name, content)); 322 319 } 323 320 } -
trunk/AWT/AWT_imp_exp.cxx
r5564 r5725 106 106 boot = GBS_global_string("%i", int(val+0.5)); 107 107 } 108 bootstrap = GB_strdup(boot);108 bootstrap = strdup(boot); 109 109 } 110 110 … … 157 157 char *end = 0; 158 158 double val = strtod(boot, &end); 159 awt_assert(end[0] == '%'); // otherwise sth strange is contained in remark_branch 160 boot = GBS_global_string("%i", int(val+0.5)); 161 162 bootstrap = GB_strdup(boot); 159 160 awt_assert(end[0] == '%'); // otherwise sth strange is contained in remark_branch 161 bootstrap = GBS_global_string_copy("%i", int(val+0.5)); 163 162 } 164 163 } … … 171 170 172 171 awt_assert(buf); 173 groupname = GB_strdup(buf);172 groupname = strdup(buf); 174 173 175 174 GBDATA *gb_grouped = GB_entry(tree->gb_node, "grouped"); … … 192 191 if (bootstrap) { 193 192 branch_tag.add_attribute("bootstrap", bootstrap); 194 free(bootstrap); 195 bootstrap = 0; 193 freeset(bootstrap, 0); 196 194 } 197 195 if (groupname) { 198 196 branch_tag.add_attribute("groupname", groupname); 199 free(groupname); 200 groupname = 0; 197 freeset(groupname, 0); 201 198 if (folded) branch_tag.add_attribute("folded", "1"); 202 199 } … … 317 314 318 315 if (tree_remark) remark = GB_read_string(tree_remark); 319 else remark = GB _strdup(GBS_global_string("ARB-tree '%s'", tree_name));316 else remark = GBS_global_string_copy("ARB-tree '%s'", tree_name); 320 317 321 318 { -
trunk/AWT/AWT_nds.cxx
r5708 r5725 557 557 558 558 if (at_leaf || at_group) { 559 if (awt_nds_ms->dkeys[count]) free(awt_nds_ms->dkeys[count]); 560 awt_nds_ms->dkeys[count] = GB_read_string(GB_entry(gbz, "key_text")); 559 freeset(awt_nds_ms->dkeys[count], GB_read_string(GB_entry(gbz, "key_text"))); 561 560 562 561 awt_nds_ms->rek[count] = (GB_first_non_key_char(awt_nds_ms->dkeys[count]) != 0); … … 566 565 567 566 gbe = GB_entry(gbz, "pars"); 568 if (awt_nds_ms->parsing[count]) { 569 free(awt_nds_ms->parsing[count]); 570 awt_nds_ms->parsing[count] = 0; 571 } 567 freeset(awt_nds_ms->parsing[count], 0); 572 568 if (gbe && GB_read_string_count(gbe)>1 ) awt_nds_ms->parsing[count] = GB_read_string(gbe); 573 569 count++; … … 673 669 if (aci_srt) { 674 670 char *aci_result = GB_command_interpreter(gb_main, str, aci_srt, gbd, tree_name); 675 if (aci_result) { 676 free(str); 677 str = aci_result; 678 } 679 else { // error 680 error = GB_get_error(); 681 free(str); 682 str = GBS_global_string_copy("<error: %s>", error); 683 } 671 freeset(str, aci_result ? aci_result : GBS_global_string_copy("<error: %s>", GB_expect_error())); 684 672 } 685 673 } -
trunk/AWT/AWT_nei.cxx
r5708 r5725 133 133 PH_NEIGHBOURJOINING::~PH_NEIGHBOURJOINING(void) 134 134 { 135 // long i;136 // for (i=0;i<size;i++) {137 // free(dist_matrix[i]);138 // dist_matrix[i] = 0;139 // }140 135 delete [] dist_matrix; 141 142 // free((char *)dist_list);143 136 delete [] dist_list; 144 137 free((char *)net_divergence); -
trunk/AWT/AWT_pro_a_nucs.cxx
r5708 r5725 221 221 222 222 { 223 char *D_codons = GB_strdup(AWT_get_codons('D', code_nr));224 char *N_codons = GB_strdup(AWT_get_codons('N', code_nr));225 char *E_codons = GB_strdup(AWT_get_codons('E', code_nr));226 char *Q_codons = GB_strdup(AWT_get_codons('Q', code_nr));223 char *D_codons = strdup(AWT_get_codons('D', code_nr)); 224 char *N_codons = strdup(AWT_get_codons('N', code_nr)); 225 char *E_codons = strdup(AWT_get_codons('E', code_nr)); 226 char *Q_codons = strdup(AWT_get_codons('Q', code_nr)); 227 227 228 228 char protein; -
trunk/AWT/AWT_query_and_functions.cxx
r5660 r5725 762 762 long use_tag = cbs->aws->get_root()->awar(cbs->awar_use_tag)->read_int(); 763 763 if (!use_tag || !strlen(tag)) { 764 free(tag); 765 tag = 0; 764 freeset(tag, 0); 766 765 } 767 766 } … … 1119 1118 if (size >= buffersize) { 1120 1119 buffersize = int(size*1.5); 1121 free(buffer); 1122 buffer = (char*)malloc(buffersize); 1120 freeset(buffer, (char*)malloc(buffersize)); 1123 1121 } 1124 1122 … … 1344 1342 else aws->callback(awt_colorize_marked, (AW_CL)cmd); 1345 1343 1346 aws->create_autosize_button("COLORIZE", GB _strdup(GBS_global_string("Set color of %s %s to ...", what, Sel->items_name)), "S", 2);1344 aws->create_autosize_button("COLORIZE", GBS_global_string_copy("Set color of %s %s to ...", what, Sel->items_name), "S", 2); 1347 1345 1348 1346 { … … 1370 1368 aws->at("mark"); 1371 1369 aws->callback(awt_mark_colored, (AW_CL)cmd, (AW_CL)1); 1372 aws->create_autosize_button("MARK_COLORED", GB _strdup(GBS_global_string("Mark all %s of ...", Sel->items_name)), "M", 2);1370 aws->create_autosize_button("MARK_COLORED", GBS_global_string_copy("Mark all %s of ...", Sel->items_name), "M", 2); 1373 1371 1374 1372 aws->at("unmark"); 1375 1373 aws->callback(awt_mark_colored, (AW_CL)cmd, (AW_CL)0); 1376 aws->create_autosize_button("UNMARK_COLORED", GB _strdup(GBS_global_string("Unmark all %s of ...", Sel->items_name)), "U", 2);1374 aws->create_autosize_button("UNMARK_COLORED", GBS_global_string_copy("Unmark all %s of ...", Sel->items_name), "U", 2); 1377 1375 1378 1376 aws->at("invert"); 1379 1377 aws->callback(awt_mark_colored, (AW_CL)cmd, (AW_CL)2); 1380 aws->create_autosize_button("INVERT_COLORED", GB _strdup(GBS_global_string("Invert all %s of ...", Sel->items_name)), "I", 2);1378 aws->create_autosize_button("INVERT_COLORED", GBS_global_string_copy("Invert all %s of ...", Sel->items_name), "I", 2); 1381 1379 } 1382 1380 … … 1394 1392 return create_awt_colorizer_window(aw_root, gb_main, 0, sel); 1395 1393 } 1396 1397 // AW_window_simple *aws = new AW_window_simple;1398 1399 // {1400 // char *macro_name = GB_strdup(GBS_global_string("COLORIZE_%s", sel->items_name));1401 // char *title = GB_strdup(GBS_global_string("Colorize and mark %s", sel->items_name));1402 1403 // aws->init(aw_root, macro_name, title, 100, 100);1404 1405 // free(title);1406 // free(macro_name);1407 // }1408 1409 // aws->load_xfig("colorize.fig");1410 1411 // aws->at("close");1412 // aws->callback((AW_CB0)AW_POPDOWN);1413 // aws->create_button("CLOSE","CLOSE","C");1414 1415 // aws->at("help");1416 // aws->callback( AW_POPUP_HELP,(AW_CL)"colorize_items.hlp");1417 // aws->create_button("HELP","HELP","H");1418 1419 // #if 01420 // aws->at("color");1421 // aws->create_option_menu(AWAR_CURRENT_COLOR);1422 // for (int i = 1; i <= AW_COLOR_GROUPS; ++i) {1423 // aws->insert_option(AW_get_color_group_name(aw_root, i), 0, i);1424 // }1425 // aws->update_option_menu();1426 // #endif1427 1428 // return aws;1429 // }1430 1431 1394 1432 1395 AW_window *create_awt_open_parser(AW_root *aw_root, struct adaqbsstruct *cbs) … … 1515 1478 1516 1479 char *value = cbs->aws->get_root()->awar(cbs->awar_setvalue)->read_string(); 1517 if (value[0] == 0) { 1518 free(value); 1519 value = 0; 1520 } 1480 if (value[0] == 0) freeset(value, 0); 1521 1481 1522 1482 GB_begin_transaction(cbs->gb_main); -
trunk/AWT/AWT_sel_boxes.cxx
r5660 r5725 510 510 } 511 511 const char *name = GB_read_char_pntr(gb_name); 512 if (result) { 513 char *neu = GB_strdup(GBS_global_string("%s;%s", result, name)); 514 free(result); 515 result = neu; 516 } 517 else { 518 result = GB_strdup(name); 519 } 512 awt_assert(name); 513 514 if (result) freeset(result, GBS_global_string_copy("%s;%s", result, name)); 515 else result = strdup(name); 520 516 } 521 517 GB_pop_transaction(gb_main); -
trunk/AWT/AWT_seq_colors.cxx
r5628 r5725 261 261 if (len > ref_len){ 262 262 char *ref2 = (char *)GB_calloc(sizeof(char),len+1); 263 if (reference ) strcpy(ref2,reference); 264 free(reference); 263 264 if (reference) { 265 strcpy(ref2,reference); 266 free(reference); 267 } 265 268 reference = ref2; 266 ref_len = len;269 ref_len = len; 267 270 } 268 271 } -
trunk/AWT/AWT_tree.cxx
r5708 r5725 908 908 { // move remark branches to top 909 909 AP_tree *node; 910 char *remark = GB_strdup(this->remark_branch);910 char *remark = nulldup(this->remark_branch); 911 911 for (node = this;node->father;node = node->father){ 912 912 char *sh = node->remark_branch; -
trunk/AWTC/AWTC_ClustalV.cxx
r5497 r5725 512 512 void exit_show_pair(void) 513 513 { 514 free (zzd); zzd = 0;515 free (zzc); zzc = 0;516 free (zzb); zzb = 0;517 free (zza); zza = 0;518 free (displ); displ = 0;514 freeset(zzd, 0); 515 freeset(zzc, 0); 516 freeset(zzb, 0); 517 freeset(zza, 0); 518 freeset(displ, 0); 519 519 } 520 520 … … 575 575 #ifdef MATRIX_DUMP 576 576 577 static unsigned char *lstr_ss = 0; 578 static inline const unsigned char *lstr(const unsigned char *s, int len) 579 { 580 if (lstr_ss) free(lstr_ss); 581 lstr_ss = (unsigned char*)strndup((const char*)s,len); 577 static inline const unsigned char *lstr(const unsigned char *s, int len) { 578 static unsigned char *lstr_ss = 0; 579 580 freeset(lstr_ss, (unsigned char*)strndup((const char*)s,len)); 582 581 return lstr_ss; 583 582 } -
trunk/AWTC/AWTC_constructSequence.cxx
r5494 r5725 48 48 } 49 49 50 static inline char *strndup(const char *seq, int length) 51 { 50 static inline char *strndup(const char *seq, int length) { 52 51 char *neu = new char[length+1]; 53 52 … … 57 56 return neu; 58 57 } 59 static char *lstr_ss = 0; 60 static inline const char *lstr(const char *s, int len) 61 { 62 if (lstr_ss) free(lstr_ss); 63 lstr_ss = strndup(s,len); 58 static inline const char *lstr(const char *s, int len) { 59 static char *lstr_ss = 0; 60 61 freeset(lstr_ss, strndup(s,len)); 64 62 return lstr_ss; 65 63 } -
trunk/AWTC/AWTC_fast_aligner.cxx
r5675 r5725 385 385 static char *buffer; 386 386 387 if (alloc<(len+1)) 388 { 387 if (alloc<(len+1)) { 389 388 if (alloc) free(buffer); 390 389 buffer = (char*)malloc(alloc=len+100); … … 1459 1458 } 1460 1459 1461 free(*toString); 1462 *toString = newString; 1463 1460 freeset(*toString, newString); 1464 1461 free(currInfo); 1465 1462 } … … 1520 1517 while (next_relatives) { 1521 1518 next_relatives--; 1522 free(nearestRelative[next_relatives]); 1523 nearestRelative[next_relatives] = 0; 1519 freeset(nearestRelative[next_relatives], 0); 1524 1520 } 1525 1521 … … 1671 1667 } 1672 1668 1673 for (; i<next_relatives; ++i) { // delete superfluous relatives 1674 free(nearestRelative[i]); 1675 nearestRelative[i] = 0; 1676 } 1669 // delete superfluous relatives 1670 for (; i<next_relatives; ++i) freeset(nearestRelative[i], 0); 1677 1671 1678 1672 if (next_relatives>relSearch.maxRelatives) { … … 1806 1800 delete toAlignSequence; 1807 1801 1808 for (i=0; i<next_relatives; i++) { 1809 free(nearestRelative[i]); 1810 nearestRelative[i] = 0; 1811 } 1802 for (i=0; i<next_relatives; i++) freeset(nearestRelative[i], 0); 1812 1803 delete [] nearestRelative; 1813 1804 -
trunk/AWTI/AWTI_export.cxx
r5695 r5725 367 367 const char *export_sequence_data::get_export_sequence(GBDATA *gb_species, size_t& seq_len, GB_ERROR& err) { 368 368 if (gb_species != last_species_read) { 369 if (error) { 370 free(error); 371 error = 0; 372 } 369 freeset(error, 0); 373 370 374 371 // read + filter a new species … … 633 630 aw_message(GB_export_IO_error("deleting", *resulting_outname)); 634 631 } 635 free(*resulting_outname); 636 } 637 *resulting_outname = 0; 632 freeset(*resulting_outname, 0); 633 } 638 634 } 639 635 … … 667 663 aw_status(fname); 668 664 669 char *oname = GB_strdup(GB_concat_path(path, fname));665 char *oname = strdup(GB_concat_path(path, fname)); 670 666 char *res_oname; 671 667 … … 679 675 (res_oname && strcmp(*resulting_outname, res_oname)>0)) // or smaller than set one 680 676 { 681 free(*resulting_outname); 682 *resulting_outname = res_oname; 683 res_oname = NULL; 677 reassign(*resulting_outname, res_oname); 684 678 } 685 679 … … 801 795 802 796 if (suffix) { 803 if (previous_suffix && ARB_stricmp(suffix, previous_suffix) == 0) { // remove old suffix 804 free(suffix); 805 suffix = GB_strdup(current_suffix); 806 } 807 else { // don't know existing suffix -> append 808 char *new_suffix = GB_strdup(GB_append_suffix(suffix, current_suffix)); 809 free(suffix); 810 suffix = new_suffix; 811 } 812 } 813 else { 814 suffix = GB_strdup(current_suffix); 815 } 797 if (previous_suffix && ARB_stricmp(suffix, previous_suffix) == 0) freedup(suffix, current_suffix); // remove old suffix 798 else freedup(suffix, GB_append_suffix(suffix, current_suffix)); // don't know existing suffix -> append 799 } 800 else suffix = strdup(current_suffix); 816 801 817 802 const char *new_exportname = GB_concat_path(path, GB_append_suffix(nameOnly, suffix)); … … 828 813 829 814 // remember last applied suffix 830 free(previous_suffix); 831 previous_suffix = current_suffix; 832 current_suffix = 0; 815 reassign(previous_suffix, current_suffix); 833 816 } 834 817 -
trunk/AWTI/AWTI_import.cxx
r5695 r5725 790 790 char *h = GBS_string_eval(sequence,ifo->sequencesrt,gb_species); 791 791 if (!h) return GB_get_error(); 792 free(sequence); 793 sequence = h; 792 freeset(sequence, h); 794 793 } 795 794 -
trunk/CONSENSUS_TREE/CT_ntree.cxx
r5390 r5725 97 97 part_free((tree->part)); 98 98 tree->part = NULL; 99 free((char *)tree); 100 tree = NULL; 99 freeset(tree, NULL); 101 100 } 102 101 -
trunk/DIST/DI_matr.cxx
r5660 r5725 226 226 char *DI_MATRIX::unload(void) 227 227 { 228 free(use); 229 use = 0; 228 freeset(use, 0); 230 229 long i; 231 230 for (i=0;i<nentries;i++){ … … 233 232 } 234 233 delete tree_root; 235 // delete [] entries; 236 free(entries); 237 entries = 0; 234 freeset(entries, 0); 238 235 nentries = 0; 239 236 return 0; -
trunk/EDIT4/ED4_base.cxx
r5712 r5725 889 889 sprintf(name, "%s (%d)",name, counter); 890 890 891 free(consensus_name_terminal->id); 892 consensus_name_terminal->id = name; 891 freeset(consensus_name_terminal->id, name); 893 892 894 893 // update_species_counters(); -
trunk/EDIT4/ED4_cursor.cxx
r5655 r5725 833 833 static char *last_set_SAI = 0; 834 834 if (!last_set_SAI || strcmp(last_set_SAI, species_name) != 0) { 835 free(last_set_SAI); 836 last_set_SAI = strdup(species_name); 835 freedup(last_set_SAI, species_name); 837 836 838 837 ignore_selected_SAI_changes_cb = true; … … 844 843 static char *last_set_species = 0; 845 844 if (!last_set_species || strcmp(last_set_species, species_name) != 0) { 846 free(last_set_species); 847 last_set_species = strdup(species_name); 845 freedup(last_set_species, species_name); 848 846 849 847 ignore_selected_species_changes_cb = true; -
trunk/EDIT4/ED4_edit_string.cxx
r5569 r5725 769 769 } 770 770 771 char *aligned_seq = GB_read_string(gb_data); // read new sequence772 ad_err = GB_write_string(gb_data, seq);// restore old sequence773 free(seq); 774 seq = aligned_seq;// set new sequence775 changed_flag =1;// and mark changed771 char *aligned_seq = GB_read_string(gb_data); // read new sequence 772 ad_err = GB_write_string(gb_data, seq); // restore old sequence 773 774 freeset(seq, aligned_seq); // set new sequence 775 changed_flag = 1; // and mark changed 776 776 777 777 { … … 819 819 AW_helix *helix = ED4_ROOT->helix; 820 820 821 if (!helix->has_entries()) { 822 ad_err = GB_strdup("Got no helix information"); 823 } 821 if (!helix->has_entries()) ad_err = strdup("Got no helix information"); 824 822 else if (helix->pairtype(seq_pos) != HELIX_NONE) { 825 823 seq_pos = helix->opposite_position(seq_pos); 826 824 cursor_jump = ED4_JUMP_KEEP_POSITION; 827 825 } 828 else { 829 ad_err = GB_strdup("Not at helix position"); 830 } 826 else ad_err = strdup("Not at helix position"); 831 827 break; 832 828 } … … 1149 1145 } 1150 1146 } 1151 free(seq); 1152 seq = 0; 1147 freeset(seq, 0); 1153 1148 } 1154 1149 } -
trunk/EDIT4/ED4_main.cxx
r5712 r5725 226 226 if (folded_group_man==group_manager) { // we are the consensus of the folded group 227 227 if (folded_group_man->is_in_folded_group()) { // a folded group inside a folded group -> do not show 228 free(seq); 229 seq = 0; 228 freeset(seq, 0); 230 229 } 231 230 else { // group folded but consensus shown -> add '-' before name … … 233 232 234 233 sprintf(new_name, "-%s", name); 235 free(name); 236 name = new_name; 234 freeset(name, new_name); 237 235 name_len++; 238 236 } 239 237 } 240 238 else { // we are really inside a folded group -> don't show 241 free(seq); 242 seq = 0; 239 freeset(seq, 0); 243 240 } 244 241 } -
trunk/EDIT4/ED4_members.cxx
r5483 r5725 202 202 memcpy(new_member_list, memberList, size_of_list*sizeof(*new_member_list)); 203 203 204 free(memberList); 205 memberList = new_member_list; 204 freeset(memberList, new_member_list); 206 205 size_of_list = new_size_of_list; 207 206 } -
trunk/EDIT4/ED4_no_class.cxx
r5712 r5725 1185 1185 } 1186 1186 else { 1187 const char *field_name = ED4_ROOT->aw_root->awar(AWAR_FIELD_CHOSEN)->read_string(); 1188 char *doneContents = strdup(";"); 1189 int tryAgain = 1; 1190 int foundField = 0; 1187 const char *field_name = ED4_ROOT->aw_root->awar(AWAR_FIELD_CHOSEN)->read_string(); 1188 char *doneContents = strdup(";"); 1189 size_t doneLen = 1; 1190 1191 int tryAgain = 1; 1192 int foundField = 0; 1191 1193 int foundSpecies = 0; 1192 1194 … … 1209 1211 1210 1212 if (type==GB_STRING) { 1211 char *field_content = GB_read_as_string(gb_field); 1213 char *field_content = GB_read_as_string(gb_field); 1214 size_t field_content_len = strlen(field_content); 1212 1215 1213 1216 foundField = 1; 1214 if ( strlen(field_content)>SIGNIFICANT_FIELD_CHARS) {1217 if (field_content_len>SIGNIFICANT_FIELD_CHARS) { 1215 1218 field_content[SIGNIFICANT_FIELD_CHARS] = 0; 1219 field_content_len = SIGNIFICANT_FIELD_CHARS; 1216 1220 } 1217 1221 … … 1222 1226 createGroupFromSelected(field_content, field_name, field_content); 1223 1227 tryAgain = 1; 1224 int len = strlen(field_content); 1225 char *newDone = new char[strlen(doneContents)+len+1+1]; 1226 sprintf(newDone, "%s%s;", doneContents, field_content); 1227 free(doneContents); 1228 doneContents = newDone; 1228 1229 int newlen = doneLen + field_content_len + 1; 1230 char *newDone = (char*)malloc(newlen+1); 1231 GBS_global_string_to_buffer(newDone, newlen, "%s%s;", doneContents, field_content); 1232 freeset(doneContents, newDone); 1233 doneLen = newlen; 1229 1234 } 1230 1235 free(field_content); … … 1824 1829 return length; 1825 1830 } 1826 static void freeSpeciesMergeList(SpeciesMergeList sml) 1827 { 1831 static void freeSpeciesMergeList(SpeciesMergeList sml) { 1828 1832 while (sml) { 1829 SpeciesMergeList next = sml->next;1830 1833 free(sml->species_name); 1831 free(sml); 1832 sml = next; 1834 freeset(sml, sml->next); 1833 1835 } 1834 1836 } … … 1911 1913 if (!nameIsUnique(new_species_name, gb_species_data)) { 1912 1914 if (!existingNames) existingNames = new UniqueNameDetector(gb_species_data); 1913 1914 char *uniqueName = AWTC_makeUniqueShortName(new_species_name, *existingNames); 1915 free(new_species_name); 1916 new_species_name = uniqueName; 1917 1915 freeset(new_species_name, AWTC_makeUniqueShortName(new_species_name, *existingNames)); 1918 1916 if (!new_species_name) error = "No short name created."; 1919 1917 } … … 2145 2143 free(content); 2146 2144 2147 free(new_content); 2148 new_content = whole; 2145 freeset(new_content, whole); 2149 2146 new_content_len = strlen(new_content); 2150 2147 } … … 2168 2165 sprintf(new_doneFields, "%s%s;", doneFields, fieldName); 2169 2166 doneLen += fieldLen+1; 2170 free(doneFields); 2171 doneFields = new_doneFields; 2167 freeset(doneFields, new_doneFields); 2172 2168 2173 2169 fieldEnd[0] = ';'; -
trunk/EDIT4/ED4_protein_2nd_structure.cxx
r5655 r5725 988 988 GBDATA *gb_protstruct = GBT_find_SAI(gb_main, SAI_name); 989 989 990 free(*protstruct); 991 *protstruct = 0; 990 freeset(*protstruct, 0); 992 991 993 992 if (gb_protstruct) { -
trunk/EDIT4/ED4_root.cxx
r5712 r5725 1367 1367 if (size2<=0) err = (char *)GB_get_error(); 1368 1368 1369 free(faligner_data->helix_string); 1370 faligner_data->helix_string = 0; 1369 freeset(faligner_data->helix_string, 0); 1371 1370 1372 1371 if (!err) { -
trunk/EDIT4/ED4_search.cxx
r5708 r5725 77 77 AW_root *root = ED4_ROOT->aw_root; 78 78 79 free (pattern);80 pattern = root->awar(awarList->pattern)->read_string(); 79 freeset(pattern, root->awar(awarList->pattern)->read_string()); 80 81 81 min_mismatches = root->awar(awarList->min_mismatches)->read_int(); 82 82 max_mismatches = root->awar(awarList->max_mismatches)->read_int(); … … 179 179 else { 180 180 son = &FOUND; 181 comment = GB_strdup(pattern_comment);181 comment = nulldup(pattern_comment); 182 182 } 183 183 } … … 186 186 c = 0; 187 187 son = 0; 188 comment = GB_strdup(pattern_comment);188 comment = nulldup(pattern_comment); 189 189 } 190 190 brother = 0; -
trunk/EDIT4/ED4_text_terminals.cxx
r5708 r5725 236 236 int i; 237 237 for (i=0;i<ED4_G_DRAG;i++){ 238 free(colored_strings[i]); 239 colored_strings[i] = (char *)malloc(sizeof(char) * (len_of_colored_strings+1)); 240 238 freeset(colored_strings[i], (char *)malloc(sizeof(char) * (len_of_colored_strings+1))); 241 239 memset(colored_strings[i],' ',len_of_colored_strings); 242 240 colored_strings[i][len_of_colored_strings] = 0; … … 397 395 int i; 398 396 for (i=0;i<ED4_G_DRAG;i++){ 399 free(colored_strings[i]); 400 colored_strings[i] = (char *)malloc(sizeof(char) * (len_of_colored_strings+1)); 401 397 freeset(colored_strings[i], (char *)malloc(sizeof(char) * (len_of_colored_strings+1))); 402 398 memset(colored_strings[i],' ',len_of_colored_strings); 403 399 colored_strings[i][len_of_colored_strings] = 0; -
trunk/GENOM/EXP_interface.cxx
r5675 r5725 51 51 52 52 static void EXP_select_experiment(GBDATA* /*gb_main*/, AW_root *aw_root, const char *item_name) { 53 char *name = GB_strdup(item_name);53 char *name = strdup(item_name); 54 54 char *slash = strchr(name, '/'); 55 55 … … 68 68 69 69 static GBDATA *EXP_find_experiment_by_id(GBDATA *gb_main, const char *id) { 70 char *organism = GB_strdup(id);70 char *organism = strdup(id); 71 71 char *exp = strchr(organism, '/'); 72 72 GBDATA *result = 0; … … 146 146 if (!gb_species && old_species_marks) { // got all -> clean up 147 147 GBT_restore_marked_species(GLOBAL_gb_main, old_species_marks); 148 free(old_species_marks); 149 old_species_marks = 0; 148 freeset(old_species_marks, 0); 150 149 } 151 150 -
trunk/GENOM/GEN_interface.cxx
r5660 r5725 31 31 32 32 void GEN_select_gene(GBDATA* /*gb_main*/, AW_root *aw_root, const char *item_name) { 33 char *organism = GB_strdup(item_name);33 char *organism = strdup(item_name); 34 34 char *gene = strchr(organism, '/'); 35 35 … … 51 51 52 52 static GBDATA *gen_find_gene_by_id(GBDATA *gb_main, const char *id) { 53 char *organism = GB_strdup(id);53 char *organism = strdup(id); 54 54 char *gene = strchr(organism, '/'); 55 55 GBDATA *result = 0; … … 142 142 if (!gb_organism && old_species_marks) { // got all -> clean up 143 143 GBT_restore_marked_species(GLOBAL_gb_main, old_species_marks); 144 free(old_species_marks); 145 old_species_marks = 0; 144 freeset(old_species_marks, 0); 146 145 } 147 146 -
trunk/GENOM/GEN_map.cxx
r5660 r5725 737 737 if (!full_species_name) full_species_name = species_name; 738 738 739 char *full_name = GB _strdup(GBS_global_string("%s [%s]", full_species_name, gene_name));739 char *full_name = GBS_global_string_copy("%s [%s]", full_species_name, gene_name); 740 740 char *sequence = GBT_read_gene_sequence(gb_gene, GB_TRUE); 741 741 … … 831 831 } 832 832 833 if (!error) { 834 free(short_name); 835 short_name = newName; 836 } 837 else { 838 free(newName); 839 } 833 if (!error) freeset(short_name, newName); 834 else free(newName); 840 835 } 841 836 else { // different acc, but uses name generated by nameserver -
trunk/GENOM/GEN_nds.cxx
r5330 r5725 65 65 /* toggle set ? */ 66 66 if (GB_read_int(GB_entry(gbz, sf))) { 67 if (gen_nds_ms->dkeys[count]) free(gen_nds_ms->dkeys[count]); 68 gen_nds_ms->dkeys[count] = GB_read_string(GB_entry(gbz, "key_text")); 67 freeset(gen_nds_ms->dkeys[count], GB_read_string(GB_entry(gbz, "key_text"))); 69 68 if (GB_first_non_key_char(gen_nds_ms->dkeys[count])) { 70 69 gen_nds_ms->rek[count] = 1; … … 76 75 // gen_nds_ms->inherit[count] = GB_read_int(GB_entry(gbz, "inherit")); 77 76 gbe = GB_entry(gbz, "pars"); 78 if (gen_nds_ms->parsing[count]) { 79 free(gen_nds_ms->parsing[count]); 80 gen_nds_ms->parsing[count] = 0; 81 } 77 freeset(gen_nds_ms->parsing[count], 0); 82 78 if (gbe && GB_read_string_count(gbe)>1 ) gen_nds_ms->parsing[count] = GB_read_string(gbe); 83 79 count++; -
trunk/MERGE/MG_gene_species.cxx
r5675 r5725 104 104 static char *cur_field = 0; 105 105 106 if (cur_field) { free(cur_field); cur_field = 0; } 107 cur_field = aw_root->awar(AWAR_MERGE_GENE_SPECIES_CURRENT_FIELD)->read_string(); 106 freeset(cur_field, aw_root->awar(AWAR_MERGE_GENE_SPECIES_CURRENT_FIELD)->read_string()); 108 107 109 108 if (cur_field[0]) return field_awar(cur_field, subfield); … … 168 167 mg_assert(!result); 169 168 aci_result = GB_command_interpreter(GLOBAL_gb_merge, "", aci, gb_species, 0); 170 if (!aci_result) { 171 error = GB_get_error(); 172 mg_assert(error); 173 } 169 if (!aci_result) error = GB_expect_error(); 174 170 } 175 171 else { 176 172 if (aci && aci[0]) { 177 173 aci_result = GB_command_interpreter(GLOBAL_gb_merge, result ? result : "", aci, gb_origin, 0); 178 if (!aci_result) { 179 error = GB_get_error(); 180 mg_assert(error); 181 } 182 } 183 } 184 185 if (aci_result) { 186 free(result); 187 result = aci_result; 188 } 189 } 190 191 if (error) { 192 free(result); 193 result = 0; 194 } 174 if (!aci_result) error = GB_expect_error(); 175 } 176 } 177 178 if (aci_result) freeset(result, aci_result); 179 } 180 181 if (error) freeset(result, 0); 195 182 196 183 mg_assert(result||error); … … 278 265 } 279 266 280 // ---------------------------------------------------------281 // static void MG_update_example(AW_root *aw_root)282 // ---------------------------------------------------------283 267 static void MG_update_example(AW_root *aw_root) { 284 268 char *result = 0; … … 286 270 char *curr_species = aw_root->awar(MG_left_AWAR_SPECIES_NAME())->read_string(); 287 271 288 if (!curr_species || !curr_species[0]) { 289 error = "No species selected."; 290 } 272 if (!curr_species || !curr_species[0]) error = "No species selected."; 291 273 else { 292 274 GB_transaction dummy(GLOBAL_gb_merge); … … 301 283 302 284 if (!error && !result) error = "no result"; 303 if (error) { 304 free(result); 305 result = GBS_global_string_copy("<%s>", error); 306 } 285 if (error) freeset(result, GBS_global_string_copy("<%s>", error)); 307 286 308 287 aw_root->awar(AWAR_MERGE_GENE_SPECIES_EXAMPLE)->write_string(result); … … 310 289 free(result); 311 290 } 312 // ----------------------------------------------------------------------- 313 // static void check_and_correct_current_field(char*& cur_field) 314 // ----------------------------------------------------------------------- 291 315 292 static void check_and_correct_current_field(char*& cur_field) { 316 293 if (ARB_stricmp(cur_field, "name") == 0 || ARB_stricmp(cur_field, "acc") == 0) { 317 294 aw_message("rules writing to 'name' or 'acc' are not allowed."); 318 319 char *new_cur_field = new char[strlen(cur_field)+3]; 320 sprintf(new_cur_field, "%s_2", cur_field); 321 free(cur_field); 322 cur_field = new_cur_field; 295 freeset(cur_field, GBS_global_string_copy("%s_not_allowed", cur_field)); 323 296 } 324 297 } … … 327 300 static bool allow_callbacks = true; 328 301 329 // -----------------------------------------------------------------------330 // static void MG_current_field_def_changed_cb(AW_root *aw_root)331 // -----------------------------------------------------------------------332 302 static void MG_current_field_def_changed_cb(AW_root *aw_root) { 333 303 if (allow_callbacks) { -
trunk/MERGE/MG_preserves.cxx
r5675 r5725 51 51 for (i = 0; src_ali_names[i]; ++i) { 52 52 GBDATA *gb_ali_name = GB_find_string(gb_presets, "alignment_name", src_ali_names[i], GB_IGNORE_CASE, down_2_level); 53 if (!gb_ali_name) { 54 free(src_ali_names[i]); 55 src_ali_names[i] = 0; 56 } 53 if (!gb_ali_name) freeset(src_ali_names[i], 0); 57 54 } 58 55 -
trunk/MERGE/MG_species.cxx
r5660 r5725 1017 1017 ++d; 1018 1018 } 1019 else { 1020 free(D_alignment_names[s]); 1021 D_alignment_names[s] = 0; 1022 } 1019 else freeset(D_alignment_names[s], 0); 1023 1020 free(type2); 1024 1021 } … … 1112 1109 GBDATA *M_species; 1113 1110 GBDATA *D_species; 1114 free (m_name); m_name = 0;1111 freeset(m_name, 0); 1115 1112 1116 1113 { … … 1143 1140 1144 1141 mg_assert(newname); 1145 1146 free(m_name); 1147 m_name = newname; 1142 freeset(m_name, newname); 1148 1143 } 1149 1144 else { … … 1172 1167 free(newname); 1173 1168 1174 free(m_name); 1175 m_name = aw_input("New name of species",NEW_NAME_AWAR); 1176 1169 freeset(m_name, aw_input("New name of species", NEW_NAME_AWAR)); 1177 1170 goto new_try; 1178 1171 } -
trunk/MULTI_PROBE/MP_Window.cxx
r5625 r5725 137 137 138 138 static char *word_buffer = 0; 139 if (word_buffer) free(word_buffer); 140 word_buffer = (char*)malloc(wordlen+1); 141 memcpy(word_buffer, line, wordlen); 142 word_buffer[wordlen] = 0; 139 freeset(word_buffer, GB_strndup(line, wordlen)); 143 140 144 141 line = behind_word; -
trunk/MULTI_PROBE/MP_probe.cxx
r3549 r5725 294 294 result_struct *elem; 295 295 296 for (i=0; i<size_sonden_array; i++) 297 free(sondenarray[i]); 298 299 for (i=0; i<pool_length; i++) 300 delete probe_pool[i]; 296 for (i=0; i<size_sonden_array; i++) free(sondenarray[i]); 297 for (i=0; i<pool_length; i++) delete probe_pool[i]; 301 298 302 299 elem = computation_result_list->get_first(); 303 while (elem) 304 { 300 while (elem) { 305 301 computation_result_list->remove_first(); 306 302 delete [] elem->view_string; … … 311 307 delete computation_result_list; 312 308 313 if (act_generation == child_generation) 314 delete act_generation; 315 else 316 { 309 if (act_generation == child_generation) delete act_generation; 310 else { 317 311 delete act_generation; 318 312 delete child_generation; -
trunk/MULTI_PROBE/MP_sonde.cxx
r5003 r5725 82 82 83 83 mp_pd_gl.link = (aisc_com *)aisc_open(servername, &mp_pd_gl.com,AISC_MAGIC_NUMBER); 84 free (servername); servername = 0;84 freeset(servername, 0); 85 85 86 86 if (!mp_pd_gl.link) { -
trunk/NALIGNER/ali_main.cxx
r4932 r5725 307 307 align_profile = new ALI_PROFILE(align_sequence,&aligs.prof_context); 308 308 309 /* 309 /* 310 310 * write information about the profile to the database 311 311 */ … … 313 313 char *String = align_profile->cheapest_sequence(); 314 314 aligs.arbdb.put_extended("ALI_CON",String); 315 free(String); 316 String = align_profile->borders_sequence(); 315 freeset(String, align_profile->borders_sequence()); 317 316 // aligs.arbdb.put_extended("ALI_BOR",string,0); 318 317 free(String); … … 343 342 String = align_pre_sequence_i->string(); 344 343 aligs.arbdb.put_extended("ALI_PRE_I",String); 345 free(String); 346 String = align_pre_sequence->string(); 344 freeset(String, align_pre_sequence->string()); 347 345 aligs.arbdb.put_extended("ALI_PRE",String); 348 346 free(String); -
trunk/NALIGNER/ali_pathmap.cxx
r4912 r5725 27 27 unsigned long l; 28 28 29 if (pathmap) 30 free((char *) pathmap); 29 if (pathmap) free((char *) pathmap); 31 30 if (up_pointers) { 32 31 for (l = 0; l < width; l++) -
trunk/NAMES/names.cxx
r5356 r5725 584 584 585 585 parsed_sym = GBS_string_eval(full_name, "\t= :* * *sym*=S",0); 586 if (strlen(parsed_sym)>1) { 587 free(parsed_sym); 588 parsed_sym = strdup(""); 589 } 586 if (strlen(parsed_sym)>1) freedup(parsed_sym, ""); 590 587 591 588 parsed_acc = make_alnum(locs->acc); … … 594 591 rest_of_name = make_alnum(parsed_name+strlen(first_name)); 595 592 596 { 597 char *first_name_an = make_alnum(first_name); 598 free(first_name); 599 first_name = first_name_an; 600 } 593 freeset(first_name, make_alnum(first_name)); 601 594 602 595 assert_alnum(parsed_acc); … … 649 642 { 650 643 static char *shrt = 0; 651 if (shrt) { 652 free(shrt); 653 shrt = 0; 654 } 644 645 freeset(shrt, 0); 655 646 656 647 NameInformation info(locs); … … 706 697 gb_assert(first_short); 707 698 if (first_short[0] == 0) { // empty? 708 free(first_short); 709 first_short = strdup("Xxx"); 699 freedup(first_short, "Xxx"); 710 700 } 711 701 first_len = strlen(first_short); … … 746 736 int both_len = first_len+second_len; 747 737 if (both_len<8) { 748 char *new_second = GBS_global_string_copy("%s00000000", second_short); 749 free(second_short); 750 second_short = new_second; 751 second_len += 8; 752 both_len += 8; 738 freeset(second_short, GBS_global_string_copy("%s00000000", second_short)); 739 second_len += 8; 740 both_len += 8; 753 741 } 754 742 -
trunk/NTREE/AP_cprofile.cxx
r5634 r5725 200 200 static void CPRO_deallocate(char **&speciesdata,GBDATA **&speciesdatabase) 201 201 { 202 for (long i=0;i<CPRO.numspecies;i++) { 203 if (speciesdata[i]) { 204 free(speciesdata[i]); 205 speciesdata[i]=0; 206 } 207 } 208 free(speciesdata); speciesdata=0; 202 for (long i=0;i<CPRO.numspecies;i++) freeset(speciesdata[i], 0); 203 freeset(speciesdata, 0); 209 204 210 205 free(speciesdatabase); … … 226 221 { 227 222 for(long j=0;j<CPRO.result[which_statistic].resolution*3;j++) { 228 if(CPRO.result[which_statistic].statistic[j]) { 229 delete(CPRO.result[which_statistic].statistic[j]); 230 CPRO.result[which_statistic].statistic[j]=0; 231 } 232 } 233 free(CPRO.result[which_statistic].statistic); 234 CPRO.result[which_statistic].statistic=0; 223 freeset(CPRO.result[which_statistic].statistic[j], 0); 224 } 225 freeset(CPRO.result[which_statistic].statistic, 0); 235 226 } 236 227 … … 263 254 } 264 255 } 265 if(hits) { 266 memneeded+=CPRO.result[which_statistic].maxalignlen; 267 } 268 else { 269 free(CPRO.result[which_statistic].statistic[base+0]); 270 CPRO.result[which_statistic].statistic[base+0]=0; 271 } 272 if (group) { 273 memneeded+=CPRO.result[which_statistic].maxalignlen; 274 } 275 else { 276 free(CPRO.result[which_statistic].statistic[base+1]); 277 CPRO.result[which_statistic].statistic[base+1]=0; 278 } 279 if(different) { 280 memneeded+= CPRO.result[which_statistic].maxalignlen; 281 } 282 else { 283 free(CPRO.result[which_statistic].statistic[base+2]); 284 CPRO.result[which_statistic].statistic[base+2]=0; 285 } 256 if (hits) memneeded += CPRO.result[which_statistic].maxalignlen; 257 else freeset(CPRO.result[which_statistic].statistic[base+0], 0); 258 259 if (group) memneeded += CPRO.result[which_statistic].maxalignlen; 260 else freeset(CPRO.result[which_statistic].statistic[base+1], 0); 261 262 if (different) memneeded += CPRO.result[which_statistic].maxalignlen; 263 else freeset(CPRO.result[which_statistic].statistic[base+2], 0); 286 264 } 287 265 if(!CPRO.result[which_statistic].maxaccu) CPRO.result[which_statistic].maxaccu=1; -
trunk/NTREE/AP_csp_2_gnuplot.cxx
r5695 r5725 46 46 dir[lslash-fname] = 0; // cut off at last '/' 47 47 48 char *name_prefix = GB_strdup(lslash+1);48 char *name_prefix = strdup(lslash+1); 49 49 char *name_postfix = 0; 50 50 char *ldot = strrchr(name_prefix, '.'); 51 51 52 if (ldot) { 52 53 ldot[0] = 0; 53 name_postfix = GB_strdup(ldot+1); 54 } 55 if (!ldot || name_prefix[0] == 0) { // no dot or empty name_prefix 56 free(name_prefix); 57 name_prefix = GB_strdup("*"); 58 } 59 if (!name_postfix || name_postfix[0] == 0) { 60 free(name_postfix); 61 name_postfix = GB_strdup("*_gnu"); 62 } 54 name_postfix = strdup(ldot+1); 55 } 56 if (!ldot || name_prefix[0] == 0) freedup(name_prefix, "*"); // no dot or empty name_prefix 57 if (!name_postfix || name_postfix[0] == 0) freedup(name_postfix, "*_gnu"); 63 58 64 59 nt_assert(name_prefix); … … 85 80 char *found_files = 0; 86 81 if (!error) { 87 char *mask = GB _strdup(GBS_global_string("%s.*_gnu", name_prefix));82 char *mask = GBS_global_string_copy("%s.*_gnu", name_prefix); 88 83 char *found_prefix_files = overlay_prefix ? GB_find_all_files(dir, mask, GB_FALSE) : 0; 89 84 free(mask); 90 85 91 mask = GB _strdup(GBS_global_string("*.%s", name_postfix));86 mask = GBS_global_string_copy("*.%s", name_postfix); 92 87 char *found_postfix_files = overlay_postfix ? GB_find_all_files(dir, mask, GB_FALSE) : 0; 93 88 free(mask); … … 95 90 if (found_prefix_files) { 96 91 if (found_postfix_files) { 97 found_files = GB _strdup(GBS_global_string("%s*%s", found_prefix_files, found_postfix_files));92 found_files = GBS_global_string_copy("%s*%s", found_prefix_files, found_postfix_files); 98 93 } 99 94 else { // only found_prefix_files … … 190 185 if (rdot) pt = string2PlotType(rdot+1); 191 186 192 static char *title = 0;193 free (title); title = 0;187 static char *title = 0; 188 freeset(title, 0); 194 189 195 190 if (pt == PT_UNKNOWN) { … … 235 230 if (!error) { 236 231 char *fname = aww->get_root()->awar(AP_AWAR_CSP_FILENAME)->read_string(); 237 if (!strchr(fname, '/')) { 238 char *neu = GB_strdup(GBS_global_string("./%s", fname)); 239 free(fname); 240 fname = neu; 241 } 242 243 if (strlen(fname) < 1) { 244 error = "Please enter file name"; 245 } 232 233 if (!strchr(fname, '/')) freeset(fname, GBS_global_string_copy("./%s", fname)); 234 if (strlen(fname) < 1) error = "Please enter file name"; 246 235 247 236 if (mode == 2) { // delete overlay files … … 378 367 379 368 if (mode == 1) { 380 char *script = GB _strdup(GBS_global_string("gnuplot %s && rm -f %s", command_file, command_file));369 char *script = GBS_global_string_copy("gnuplot %s && rm -f %s", command_file, command_file); 381 370 GB_xcmd(script, GB_TRUE, GB_TRUE); 382 371 free(script); -
trunk/NTREE/AP_pos_var_pars.cxx
r5589 r5725 337 337 root->awar_string(AWAR_PVP_TREE, "tree_full",AW_ROOT_DEFAULT); 338 338 root->awar(AWAR_PVP_TREE)->write_string(largest_tree); 339 free (largest_tree); largest_tree = 0;339 freeset(largest_tree, 0); 340 340 341 341 aws->at("close");aws->callback((AW_CB0)AW_POPDOWN); -
trunk/NTREE/NT_concatenate.cxx
r5660 r5725 591 591 592 592 free(content); 593 free(new_content); 594 new_content = whole; 593 freeset(new_content, whole); 595 594 new_content_len = strlen(new_content); 596 595 } … … 614 613 sprintf(new_doneFields, "%s%s;", doneFields, fieldName); 615 614 doneLen += fieldLen+1; 616 free(doneFields); 617 doneFields = new_doneFields; 615 freeset(doneFields, new_doneFields); 618 616 fieldEnd[0] = ';'; 619 617 } … … 710 708 if (GBT_find_species_rel_species_data(gb_species_data, new_species_name) != 0) { //if the name is not unique create unique name 711 709 UniqueNameDetector und(gb_species_data); 712 char *uniqueName = AWTC_makeUniqueShortName(new_species_name, und); 713 free(new_species_name); 714 new_species_name = uniqueName; 710 freeset(new_species_name, AWTC_makeUniqueShortName(new_species_name, und)); 715 711 if (!new_species_name) error = "No short name created."; 716 712 } -
trunk/NTREE/NT_extern.cxx
r5714 r5725 757 757 758 758 if (name) { 759 free(ref_name); 760 ref_name = name; 759 freeset(ref_name, name); 761 760 ref_gb_node = gb_organism; 762 761 } -
trunk/NTREE/NT_main.cxx
r5692 r5725 436 436 bool abort = false; 437 437 bool start_db_browser = true; 438 char *browser_startdir = GB_strdup(".");438 char *browser_startdir = strdup("."); 439 439 440 440 if (argc>=2) { … … 529 529 } 530 530 case 2: { // Browse 531 char *dir = GB_strdup(full_path); 532 while (dir && !AWT_is_dir(dir)) { 533 char *updir = AWT_extract_directory(dir); 534 free(dir); 535 dir = updir; 536 } 531 char *dir = nulldup(full_path); 532 while (dir && !AWT_is_dir(dir)) freeset(dir, AWT_extract_directory(dir)); 537 533 538 534 if (dir) { 539 535 nt_assert(AWT_is_dir(dir)); 540 541 free(browser_startdir); 542 browser_startdir = dir; 543 dir = 0; 536 reassign(browser_startdir, dir); 544 537 start_db_browser = true; 545 538 } -
trunk/PARSIMONY/AP_tree_edge.cxx
r5405 r5725 674 674 text = "100%"; 675 675 } 676 delete son_node->remark_branch; 677 delete son_node->Brother()->remark_branch; 678 son_node->remark_branch = GB_strdup(text); 679 son_node->Brother()->remark_branch = GB_strdup(text); 680 } 681 delete AP_sequence::static_mutation_per_site[0]; 682 delete AP_sequence::static_mutation_per_site[1]; 683 delete AP_sequence::static_mutation_per_site[2]; 684 685 AP_sequence::static_mutation_per_site[0] = 0; 686 AP_sequence::static_mutation_per_site[1] = 0; 687 AP_sequence::static_mutation_per_site[2] = 0; 688 676 freedup(son_node->remark_branch, text); 677 freedup(son_node->Brother()->remark_branch, text); 678 } 679 680 freeset(AP_sequence::static_mutation_per_site[0], NULL); 681 freeset(AP_sequence::static_mutation_per_site[1], NULL); 682 freeset(AP_sequence::static_mutation_per_site[2], NULL); 689 683 } 690 684 -
trunk/PGT/config_dialog.cxx
r3978 r5725 690 690 * CALLBACK - COLOR/TEXT CHANGED 691 691 ****************************************************************************/ 692 void configDialog::textChangedCallback(Widget widget) 693 {692 693 inline void setColorFromTextWidget(Widget widget, char *& colorStringVar) { 694 694 int r, g, b; // DUMMY RGB VALUES 695 696 // CROSSHAIR TEXT-WIDGET CHANGED? 697 if(widget == m_crosshairText) 698 { 699 char *crosshairColorString= XmTextGetString(m_crosshairText); 700 701 if(hex2rgb(&r, &g, &b, crosshairColorString)) 702 { 703 if(m_crosshairColorString) free(m_crosshairColorString); 704 m_crosshairColorString= crosshairColorString; 705 } 706 else free(crosshairColorString); 707 } 708 // UNMARKED TEXT-WIDGET CHANGED? 709 else if(widget == m_unmarkedText) 710 { 711 char *unmarkedColorString= XmTextGetString(m_unmarkedText); 712 713 if(hex2rgb(&r, &g, &b, unmarkedColorString)) 714 { 715 if(m_unmarkedColorString) free(m_unmarkedColorString); 716 m_unmarkedColorString= unmarkedColorString; 717 } 718 else free(unmarkedColorString); 719 } 720 // MARKED TEXT-WIDGET CHANGED? 721 else if(widget == m_markedText) 722 { 723 char *markedColorString= XmTextGetString(m_markedText); 724 725 if(hex2rgb(&r, &g, &b, markedColorString)) 726 { 727 if(m_markedColorString) free(m_markedColorString); 728 m_markedColorString= markedColorString; 729 } 730 else free(markedColorString); 731 } 732 // SELECTED TEXT-WIDGET CHANGED? 733 else if(widget == m_selectedText) 734 { 735 char *selectedColorString= XmTextGetString(m_selectedText); 736 737 if(hex2rgb(&r, &g, &b, selectedColorString)) 738 { 739 if(m_selectedColorString) free(m_selectedColorString); 740 m_selectedColorString= selectedColorString; 741 } 742 else free(selectedColorString); 743 } 744 // INFOTEXT TEXT-WIDGET CHANGED? 745 else if(widget == m_textText) 746 { 747 char *textColorString= XmTextGetString(m_textText); 748 749 if(hex2rgb(&r, &g, &b, textColorString)) 750 { 751 if(m_textColorString) free(m_textColorString); 752 m_textColorString= textColorString; 753 } 754 else free(textColorString); 755 } 756 // PROTEIN-ID TEXT-WIDGET CHANGED? 757 else if(widget == m_ID_ProteinText) 758 { 759 if(m_id_protein) free(m_id_protein); 760 m_id_protein= XmTextGetString(m_ID_ProteinText); 761 } 762 // GENE-ID TEXT-WIDGET CHANGED? 763 else if(widget == m_ID_GeneText) 764 { 765 if(m_id_gene) free(m_id_gene); 766 m_id_gene= XmTextGetString(m_ID_GeneText); 767 } 768 // PROTEIN-TEXT TEXT-WIDGET CHANGED? 769 else if(widget == m_info_ProteinText) 770 { 771 if(m_info_protein) free(m_info_protein); 772 m_info_protein= XmTextGetString(m_info_ProteinText); 773 } 774 // GENE-TEXT TEXT-WIDGET CHANGED? 775 else if(widget == m_info_GeneText) 776 { 777 if(m_info_gene) free(m_info_gene); 778 m_info_gene= XmTextGetString(m_info_GeneText); 779 } 780 781 782 783 // // GET TEXT FIELD ENTRIES 784 // char *crosshairText= XmTextGetString(m_crosshairText); 785 // char *unmarkedText= XmTextGetString(m_unmarkedText); 786 // char *markedText= XmTextGetString(m_markedText); 787 // char *selectedText= XmTextGetString(m_selectedText); 788 // char *textText= XmTextGetString(m_textText); 789 // 790 // char *id_proteinText= XmTextGetString(m_ID_ProteinText); 791 // char *id_geneText= XmTextGetString(m_ID_GeneText); 792 // char *info_proteinText= XmTextGetString(m_info_ProteinText); 793 // char *info_geneText= XmTextGetString(m_info_GeneText); 794 // 795 // // UPDATE RELATED WIDGET 796 // if((widget == m_crosshairText) 797 // && (hex2rgb(&r, &g, &b, crosshairText))) m_crosshairColorString= crosshairText; 798 // 799 // else if((widget == m_unmarkedText) 800 // && (hex2rgb(&r, &g, &b, unmarkedText))) m_unmarkedColorString= unmarkedText; 801 // 802 // else if((widget == m_markedText) 803 // && (hex2rgb(&r, &g, &b, markedText))) m_markedColorString= markedText; 804 // 805 // else if((widget == m_selectedText) 806 // && (hex2rgb(&r, &g, &b, selectedText))) m_selectedColorString= selectedText; 807 // 808 // else if((widget == m_textText) 809 // && (hex2rgb(&r, &g, &b, textText))) m_textColorString= textText; 810 // 811 // else if(widget == m_ID_ProteinText) m_id_protein= id_proteinText; 812 // else if(widget == m_ID_GeneText) m_id_gene= id_geneText; 813 // else if(widget == m_info_ProteinText) m_info_protein= info_proteinText; 814 // else if(widget == m_info_GeneText) m_info_gene= info_geneText; 815 816 // UPDATE THE COLORS 817 updateColors(); 695 char *colorString = XmTextGetString(widget); 696 if(hex2rgb(&r, &g, &b, colorString)) freeset(colorStringVar, colorString); 697 else free(colorString); 698 } 699 700 void configDialog::textChangedCallback(Widget widget) { 701 if (widget == m_crosshairText) setColorFromTextWidget(m_crosshairText, m_crosshairColorString); // CROSSHAIR TEXT-WIDGET CHANGED? 702 else if (widget == m_unmarkedText) setColorFromTextWidget(m_unmarkedText, m_unmarkedColorString); // UNMARKED TEXT-WIDGET CHANGED? 703 else if (widget == m_markedText) setColorFromTextWidget(m_markedText, m_markedColorString); // MARKED TEXT-WIDGET CHANGED? 704 else if (widget == m_selectedText) setColorFromTextWidget(m_selectedText, m_selectedColorString); // SELECTED TEXT-WIDGET CHANGED? 705 else if (widget == m_textText) setColorFromTextWidget(m_textText, m_textColorString); // INFOTEXT TEXT-WIDGET CHANGED? 706 else if (widget == m_ID_ProteinText) freeset(m_id_protein, XmTextGetString(m_ID_ProteinText)); // PROTEIN-ID TEXT-WIDGET CHANGED? 707 else if (widget == m_ID_GeneText) freeset(m_id_gene, XmTextGetString(m_ID_GeneText)); // GENE-ID TEXT-WIDGET CHANGED? 708 else if (widget == m_info_ProteinText) freeset(m_info_protein, XmTextGetString(m_info_ProteinText)); // PROTEIN-TEXT TEXT-WIDGET CHANGED? 709 else if (widget == m_info_GeneText) freeset(m_info_gene, XmTextGetString(m_info_GeneText)); // GENE-TEXT TEXT-WIDGET CHANGED? 710 711 updateColors(); // UPDATE THE COLORS 818 712 } 819 713 -
trunk/PGT/dialog.cxx
r5648 r5725 304 304 static char *pixmapPath(const char *pixmapName) 305 305 { 306 return GB_strdup(GB_path_in_ARBLIB("pixmaps/pgt", pixmapName));306 return nulldup(GB_path_in_ARBLIB("pixmaps/pgt", pixmapName)); 307 307 } 308 308 -
trunk/PGT/image_dialog.cxx
r5309 r5725 1627 1627 1628 1628 // RESET SPOT COUNTER VALUES 1629 m_numSpots= 0; 1630 m_numMarkedSpots= 0; 1631 m_numSelectedSpots= 0; 1632 if(m_selectedSpotName) 1633 { 1634 free(m_selectedSpotName); 1635 m_selectedSpotName= NULL; 1636 } 1629 m_numSpots = 0; 1630 m_numMarkedSpots = 0; 1631 m_numSelectedSpots = 0; 1632 freeset(m_selectedSpotName, NULL); 1637 1633 1638 1634 // ITERATE THROUGH THE SPOTS -
trunk/PGT/import_dialog.cxx
r3978 r5725 1093 1093 { 1094 1094 // CLEAR OLD HEADER, IF AVAILABLE 1095 if(header[i])1096 {1097 free(header[i]);1098 header[i]= NULL;1099 }1100 1101 1095 // CLEAN STRING FOR USAGE AS ARB KEY 1102 header[i]= GBS_string_2_key(cell[i]);1096 freeset(header[i], GBS_string_2_key(cell[i])); 1103 1097 } 1104 1098 -
trunk/PGT/main_dialog.cxx
r3986 r5725 290 290 { 291 291 // GET AWAR CONTENT 292 char *species_AWAR =get_species_AWAR();293 char *experiment_AWAR = get_experiment_AWAR();294 char *proteome_AWAR =get_proteom_AWAR();295 char *protein_AWAR =get_protein_AWAR();292 char *species_AWAR = get_species_AWAR(); 293 char *experiment_AWAR = get_experiment_AWAR(); 294 char *proteome_AWAR = get_proteom_AWAR(); 295 char *protein_AWAR = get_protein_AWAR(); 296 296 297 297 // SET DEFAULT CONTENT IF AWAR IS EMPTY 298 if(!species_AWAR || strlen(species_AWAR) == 0) 299 { 300 if(species_AWAR) free(species_AWAR); 301 species_AWAR= strdup("no selected species"); 302 } 303 if(!experiment_AWAR || strlen(experiment_AWAR) == 0) 304 { 305 if(experiment_AWAR) free(experiment_AWAR); 306 experiment_AWAR= strdup("no selected experiment"); 307 } 308 if(!proteome_AWAR || strlen(proteome_AWAR) == 0) 309 { 310 if(proteome_AWAR) free(proteome_AWAR); 311 proteome_AWAR= strdup("no selected proteome"); 312 } 313 if(!protein_AWAR || strlen(protein_AWAR) == 0) 314 { 315 if(protein_AWAR) free(protein_AWAR); 316 protein_AWAR= strdup("no selected protein"); 317 } 318 298 if (!species_AWAR || !species_AWAR[0]) freedup(species_AWAR, "no selected species"); 299 if (!experiment_AWAR || !experiment_AWAR[0]) freedup(experiment_AWAR, "no selected experiment"); 300 if (!proteome_AWAR || !proteome_AWAR[0]) freedup(proteome_AWAR, "no selected proteome"); 301 if (!protein_AWAR || !protein_AWAR[0]) freedup(protein_AWAR, "no selected protein"); 302 319 303 // SET TEXT FIELD ENTRIES 320 304 XtVaSetValues(m_speciesText, XmNvalue, species_AWAR, NULL); -
trunk/PHYLO/PH_data.cxx
r5689 r5725 13 13 struct PHENTRY *phentry; 14 14 15 free(use); 16 use = 0; 17 for(phentry=entries;phentry;phentry=phentry->next) 18 { free(phentry->name); 15 freeset(use, 0); 16 for (phentry=entries;phentry;phentry=phentry->next) { 17 free(phentry->name); 19 18 free(phentry->full_name); 20 19 free((char *) phentry); -
trunk/PHYLO/PH_main.cxx
r5695 r5725 264 264 strcpy(digit_appended+fname_len, "0"); 265 265 266 free(fname); 267 fname = digit_appended; 266 freeset(fname, digit_appended); 268 267 } 269 268 GBDATA *gb_sai[3]; -
trunk/PRIMER_DESIGN/primer_design.cxx
r5630 r5725 345 345 gene_sequence[gene_length] = 0; 346 346 347 free(sequence); 348 sequence = gene_sequence; 347 freeset(sequence, gene_sequence); 349 348 length = gene_length; 350 349 add_offset = gene_start; -
trunk/PROBE/PT_etc.cxx
r5390 r5725 23 23 psg.w_N_mismatches[i] = i; 24 24 } 25 void pt_export_error(PT_local *locs, const char *error) 26 { 27 if (locs->ls_error) free(locs->ls_error); 28 locs->ls_error = strdup(error); 25 26 void pt_export_error(PT_local *locs, const char *error) { 27 freedup(locs->ls_error, error); 29 28 } 30 29 … … 218 217 219 218 char *result = not_found ? GBS_strclose(not_found) : 0; 220 if (error) { 221 free(result); 222 result = 0; 223 } 219 if (error) freeset(result, 0); 224 220 return result; 225 221 } -
trunk/PROBE/PT_io.cxx
r5660 r5725 149 149 strcpy(buffer,data); 150 150 buffer[len++] = '.'; 151 free(data); 152 data = buffer; 151 freeset(data, buffer); 153 152 } 154 153 *psize = len; -
trunk/PROBE/PT_match.cxx
r5669 r5725 347 347 PT_probematch *ml; 348 348 char *rev_pro; 349 if (locs->pm_sequence) free(locs->pm_sequence); 350 locs->pm_sequence = psg.main_probe = strdup(probestring); 349 350 freedup(locs->pm_sequence, probestring); 351 psg.main_probe = locs->pm_sequence; 352 351 353 compress_data(probestring); 352 354 while ((ml = locs->pm)) destroy_PT_probematch(ml); … … 393 395 psg.reversed = 0; 394 396 395 if (locs->pm_sequence) free(locs->pm_sequence);396 locs->pm_sequence = psg.main_probe = strdup(probestring);397 freedup(locs->pm_sequence, probestring); 398 psg.main_probe = locs->pm_sequence; 397 399 398 400 psg.deep = locs->pm_max; … … 408 410 rev_pro = reverse_probe(probestring,0); 409 411 complement_probe(rev_pro,0 ); 410 if (locs->pm_csequence) free(locs->pm_csequence); 411 locs->pm_csequence = psg.main_probe = strdup(rev_pro); 412 freeset(locs->pm_csequence, psg.main_probe = strdup(rev_pro)); 412 413 if (psg.deep >=0 ){ 413 414 get_info_about_probe(locs, rev_pro, psg.pt, 0, 0.0, 0, 0); … … 586 587 587 588 static char *result = 0; 588 if (result) free(result); 589 result = GBS_strclose(memfile); 590 589 freeset(result, GBS_strclose(memfile)); 591 590 return result; 592 591 } … … 626 625 627 626 static char *result = 0; 628 if (result) free(result); 629 result = GBS_strclose(memfile); 627 freeset(result, GBS_strclose(memfile)); 630 628 631 629 return result; -
trunk/PROBE_DESIGN/SaiProbeVisualization.hxx
r4773 r5725 77 77 void setHeadline(const char *hline) { 78 78 sai_assert(hline); 79 free(headline); 80 headline = strdup(hline); 79 freedup(headline, hline); 81 80 } 82 81 }; -
trunk/PROBE_DESIGN/probe_design.cxx
r5660 r5725 1548 1548 GB_ERROR error = 0; 1549 1549 1550 if (mod_mode == TS_MOD_CLEAR) { 1551 target_string[0] = 0; 1552 } 1550 if (mod_mode == TS_MOD_CLEAR) target_string[0] = 0; 1553 1551 else { 1554 1552 GB_transaction dummy(GLOBAL_gb_main); … … 1562 1560 char T_or_U; 1563 1561 error = GBT_determine_T_or_U(ali_type, &T_or_U, "complement"); 1564 if (!error) { 1565 char *new_target_string = GBT_complementNucSequence(target_string, strlen(target_string), T_or_U); 1566 free(target_string); 1567 target_string = new_target_string; 1568 } 1569 } 1570 } 1571 1572 if (error) { 1573 aw_message(error); 1574 } 1575 else { 1576 root->awar(AWAR_TARGET_STRING)->write_string(target_string); 1577 } 1562 if (!error) freeset(target_string, GBT_complementNucSequence(target_string, strlen(target_string), T_or_U)); 1563 } 1564 } 1565 1566 if (error) aw_message(error); 1567 else root->awar(AWAR_TARGET_STRING)->write_string(target_string); 1578 1568 free(target_string); 1579 1569 } … … 2076 2066 if (pg_global.pg_main) { 2077 2067 GB_close(pg_global.pg_main); 2078 free(pg_global.pg_filename);2079 2080 2068 pg_global.pg_main = 0; 2081 pg_global.pg_filename = 0;2069 freeset(pg_global.pg_filename, 0); 2082 2070 } 2083 2071 … … 2144 2132 else { 2145 2133 error = GB_export_error("Can't open database '%s'", file_name); 2146 free(pg_global.pg_filename); 2147 pg_global.pg_filename = 0; 2134 freeset(pg_global.pg_filename, 0); 2148 2135 } 2149 2136 … … 2190 2177 // -------------------------------------------------------------------------------- 2191 2178 AW_window *create_probe_group_result_window(AW_root *awr, AW_default cl_AW_canvas_ntw){ 2192 if (pg_global.awar_pg_result_filename) { 2193 free(pg_global.awar_pg_result_filename); 2194 pg_global.awar_pg_result_filename = 0; 2195 } 2196 2179 freeset(pg_global.awar_pg_result_filename, 0); 2197 2180 pg_global.ntw = (AWT_canvas*)cl_AW_canvas_ntw; 2198 2181 -
trunk/PROBE_SERVER/PROBE_GROUP/pg_main.cxx
r5675 r5725 303 303 convert_commas_to_underscores(fullname); 304 304 } 305 else { 306 error = GBS_global_string("no 'full_name' for species '%s'", node->name); 307 } 305 else error = GBS_global_string("no 'full_name' for species '%s'", node->name); 308 306 309 307 if (!error) { … … 313 311 convert_commas_to_underscores(acc); 314 312 } 315 else { 316 error = GBS_global_string("no 'acc' for species '%s'", node->name); 317 } 318 } 319 } 320 else { 321 error = "Unlinked leaf node"; 322 } 323 324 if (!error) { 325 free(node->name); 326 node->name = encodeTreeNode(GBS_global_string("%i,%s,%s", id, fullname, acc)); 327 } 313 else error = GBS_global_string("no 'acc' for species '%s'", node->name); 314 } 315 } 316 else error = "Unlinked leaf node"; 317 318 if (!error) freeset(node->name, encodeTreeNode(GBS_global_string("%i,%s,%s", id, fullname, acc))); 328 319 329 320 free(acc); … … 844 835 static void unlinkTreeAndFreeNodeInfo(GBT_TREE *tree) { 845 836 tree->gb_node = 0; 846 free(tree->name); 847 tree->name = 0; 837 freeset(tree->name, 0); 848 838 849 839 if (!tree->is_leaf) { -
trunk/PROBE_SERVER/PROBE_GROUP/pg_search.cxx
r5428 r5725 115 115 116 116 print("Search a free running pt-server.."); 117 current_server_name = GB_strdup(PG_probe_pt_look_for_server(gb_main, servername, error));117 current_server_name = nulldup(PG_probe_pt_look_for_server(gb_main, servername, error)); 118 118 pg_assert(error || current_server_name); 119 119 server_initialized = true;; … … 125 125 // ------------------------------------- 126 126 void PG_exit_pt_server(void) { 127 free(current_server_name); 128 current_server_name = 0; 127 freeset(current_server_name, 0); 129 128 server_initialized = false; 130 129 } … … 206 205 if (ok) { 207 206 static char *result; 208 if (result) { free(result); result = 0; }207 freeset(result, 0); 209 208 210 209 ok = aisc_get(fpd.gl.link, PT_PEP, fpd.pep, PEP_RESULT, &result, NULL)==0; … … 252 251 253 252 static char *this_result; 254 if (this_result) { 255 free(this_result); 256 this_result = 0; 257 } 253 freeset(this_result, 0); 258 254 259 255 char *spunkt = strchr(result_ptr, ';'); … … 404 400 if (!error && locs_error && locs_error[0]) { 405 401 static char *err = 0; 406 407 if (err) free(err); 408 err = locs_error; 409 locs_error = 0; 410 402 reassign(err, locs_error); 411 403 error = err; 412 404 } -
trunk/PROBE_SERVER/PROBE_GROUP_DESIGN/pgd_main.cxx
r5356 r5725 181 181 GLOBAL_out.put("Search a free running pt-server.."); 182 182 indent i(GLOBAL_out); 183 current_server_name = GB_strdup(PGD_probe_pt_look_for_server(gb_main,servername,error));183 current_server_name = nulldup(PGD_probe_pt_look_for_server(gb_main,servername,error)); 184 184 if (!error) server_initialized = true; 185 185 } … … 188 188 189 189 static void PG_exit_pt_server(void) { 190 free(current_server_name); 191 current_server_name = 0; 190 freeset(current_server_name, 0); 192 191 server_initialized = false; 193 192 } … … 589 588 else { 590 589 *acc++ = 0; 591 592 char *newName2 = GBS_global_string_copy("n=%s,f=%s,a=%s", shortname.c_str(), fullname, acc); 593 594 free(newName); 595 newName = newName2; 590 freeset(newName, GBS_global_string_copy("n=%s,f=%s,a=%s", shortname.c_str(), fullname, acc)); 596 591 } 597 592 } … … 603 598 } 604 599 605 free(node->name); 606 node->name = newName; 600 freeset(node->name, newName); 607 601 return 0; 608 602 } … … 611 605 if (node->remark_branch) { // if remark_branch then it is a group name 612 606 char *groupName = decodeTreeNode(node->remark_branch, error); 607 if (!error) { 608 freeset(node->remark_branch, 0); 609 freeset(node->name, GBS_global_string_copy("g=%s", groupName)); 610 } 611 free(groupName); 612 613 613 if (error) return error; 614 615 char *newName = GBS_global_string_copy("g=%s", groupName);616 free(groupName);617 618 free(node->remark_branch);619 node->remark_branch = 0;620 621 free(node->name);622 node->name = newName;623 614 } 624 615 … … 629 620 static GB_ERROR PGD_encodeBranchNames(GBT_TREE *node) { 630 621 if (node->name) { // all nodes 631 char *newName = encodeTreeNode(node->name); 632 free(node->name); 633 node->name = newName; 622 freeset(node->name, encodeTreeNode(node->name)); 634 623 } 635 624 -
trunk/SECEDIT/SEC_abspos.cxx
r5675 r5725 18 18 19 19 void XString::set_length(size_t len) { 20 if (number_found && x_string_len<len) { 21 free(number_found); 22 number_found = 0; 23 } 20 if (number_found && x_string_len<len) freeset(number_found, 0); 24 21 x_string_len = len; 25 22 initialized = false; … … 73 70 74 71 if (abspos) { // re-initialization 75 if (x_count<x) { // abspos array too small 76 free(abspos); 77 abspos = 0; 78 } 72 if (x_count<x) freeset(abspos, 0); // abspos array too small 79 73 } 80 74 x_count = x; … … 135 129 size_t bufsize = x_string_len+1; 136 130 137 if (copy && copy_alloc<bufsize) { 138 free(copy); 139 copy = 0; 140 } 141 142 if (!copy) { 143 copy = (char*)malloc(bufsize); 131 if (!copy || copy_alloc<bufsize) { 132 freeset(copy, (char*)malloc(bufsize)); 144 133 copy_alloc = bufsize; 145 134 } -
trunk/SECEDIT/SEC_graphic.cxx
r5675 r5725 686 686 request_update(SEC_UPDATE_RECOUNT); 687 687 if (load_error) { // previous load error? 688 free(load_error); 689 load_error = 0; 688 freeset(load_error, 0); 690 689 request_update(SEC_UPDATE_ZOOM_RESET); 691 690 } -
trunk/SECEDIT/SEC_paint.cxx
r5183 r5725 363 363 #warning move to SEC_db_interface 364 364 void SEC_root::cacheBackgroundColor() { 365 free(bg_color); 366 bg_color = 0; 365 freeset(bg_color, 0); 367 366 368 367 const ED4_sequence_terminal *sterm = db->get_seqTerminal(); -
trunk/SERVERCNTRL/servercntrl.c
r5574 r5725 307 307 308 308 erg = (struct arb_params *)calloc(sizeof(struct arb_params),1); 309 erg->db_server = GB_strdup(":");310 erg->job_server = GB_strdup("ARB_JOB_SERVER");311 erg->mgr_server = GB_strdup("ARB_MGR_SERVER");312 erg->pt_server = GB_strdup("ARB_PT_SERVER");309 erg->db_server = strdup(":"); 310 erg->job_server = strdup("ARB_JOB_SERVER"); 311 erg->mgr_server = strdup("ARB_MGR_SERVER"); 312 erg->pt_server = strdup("ARB_PT_SERVER"); 313 313 314 314 for (s=d=0; s<*argc; s++) { -
trunk/SL/AW_NAME/AW_names_admin.cxx
r5648 r5725 12 12 const char *field = AW_get_nameserver_addid((GBDATA*)cl_gb_main); 13 13 const char *filename = field[0] ? GBS_global_string("names_%s.dat", field) : "names_dat"; 14 char *fullname = GB_strdup(GB_path_in_ARBLIB("nas", filename));14 char *fullname = nulldup(GB_path_in_ARBLIB("nas", filename)); 15 15 16 16 return fullname; -
trunk/SL/AW_NAME/AW_rename.cxx
r5676 r5725 82 82 for (int c = 0; c<serverCount; c++) { 83 83 const char *ipport = GBS_read_arb_tcp(nameservers[c]); 84 fieldNames[c] = GB_strdup(GBS_scan_arb_tcp_param(ipport, "-f")); // may return 084 fieldNames[c] = nulldup(GBS_scan_arb_tcp_param(ipport, "-f")); // may return 0 85 85 } 86 86 … … 533 533 if (!err) { 534 534 char *newshrt = AWTC_create_numbered_suffix(hash, shrt, warning); 535 if (newshrt) { 536 free(shrt); 537 shrt = newshrt; 538 } 535 if (newshrt) freeset(shrt, newshrt); 539 536 540 537 GBS_incr_hash(hash,shrt); -
trunk/SL/HELIX/BI_helix.hxx
r4963 r5725 81 81 82 82 static char *get_error() { return helix_error; } 83 static void clear_error() { free (helix_error); helix_error = 0; }84 static void set_error(const char *err) { free (helix_error); helix_error = err ? strdup(err) : 0; }83 static void clear_error() { freeset(helix_error, NULL); } 84 static void set_error(const char *err) { freedup(helix_error, err); } 85 85 86 86 BI_helix(void); -
trunk/TOOLS/arb_export_rates.cxx
r5034 r5725 103 103 104 104 if (APPEARS_IN_HEADER(command_char)) { 105 char *neu = GB_strdup(GBS_global_string("%s %c", firstline, command_char)); 106 free(firstline); 107 firstline = neu; 105 freeset(firstline, GBS_global_string_copy("%s %c", firstline, command_char)); 108 106 } 109 107 } … … 180 178 seq_len = ali_len; 181 179 182 free(weight[int('1')]); 183 weight[int('1')] = strdup(" 1"); 180 freedup(weight[int('1')], " 1"); 184 181 } 185 182 -
trunk/TOOLS/arb_gene_probe.cxx
r5660 r5725 341 341 next_split_pos_list = GBS_global_string_copy("%s,%i", split_pos_list, genome_pos); 342 342 } 343 free(split_pos_list); 344 split_pos_list = next_split_pos_list; 343 freeset(split_pos_list, next_split_pos_list); 345 344 } 346 345 } -
trunk/TOOLS/arb_proto_2_xsub.cxx
r5636 r5725 72 72 73 73 for (tok = strtok(data,";\n");tok;tok = strtok(0,";\n")) { 74 if (type) { free(type); type = 0; }74 freeset(type, 0); 75 75 76 76 #if defined(DEBUG) … … 170 170 /* check type */ 171 171 GB_BOOL const_char = GB_FALSE; 172 GB_BOOL free_flag = GB_FALSE; 173 if (!strcmp(type,"char*")) const_char = GB_TRUE; 174 if (!strncmp(type,"schar",5)){ 175 free_flag = GB_TRUE; 176 char *newtype = strdup(type+1); 177 free(type); 178 type = newtype; 179 } 180 181 if (!strcmp(type,"float")) { 182 free(type); 183 type = strdup("double"); 184 } 185 if (!strcmp(type,"GB_alignment_type")) { 186 free(type); 187 type = strdup("double"); 188 } 172 GB_BOOL free_flag = GB_FALSE; 173 174 if (strcmp(type,"char*") == 0) const_char = GB_TRUE; 175 if (strncmp(type,"schar",5) == 0) { 176 free_flag = GB_TRUE; 177 freedup(type, type+1); 178 } 179 180 if (strcmp(type,"float") == 0) freedup(type, "double"); 181 if (strcmp(type,"GB_alignment_type") == 0) freedup(type, "double"); 189 182 190 183 tok = sp; -
trunk/TOOLS/arb_read_tree.cxx
r5350 r5725 20 20 void add_bootstrap(GBT_TREE *node, double hundred) { 21 21 if (node->is_leaf) { 22 if (node->remark_branch) { 23 free(node->remark_branch); 24 node->remark_branch = 0; 25 } 22 freeset(node->remark_branch, 0); 26 23 return; 27 24 } -
trunk/TRS/tree_lib.cxx
r5390 r5725 44 44 vsprintf(p,templat,parg); 45 45 46 if (TRS_error_buffer) free(TRS_error_buffer); 47 TRS_error_buffer = strdup(buffer); 46 freedup(TRS_error_buffer, buffer); 48 47 return TRS_error_buffer; 49 48 } -
trunk/WINDOW/AW_at.cxx
r5202 r5725 117 117 118 118 void AW_window::label( const char *Label ) { 119 free(_at->label_for_inputfield); 120 _at->label_for_inputfield = strdup(Label); 119 freedup(_at->label_for_inputfield, Label); 121 120 } 122 121 … … 317 316 _at->highlight = AW_FALSE; 318 317 319 free (_at->id_for_next_button) ; _at->id_for_next_button = 0;320 free (_at->helptext_for_next_button); _at->helptext_for_next_button = 0;321 free (_at->label_for_inputfield) ; _at->label_for_inputfield = 0;318 freeset(_at->id_for_next_button, 0); 319 freeset(_at->helptext_for_next_button, 0); 320 freeset(_at->label_for_inputfield, 0); 322 321 323 322 _at->background_color = 0; -
trunk/WINDOW/AW_button.cxx
r5648 r5725 326 326 327 327 static char *pixmapPath(const char *pixmapName) { 328 return GB_strdup(GB_path_in_ARBLIB("pixmaps", pixmapName));328 return nulldup(GB_path_in_ARBLIB("pixmaps", pixmapName)); 329 329 } 330 330 … … 894 894 aw_toggle_data *tdata = new aw_toggle_data; 895 895 tdata->isTextToggle = true; 896 tdata->bitmapOrText[0] = GB_strdup(noText);897 tdata->bitmapOrText[1] = GB_strdup(yesText);896 tdata->bitmapOrText[0] = strdup(noText); 897 tdata->bitmapOrText[1] = strdup(yesText); 898 898 tdata->buttonWidth = buttonWidth; 899 899 … … 1420 1420 void AW_window::set_list_entry_char_value(const char *new_char_value) { 1421 1421 if (!current_list_table) AW_ERROR("No Selection List Iterator"); 1422 1423 free(current_list_table->char_value); 1424 current_list_table->char_value = AW_select_table_struct::copy_string(new_char_value); 1422 freeset(current_list_table->char_value, AW_select_table_struct::copy_string(new_char_value)); 1425 1423 } 1426 1424 1427 1425 void AW_window::set_list_entry_displayed(const char *new_displayed) { 1428 1426 if (!current_list_table) AW_ERROR("No Selection List Iterator"); 1429 1430 free(current_list_table->displayed); 1431 current_list_table->displayed = AW_select_table_struct::copy_string(new_displayed); 1427 freeset(current_list_table->displayed, AW_select_table_struct::copy_string(new_displayed)); 1432 1428 } 1433 1429 -
trunk/WINDOW/AW_nawar.cxx
r5483 r5725 72 72 73 73 void AW_awar::get( char **p_string ) { 74 free(*p_string); 75 *p_string = read_string(); 74 freeset(*p_string, read_string()); 76 75 } 77 76 … … 601 600 if (strcmp(awar_name, new_awar) != 0) { 602 601 remove_callback(); 603 free(awar_name); 604 awar_name = strdup(new_awar); 602 freedup(awar_name, new_awar); 605 603 add_callback(); 606 604 } -
trunk/WINDOW/AW_preset.cxx
r5309 r5725 182 182 } 183 183 awr->awar(AWAR_GLOBAL_COLOR_NAME)->write_string(label_name); 184 free(aw_glob_font_awar_name); 185 aw_glob_font_awar_name = strdup(awar_name); 184 freedup(aw_glob_font_awar_name, awar_name); 186 185 aws->show(); 187 186 } … … 690 689 } 691 690 692 free (id_copy); id_copy = 0;691 freeset(id_copy, 0); 693 692 } 694 693 -
trunk/WINDOW/AW_question.cxx
r5708 r5725 24 24 25 25 void AW_repeated_question::add_help(const char *help_file) { 26 if (helpfile) { 27 free(helpfile); 28 helpfile = 0; 29 } 30 if (help_file) { 31 helpfile = strdup(help_file); 32 } 26 freedup(helpfile, help_file); 33 27 } 34 28 -
trunk/WINDOW/AW_status.cxx
r5711 r5725 631 631 fprintf(stderr, "received AW_STATUS_CMD_GAUGE\n"); fflush(stdout); 632 632 #endif // TRACE_STATUS 633 free(gauge); 634 gauge = str; 635 str = 0; 633 634 reassign(gauge, str); 636 635 637 636 if (gaugeValue>0) { … … 694 693 int i; 695 694 AW_root *awr = aww->get_root(); 696 for (i = 0; i< AW_MESSAGE_LINES; i++){ 697 free(aw_stg.lines[i]); 698 aw_stg.lines[i] = 0; 699 }; 695 for (i = 0; i< AW_MESSAGE_LINES; i++) freeset(aw_stg.lines[i], 0); 700 696 awr->awar(AWAR_ERROR_MESSAGES)->write_string("" ); 701 697 } … … 953 949 954 950 if (button_list[0] == 0) { 955 // aw_assert(0); // empty button_list 956 free(button_list); 957 button_list = strdup("Maybe ok,EXIT"); 958 msg = GBS_global_string_copy("%s\n(Program error - Unsure what happens when you click ok)", msg); 951 freedup(button_list, "Maybe ok,EXIT"); 952 GBK_dump_backtrace(stderr, "Empty buttonlist"); 953 msg = GBS_global_string_copy("%s\n" 954 "(Program error - Unsure what happens when you click ok\n" 955 " Check console for backtrace and report error)", 956 msg); 959 957 } 960 958 … … 1151 1149 break; 1152 1150 case MAKE_DEFAULT: 1153 free(content); 1154 content = strdup(Default); 1151 freedup(content, Default); 1155 1152 break; 1156 1153 case MAKE_UNKNOWN: … … 1324 1321 1325 1322 if (buttons) { 1326 char *but = GB_strdup(buttons);1323 char *but = strdup(buttons); 1327 1324 char *word; 1328 1325 int result = 0; … … 1358 1355 aw_msg->clear_selection_list(sel); 1359 1356 { 1360 char *values = GB_strdup(value_list);1357 char *values = strdup(value_list); 1361 1358 char *word; 1362 1359 … … 1392 1389 } 1393 1390 } 1394 free(last_input); 1395 last_input = this_input; 1396 this_input = 0; 1391 reassign(last_input, this_input); 1397 1392 } 1398 1393 free(this_input); … … 1500 1495 GB_CSTR result = 0; 1501 1496 char *user_doc_path = strdup(GB_getenvDOCPATH()); 1502 char *devel_doc_path = GB_strdup(GB_path_in_ARBHOME("HELP_SOURCE/oldhelp", NULL));1497 char *devel_doc_path = strdup(GB_path_in_ARBHOME("HELP_SOURCE/oldhelp", NULL)); 1503 1498 size_t user_doc_path_len = strlen(user_doc_path); 1504 1499 size_t devel_doc_path_len = strlen(devel_doc_path); … … 1522 1517 if (path_for_edit) { 1523 1518 #if defined(DEBUG) 1524 char *gen_doc_path = GB_strdup(GB_path_in_ARBHOME("HELP_SOURCE/genhelp", NULL));1519 char *gen_doc_path = strdup(GB_path_in_ARBHOME("HELP_SOURCE/genhelp", NULL)); 1525 1520 1526 1521 char *devel_source = GBS_global_string_copy("%s/%s", devel_doc_path, rel_path); … … 1585 1580 } 1586 1581 else { 1587 free(result); 1588 result = 0; 1582 freeset(result, 0); 1589 1583 GB_export_error("Can't browse that file type."); 1590 1584 } … … 1638 1632 if (file) { 1639 1633 result = GBS_string_eval(file,"*\nTITLE*\n*=*2:\t=",0); 1640 if (strcmp(file, result)==0) { 1641 free(result); 1642 result = 0; 1643 } 1634 if (strcmp(file, result)==0) freeset(result, 0); 1644 1635 free(file); 1645 1636 } … … 1668 1659 const char *sep = strchr(history, '#'); 1669 1660 if (sep) { 1670 char *first = GB_strpartdup(history, sep-1); 1671 char *newhist = GBS_global_string_copy("%s#%s", sep+1, first); // wrap first to end 1672 1673 free(aw_help_global.history); 1674 aw_help_global.history = newhist; 1675 1661 char *first = GB_strpartdup(history, sep-1); 1662 1663 freeset(aw_help_global.history, GBS_global_string_copy("%s#%s", sep+1, first)); // wrap first to end 1676 1664 free(first); 1677 1678 1665 aw_help_select_newest_in_history(aw_root); 1679 1666 } … … 1755 1742 1756 1743 aw_assert(h); 1757 1758 free(aw_help_global.history); 1759 aw_help_global.history = h; 1760 1744 freeset(aw_help_global.history, h); 1761 1745 free(comm); 1762 1746 } … … 1834 1818 char *searchtext = aww->get_root()->awar("tmp/aw_window/search_expression")->read_string(); 1835 1819 1836 if (searchtext[0]==0) { 1837 error = "Empty searchstring"; 1838 } 1820 if (searchtext[0]==0) error = "Empty searchstring"; 1839 1821 else { 1840 1822 char *helpfilename = 0; … … 1842 1824 1843 1825 // replace all spaces in 'searchtext' by '.*' 1844 { 1845 char *searchtext2 = GBS_string_eval(searchtext, " =.*", 0); 1846 if (searchtext2) { 1847 free(searchtext); 1848 searchtext = searchtext2; 1849 } 1850 } 1826 freeset(searchtext, GBS_string_eval(searchtext, " =.*", 0)); 1851 1827 1852 1828 // grep .hlp for occurances of 'searchtext'. … … 1907 1883 else fprintf(helpfp, "\t\tThere are no results.\n"); 1908 1884 1909 if (results>0) { 1910 if (last_help) free(last_help); 1911 last_help = strdup(helpfilename); 1912 } 1885 if (results>0) freedup(last_help, helpfilename); 1913 1886 1914 1887 fclose(helpfp); -
trunk/WINDOW/AW_window.cxx
r5673 r5725 271 271 } 272 272 273 AW_select_table_struct::AW_select_table_struct(const char *displayedi, 274 const char *valuei) { 273 AW_select_table_struct::AW_select_table_struct(const char *displayedi, const char *valuei) { 275 274 memset((char *)this, 0, sizeof(AW_select_table_struct)); 276 275 displayed = copy_string(displayedi); 277 276 char_value = strdup(valuei); 278 277 } 279 AW_select_table_struct::AW_select_table_struct(const char *displayedi, 280 long valuei) { 278 AW_select_table_struct::AW_select_table_struct(const char *displayedi, long valuei) { 281 279 memset((char *)this, 0, sizeof(AW_select_table_struct)); 282 280 displayed = copy_string(displayedi); 283 281 int_value = valuei;; 284 282 } 285 AW_select_table_struct::AW_select_table_struct(const char *displayedi, 286 float valuei) { 283 AW_select_table_struct::AW_select_table_struct(const char *displayedi, float valuei) { 287 284 memset((char *)this, 0, sizeof(AW_select_table_struct)); 288 285 displayed = copy_string(displayedi); … … 294 291 } 295 292 296 AW_selection_list::AW_selection_list(const char *variable_namei, 297 int variable_typei, Widget select_list_widgeti) { 293 AW_selection_list::AW_selection_list(const char *variable_namei, int variable_typei, Widget select_list_widgeti) { 298 294 memset((char *)this, 0, sizeof(AW_selection_list)); 299 variable_name = GB_strdup(variable_namei);295 variable_name = nulldup(variable_namei); 300 296 variable_type = (AW_VARIABLE_TYPE)variable_typei; 301 297 select_list_widget = select_list_widgeti; … … 347 343 aw_assert(win_name); 348 344 349 free (window_name); window_name = strdup(win_name);350 free (sub_menu); sub_menu = 0;345 freedup(window_name, win_name); 346 freeset(sub_menu, 0); 351 347 352 348 printf("---------------------------------------- list of menus for '%s'\n", window_name); … … 368 364 dumpMenuEntry(sub_name); // dump the menu itself 369 365 370 if (sub_menu) { 371 char *new_sub_menu = strdup(GBS_global_string("%s/%s", sub_menu, sub_name)); 372 free(sub_menu); 373 sub_menu = new_sub_menu; 374 } 375 else { 376 sub_menu = strdup(sub_name); 377 } 366 if (sub_menu) freeset(sub_menu, GBS_global_string_copy("%s/%s", sub_menu, sub_name)); 367 else sub_menu = strdup(sub_name); 378 368 } 379 369 … … 384 374 lslash[0] = 0; 385 375 } 386 else { 387 free(sub_menu); sub_menu = 0; 388 } 376 else freeset(sub_menu, 0); 389 377 } 390 378 391 379 static void dumpCloseAllSubMenus() { 392 free (sub_menu); sub_menu = 0;380 freeset(sub_menu, 0); 393 381 } 394 382 … … 2746 2734 static char *unused; 2747 2735 2748 if (unused) 2749 free(unused); 2750 unused = strdup(topic_name); 2736 freedup(unused, topic_name); 2751 2737 2752 2738 for (t = 0; unused[t]; ++t) { … … 2836 2822 } 2837 2823 2838 static void open_test_duplicate_mnemonics(int menu_deep, 2839 const char *sub_menu_name, const char *mnemonic) { 2824 static void open_test_duplicate_mnemonics(int menu_deep, const char *sub_menu_name, const char *mnemonic) { 2840 2825 aw_assert(menu_deep == menu_deep_check+1); 2841 2826 menu_deep_check = menu_deep; … … 2845 2830 2846 2831 memset(buf, 0, len); 2847 2848 2832 sprintf(buf, "%s|%s", TD_menu_name, sub_menu_name); 2849 2833 2850 2834 test_duplicate_mnemonics(menu_deep-1, sub_menu_name, mnemonic); 2851 2835 2852 free(TD_menu_name); 2853 TD_menu_name = buf; 2854 2836 freeset(TD_menu_name, buf); 2855 2837 TD_poss[menu_deep] = 0; 2856 2838 } … … 2877 2859 int i; 2878 2860 2879 if (TD_menu_name) { 2880 close_test_duplicate_mnemonics(1); // close last menu 2881 free(TD_menu_name); 2882 TD_menu_name = 0; 2883 } 2884 2885 TD_menu_name = strdup(""); 2861 if (TD_menu_name) close_test_duplicate_mnemonics(1); // close last menu 2862 freedup(TD_menu_name, ""); 2886 2863 2887 2864 for (i=0; i<MAX_DEEP_TO_TEST; i++) { … … 2893 2870 close_test_duplicate_mnemonics(1); // close last menu 2894 2871 aw_assert(TD_menu_name); 2895 free(TD_menu_name); 2896 TD_menu_name = 0; 2872 freeset(TD_menu_name, 0); 2897 2873 aw_assert(menu_deep_check == 0); 2898 2874 } … … 3256 3232 void AW_window::set_window_title(const char *title) { 3257 3233 XtVaSetValues(p_w->shell, XmNtitle, title, NULL); 3258 free(window_name); 3259 window_name = strdup(title); 3234 freedup(window_name, title); 3260 3235 } 3261 3236 … … 3460 3435 prvt->recording_macro_file = 0; 3461 3436 3462 free(prvt->recording_macro_path); 3463 free(prvt->stop_action_name); 3464 free(prvt->application_name_for_macros); 3465 3466 prvt->recording_macro_path = 0; 3467 prvt->stop_action_name = 0; 3468 prvt->application_name_for_macros = 0; 3437 freeset(prvt->recording_macro_path, 0); 3438 freeset(prvt->stop_action_name, 0); 3439 freeset(prvt->application_name_for_macros, 0); 3469 3440 3470 3441 return 0; -
trunk/WINDOW/AW_xfont.cxx
r5507 r5725 529 529 fprintf(stderr, "ARB fontpackage: Unexpectedly couldn't load font '%s', falling back to '%s' (f=%i, s=%i)\n", nf->fname, NORMAL_FONT, f, s); 530 530 fontst = XLoadQueryFont(tool_d, NORMAL_FONT); // @@@ may return 0! 531 free(nf->fname); 532 nf->fname = strdup(NORMAL_FONT); /* store actual name */ 531 freedup(nf->fname, NORMAL_FONT); /* store actual name */ 533 532 } 534 533 /* put the structure in the list */ -
trunk/ptpan/PT_buildtree.cxx
r5716 r5725 95 95 96 96 /* return some memory not used anymore */ 97 free(pp->pp_StdSfxNodes); 98 pp->pp_StdSfxNodes = NULL; 97 freeset(pp->pp_StdSfxNodes, NULL); 99 98 100 99 if(GB_rename_file(newtreename, pg->pg_IndexName)) … … 1025 1024 1026 1025 /* return some memory not used anymore */ 1027 free(pp->pp_SfxNodes); 1028 free(pp->pp_BranchCode); 1029 free(pp->pp_ShortEdgeCode); 1030 free(pp->pp_LongEdgeLenCode); 1031 free(pp->pp_LongDictRaw); 1032 free(pp->pp_LeafBuffer); 1033 pp->pp_SfxNodes = NULL; 1034 pp->pp_LevelStats = NULL; 1035 pp->pp_BranchCode = NULL; 1036 pp->pp_ShortEdgeCode = NULL; 1037 pp->pp_LongEdgeLenCode = NULL; 1038 pp->pp_LongDictRaw = NULL; 1039 pp->pp_LeafBuffer = NULL; 1026 freeset(pp->pp_SfxNodes, NULL); 1027 freeset(pp->pp_BranchCode, NULL); 1028 freeset(pp->pp_ShortEdgeCode, NULL); 1029 freeset(pp->pp_LongEdgeLenCode, NULL); 1030 freeset(pp->pp_LongDictRaw, NULL); 1031 freeset(pp->pp_LeafBuffer, NULL); 1032 1033 pp->pp_LevelStats = NULL; 1040 1034 pp->pp_LeafBufferSize = 0; 1035 1041 1036 return(TRUE); 1042 1037 } … … 1186 1181 1187 1182 /* free some memory not required anymore */ 1188 free(pp->pp_QuickPrefixLookup); 1189 pp->pp_QuickPrefixLookup = NULL; 1183 freeset(pp->pp_QuickPrefixLookup, NULL); 1190 1184 1191 1185 printf("Quick Prefix Lookup speedup: %ld%% (%ld)\n", … … 1710 1704 pp->pp_TreePruneLength); 1711 1705 1712 free(pp->pp_LevelStats); 1713 pp->pp_LevelStats = NULL; 1706 freeset(pp->pp_LevelStats, NULL); 1714 1707 1715 1708 /* allocate branch histogram */ -
trunk/ptpan/PT_cachehandler.cxx
r5566 r5725 35 35 { 36 36 Remove(&cn->cn_Node); 37 free(cn); 38 cn = (struct CacheNode *) ch->ch_UsedNodes.lh_Head; 37 freeset(cn, (struct CacheNode *) ch->ch_UsedNodes.lh_Head); 39 38 } 40 39 /* free memory in free node cache */ … … 43 42 { 44 43 Remove(&cn->cn_Node); 45 free(cn); 46 cn = (struct CacheNode *) ch->ch_FreeNodes.lh_Head; 44 freeset(cn, (struct CacheNode *) ch->ch_FreeNodes.lh_Head); 47 45 } 48 46 /* free structure itself */ -
trunk/ptpan/PT_etc.cxx
r5566 r5725 59 59 printf("EXTERN: PT_unknown_names\n"); 60 60 /* free old string and allocate minimum buffer */ 61 free(pg->pg_UnknownSpecies.data); 62 pg->pg_UnknownSpecies.data = (STRPTR) malloc(allocsize); 61 freeset(pg->pg_UnknownSpecies.data, (STRPTR) malloc(allocsize)); 63 62 *pg->pg_UnknownSpecies.data = 0; 64 63 namestart = specnames = pdc->names.data; -
trunk/ptpan/PT_findEx.cxx
r5566 r5725 33 33 34 34 /* free old result */ 35 if(pep->result) 36 { 37 free(pep->result); 38 pep->result = NULL; 39 } 35 freeset(pep->result, NULL); 40 36 41 37 /* do we need to start from scratch? */ … … 105 101 parenttn = tn->tn_Parent; 106 102 seqcode = tn->tn_ParentSeq + 1; 107 free(tn); 108 tn = parenttn; 103 freeset(tn, parenttn); 109 104 if(!tn) 110 105 { … … 150 145 parenttn = tn->tn_Parent; 151 146 seqcode = tn->tn_ParentSeq + 1; 152 free(tn); 153 tn = parenttn; 147 freeset(tn, parenttn); 154 148 } 155 149 *outptr = 0; -
trunk/ptpan/PT_hashing.cxx
r5566 r5725 22 22 return(ha); 23 23 } 24 free(ha); 25 ha = NULL; 24 freeset(ha, NULL); 26 25 } 27 26 return(ha); -
trunk/ptpan/PT_io.cxx
r5719 r5725 697 697 698 698 /* free memory if previously allocated */ 699 if(pg->pg_EcoliSeq) 700 { 701 free(pg->pg_EcoliSeq); 702 pg->pg_EcoliSeq = NULL; 703 } 704 if(pg->pg_EcoliBaseTable) 705 { 706 free(pg->pg_EcoliBaseTable); 707 pg->pg_EcoliBaseTable = NULL; 708 } 699 freeset(pg->pg_EcoliSeq, NULL); 700 freeset(pg->pg_EcoliBaseTable, NULL); 709 701 710 702 /* prepare ecoli sequence */ … … 760 752 free(ps->ps_Name); 761 753 free(ps->ps_FullName); 762 free(ps); 763 ps = (struct PTPanSpecies *) pg->pg_Species.lh_Head; 754 freeset(ps, (struct PTPanSpecies *) pg->pg_Species.lh_Head); 764 755 } 765 756 FreeBinTree(pg->pg_SpeciesBinTree); … … 796 787 { 797 788 /* load alignment data */ 798 free(ps->ps_SeqData); 799 ps->ps_SeqData = NULL; 789 freeset(ps->ps_SeqData, NULL); 800 790 return(TRUE); 801 791 } … … 942 932 943 933 ps->ps_RawDataSize = CompressSequenceWithDotsAndHyphens(pg, ps); 944 free(ps->ps_SeqData); 945 ps->ps_SeqData = NULL; 934 freeset(ps->ps_SeqData, NULL); 946 935 if (ps->ps_RawDataSize < 0) // TODO: problem, ps_RawDataSize is unsigned... 947 936 { … … 1080 1069 // read Ecoli Sequence 1081 1070 /* free memory if previously allocated */ 1082 if(pg->pg_EcoliSeq) 1083 { 1084 free(pg->pg_EcoliSeq); 1085 pg->pg_EcoliSeq = NULL; 1086 } 1087 if(pg->pg_EcoliBaseTable) 1088 { 1089 free(pg->pg_EcoliBaseTable); 1090 pg->pg_EcoliBaseTable = NULL; 1091 } 1071 freeset(pg->pg_EcoliSeq, NULL); 1072 freeset(pg->pg_EcoliBaseTable, NULL); 1092 1073 1093 1074 fread(&pg->pg_EcoliSeqSize, sizeof(pg->pg_EcoliSeqSize), 1, fh); … … 1299 1280 FreeHuffmanTree(pp->pp_ShortEdgeTree); 1300 1281 FreeHuffmanTree(pp->pp_LongEdgeLenTree); 1301 free(pp); 1302 pp = (struct PTPanPartition *) pg->pg_Partitions.lh_Head; 1282 freeset(pp, (struct PTPanPartition *) pg->pg_Partitions.lh_Head); 1303 1283 } 1304 1284 pg->pg_NumPartitions = 0; -
trunk/ptpan/PT_new_design.cxx
r5687 r5725 373 373 parenttn = tn->tn_Parent; 374 374 seqcode = tn->tn_ParentSeq + 1; 375 free(tn); 376 tn = parenttn; 375 freeset(tn, parenttn); 377 376 } 378 377 } while (! done); … … 789 788 parenttn = tn->tn_Parent; 790 789 seqcode = tn->tn_ParentSeq + 1; 791 free(tn); 792 tn = parenttn; 790 freeset(tn, parenttn); 793 791 if (! tn) 794 792 { … … 839 837 parenttn = tn->tn_Parent; 840 838 seqcode = tn->tn_ParentSeq + 1; 841 free(tn); 842 tn = parenttn; 839 freeset(tn, parenttn); 843 840 } while (TRUE); 844 841 -
trunk/ptpan/PT_treepack.cxx
r5721 r5725 220 220 } 221 221 } 222 free(pp->pp_LongDictRaw); 223 pp->pp_LongDictRaw = NULL; 222 freeset(pp->pp_LongDictRaw, NULL); 224 223 } else { 225 224 printf("Out of memory while loading long dictionary (%ld)!\n", len); … … 251 250 pp->pp_DiskTree = NULL; 252 251 } else { 253 free (pp->pp_DiskTree);252 freeset(pp->pp_DiskTree, NULL); 254 253 } 255 254 pp->pp_BranchTree = NULL; … … 257 256 pp->pp_LongEdgeLenTree = NULL; 258 257 pp->pp_LongDictRaw = NULL; 259 pp->pp_DiskTree = NULL;260 258 } 261 259 /* \\\ */ … … 388 386 pp->pp_DiskTree = NULL; 389 387 } else { 390 free(pp->pp_DiskTree); 391 } 392 pp->pp_DiskTree = NULL; 388 freeset(pp->pp_DiskTree, NULL); 389 } 393 390 } 394 391 /* \\\ */ -
trunk/ptpan/pt_prototypes.h
r5703 r5725 38 38 ULONG BenchTimePassed P_((struct PTPanGlobal *pg)); 39 39 void BenchOutput P_((struct PTPanGlobal *pg)); 40 ULONG GetSequenceRelPos P_((struct PTPanGlobal *pg, STRPTR srcseq, ULONG abspos));41 ULONG GetSequenceAbsPos P_((struct PTPanGlobal *pg, STRPTR srcseq, ULONG relpos));42 40 ULONG CalcLengthForFilteredSequence P_((struct PTPanGlobal *pg, STRPTR srcseq)); 43 41 ULONG FilterSequenceTo P_((struct PTPanGlobal *pg, STRPTR srcstr, STRPTR filtptr));
