comparison src/alloc.c @ 4776:73e8632018ad

Don't attempt to free dumped data, alloc.c:resize_string() 2009-12-17 Aidan Kehoe <kehoea@parhasard.net> * alloc.c (resize_string): Don't attempt to free dumped data in this function, avoiding an assertion failure.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 17 Dec 2009 13:15:04 +0000
parents 80d74fed5399
children 5d120deb60ca e0db3c197671
comparison
equal deleted inserted replaced
4775:1d61580e0cf7 4776:73e8632018ad
2688 memcpy (new_data + pos + delta, old_data + pos, 2688 memcpy (new_data + pos + delta, old_data + pos,
2689 XSTRING_LENGTH (s) + 1 - pos); 2689 XSTRING_LENGTH (s) + 1 - pos);
2690 } 2690 }
2691 XSET_STRING_DATA (s, new_data); 2691 XSET_STRING_DATA (s, new_data);
2692 2692
2693 { 2693 if (!DUMPEDP (old_data)) /* Can't free dumped data. */
2694 /* We need to mark this chunk of the string_chars_block 2694 {
2695 as unused so that compact_string_chars() doesn't 2695 /* We need to mark this chunk of the string_chars_block
2696 freak. */ 2696 as unused so that compact_string_chars() doesn't
2697 struct string_chars *old_s_chars = (struct string_chars *) 2697 freak. */
2698 ((char *) old_data - offsetof (struct string_chars, chars)); 2698 struct string_chars *old_s_chars = (struct string_chars *)
2699 /* Sanity check to make sure we aren't hosed by strange 2699 ((char *) old_data - offsetof (struct string_chars, chars));
2700 alignment/padding. */ 2700 /* Sanity check to make sure we aren't hosed by strange
2701 assert (old_s_chars->string == XSTRING (s)); 2701 alignment/padding. */
2702 MARK_STRING_CHARS_AS_FREE (old_s_chars); 2702 assert (old_s_chars->string == XSTRING (s));
2703 ((struct unused_string_chars *) old_s_chars)->fullsize = 2703 MARK_STRING_CHARS_AS_FREE (old_s_chars);
2704 oldfullsize; 2704 ((struct unused_string_chars *) old_s_chars)->fullsize =
2705 } 2705 oldfullsize;
2706 }
2706 } 2707 }
2707 } 2708 }
2708 #endif /* not NEW_GC */ 2709 #endif /* not NEW_GC */
2709 2710
2710 XSET_STRING_LENGTH (s, XSTRING_LENGTH (s) + delta); 2711 XSET_STRING_LENGTH (s, XSTRING_LENGTH (s) + delta);