comparison src/elhash.c @ 4117:229bd619740a

[xemacs-hg @ 2007-08-15 11:06:02 by crestani] 2007-08-15 Marcus Crestani <crestani@xemacs.org> * buffer.c (Fkill_buffer): * console-tty.c (free_tty_console_struct): * device-gtk.c (free_gtk_device_struct): * device-msw.c (mswindows_delete_device): * device-msw.c (msprinter_delete_device): * device-x.c (free_x_device_struct): * device-x.c (x_delete_device): * dynarr.c (Dynarr_lisp_realloc): * dynarr.c (Dynarr_free): * elhash.c: * elhash.c (finalize_hash_table): * elhash.c (resize_hash_table): * elhash.c (pdump_reorganize_hash_table): * extents.c (gap_array_delete_marker): * frame-gtk.c (gtk_delete_frame): * frame-msw.c (mswindows_delete_frame): * frame-x.c (x_delete_frame): * glyphs.c (check_for_ignored_expose): * mc-alloc.c (mc_realloc_1): * mc-alloc.h: * objects-tty.c (tty_finalize_color_instance): * objects-tty.c (tty_finalize_font_instance): * objects-tty.c (console_type_create_objects_tty): * syntax.c: * syntax.c (uninit_buffer_syntax_cache): * vdb.c (Ftest_vdb): Remove all calls to mc_free.
author crestani
date Wed, 15 Aug 2007 11:06:10 +0000
parents aa28d959af41
children 479443c0f95a
comparison
equal deleted inserted replaced
4116:9a42c5e5eb4e 4117:229bd619740a
396 write_c_string (printcharfun, ")"); 396 write_c_string (printcharfun, ")");
397 else 397 else
398 write_fmt_string (printcharfun, " 0x%x>", ht->header.uid); 398 write_fmt_string (printcharfun, " 0x%x>", ht->header.uid);
399 } 399 }
400 400
401 #ifndef NEW_GC
401 static void 402 static void
402 free_hentries ( 403 free_hentries (htentry *hentries,
403 #if defined (NEW_GC) && !defined (ERROR_CHECK_STRUCTURES)
404 htentry *UNUSED (hentries),
405 #else
406 htentry *hentries,
407 #endif
408 #ifdef ERROR_CHECK_STRUCTURES 404 #ifdef ERROR_CHECK_STRUCTURES
409 size_t size 405 size_t size
410 #else /* not (NEW_GC && ! ERROR_CHECK_STRUCTURES) */ 406 #else /* not ERROR_CHECK_STRUCTURES) */
411 size_t UNUSED (size) 407 size_t UNUSED (size)
412 #endif /* not (NEW_GC && ! ERROR_CHECK_STRUCTURES) */ 408 #endif /* not ERROR_CHECK_STRUCTURES) */
413 ) 409 )
414 { 410 {
415 #ifdef NEW_GC
416 #ifdef ERROR_CHECK_STRUCTURES
417 htentry *e, *sentinel;
418
419 for (e = hentries, sentinel = e + size; e < sentinel; e++)
420 mc_free (e);
421 #endif
422 #else /* not NEW_GC */
423 #ifdef ERROR_CHECK_STRUCTURES 411 #ifdef ERROR_CHECK_STRUCTURES
424 /* Ensure a crash if other code uses the discarded entries afterwards. */ 412 /* Ensure a crash if other code uses the discarded entries afterwards. */
425 htentry *e, *sentinel; 413 htentry *e, *sentinel;
426 414
427 for (e = hentries, sentinel = e + size; e < sentinel; e++) 415 for (e = hentries, sentinel = e + size; e < sentinel; e++)
428 * (unsigned long *) e = 0xdeadbeef; /* -559038737 base 10 */ 416 * (unsigned long *) e = 0xdeadbeef; /* -559038737 base 10 */
429 #endif 417 #endif
430 418
431 if (!DUMPEDP (hentries)) 419 if (!DUMPEDP (hentries))
432 xfree (hentries, htentry *); 420 xfree (hentries, htentry *);
433 #endif /* not NEW_GC */ 421 }
434 } 422
435
436 #ifndef NEW_GC
437 static void 423 static void
438 finalize_hash_table (void *header, int for_disksave) 424 finalize_hash_table (void *header, int for_disksave)
439 { 425 {
440 if (!for_disksave) 426 if (!for_disksave)
441 { 427 {
1069 LINEAR_PROBING_LOOP (probe, new_entries, new_size) 1055 LINEAR_PROBING_LOOP (probe, new_entries, new_size)
1070 ; 1056 ;
1071 *probe = *e; 1057 *probe = *e;
1072 } 1058 }
1073 1059
1060 #ifndef NEW_GC
1074 free_hentries (old_entries, old_size); 1061 free_hentries (old_entries, old_size);
1062 #endif /* not NEW_GC */
1075 } 1063 }
1076 1064
1077 /* After a hash table has been saved to disk and later restored by the 1065 /* After a hash table has been saved to disk and later restored by the
1078 portable dumper, it contains the same objects, but their addresses 1066 portable dumper, it contains the same objects, but their addresses
1079 and thus their HASHCODEs have changed. */ 1067 and thus their HASHCODEs have changed. */
1099 *probe = *e; 1087 *probe = *e;
1100 } 1088 }
1101 1089
1102 memcpy (ht->hentries, new_entries, ht->size * sizeof (htentry)); 1090 memcpy (ht->hentries, new_entries, ht->size * sizeof (htentry));
1103 1091
1104 #ifdef NEW_GC 1092 #ifndef NEW_GC
1105 mc_free (new_entries);
1106 #else /* not NEW_GC */
1107 xfree (new_entries, htentry *); 1093 xfree (new_entries, htentry *);
1108 #endif /* not NEW_GC */ 1094 #endif /* not NEW_GC */
1109 } 1095 }
1110 1096
1111 static void 1097 static void