Mercurial > hg > xemacs-beta
diff src/marker.c @ 5495:1f0b15040456
Merge.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 01 May 2011 18:44:03 +0100 |
parents | 308d34e9f07d |
children | 56144c8593a8 |
line wrap: on
line diff
--- a/src/marker.c Sat Feb 20 06:03:00 2010 -0600 +++ b/src/marker.c Sun May 01 18:44:03 2011 +0100 @@ -1,13 +1,13 @@ /* Markers: examining, setting and killing. Copyright (C) 1985, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. - Copyright (C) 2002 Ben Wing. + Copyright (C) 2002, 2010 Ben Wing. This file is part of XEmacs. -XEmacs is free software; you can redistribute it and/or modify it +XEmacs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. +Free Software Foundation, either version 3 of the License, or (at your +option) any later version. XEmacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or @@ -15,9 +15,7 @@ for more details. You should have received a copy of the GNU General Public License -along with XEmacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ /* Synched up with: FSF 19.30. */ @@ -60,7 +58,7 @@ Lisp_Marker *marker = XMARKER (obj); if (print_readably) - printing_unreadable_object ("#<marker 0x%lx>", (long) marker); + printing_unreadable_object_fmt ("#<marker 0x%x>", LISP_OBJECT_UID (obj)); write_ascstring (printcharfun, GETTEXT ("#<marker ")); if (!marker->buffer) @@ -73,7 +71,7 @@ } if (marker->insertion_type) write_ascstring (printcharfun, " insertion-type=t"); - write_fmt_string (printcharfun, " 0x%lx>", (long) marker); + write_fmt_string (printcharfun, " 0x%x>", LISP_OBJECT_UID (obj)); } static int @@ -90,7 +88,7 @@ } static Hashcode -marker_hash (Lisp_Object obj, int UNUSED (depth)) +marker_hash (Lisp_Object obj, int UNUSED (depth), Boolint UNUSED (equalp)) { Hashcode hash = (Hashcode) XMARKER (obj)->buffer; if (hash) @@ -107,28 +105,17 @@ #ifdef NEW_GC static void -finalize_marker (void *header, int for_disksave) +finalize_marker (Lisp_Object obj) { - if (!for_disksave) - { - Lisp_Object tem = wrap_marker (header); - unchain_marker (tem); - } + unchain_marker (obj); } +#endif /* NEW_GC */ -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("marker", marker, - 1, /*dumpable-flag*/ - mark_marker, print_marker, - finalize_marker, - marker_equal, marker_hash, - marker_description, Lisp_Marker); -#else /* not NEW_GC */ -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("marker", marker, - 1, /*dumpable-flag*/ - mark_marker, print_marker, 0, - marker_equal, marker_hash, - marker_description, Lisp_Marker); -#endif /* not NEW_GC */ +DEFINE_DUMPABLE_FROB_BLOCK_LISP_OBJECT ("marker", marker, + mark_marker, print_marker, + IF_NEW_GC (finalize_marker), + marker_equal, marker_hash, + marker_description, Lisp_Marker); /* Operations on markers. */ @@ -503,25 +490,15 @@ #ifdef MEMORY_USAGE_STATS -int -compute_buffer_marker_usage (struct buffer *b, struct overhead_stats *ovstats) +Bytecount +compute_buffer_marker_usage (struct buffer *b) { Lisp_Marker *m; - int total = 0; - int overhead; + Bytecount total = 0; for (m = BUF_MARKERS (b); m; m = m->next) - total += sizeof (Lisp_Marker); - ovstats->was_requested += total; -#ifdef NEW_GC - overhead = mc_alloced_storage_size (total, 0); -#else /* not NEW_GC */ - overhead = fixed_type_block_overhead (total); -#endif /* not NEW_GC */ - /* #### claiming this is all malloc overhead is not really right, - but it has to go somewhere. */ - ovstats->malloc_overhead += overhead; - return total + overhead; + total += lisp_object_memory_usage (wrap_marker (m)); + return total; } #endif /* MEMORY_USAGE_STATS */ @@ -530,7 +507,7 @@ void syms_of_marker (void) { - INIT_LRECORD_IMPLEMENTATION (marker); + INIT_LISP_OBJECT (marker); DEFSUBR (Fmarker_position); DEFSUBR (Fmarker_buffer);