[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] /srv/bzr/emacs/trunk r109264: * alloc.c (Fgarbage_coll
From: |
Paul Eggert |
Subject: |
Re: [Emacs-diffs] /srv/bzr/emacs/trunk r109264: * alloc.c (Fgarbage_collect): Indent as per usual Emacs style. |
Date: |
Tue, 31 Jul 2012 16:28:18 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
On 07/31/2012 03:31 PM, Richard Stallman wrote:
> When the initializer is long and in braces, it's ok to break
> after the = sign and put the open brace in column zero,
> because that makes the whole initializer a defun.
OK, that blesses some of the use of trailing '=' in lines,
but there are still lots of places where the style
guideline isn't being followed now. Would it be a good idea
to change this systematically, with patches like the following?
(This patch is just a sample: it covers just src/alloc.c.)
=== modified file 'src/alloc.c'
*** src/alloc.c 2012-07-31 12:36:19 +0000
--- src/alloc.c 2012-07-31 23:22:42 +0000
***************
*** 537,552 ****
- XMALLOC_OVERRUN_CHECK_SIZE)
static char const
xmalloc_overrun_check_header[XMALLOC_OVERRUN_CHECK_SIZE] =
! { '\x9a', '\x9b', '\xae', '\xaf',
! '\xbf', '\xbe', '\xce', '\xcf',
! '\xea', '\xeb', '\xec', '\xed',
! '\xdf', '\xde', '\x9c', '\x9d' };
static char const
xmalloc_overrun_check_trailer[XMALLOC_OVERRUN_CHECK_SIZE] =
! { '\xaa', '\xab', '\xac', '\xad',
! '\xba', '\xbb', '\xbc', '\xbd',
! '\xca', '\xcb', '\xcc', '\xcd',
! '\xda', '\xdb', '\xdc', '\xdd' };
/* Insert and extract the block size in the header. */
--- 537,556 ----
- XMALLOC_OVERRUN_CHECK_SIZE)
static char const
xmalloc_overrun_check_header[XMALLOC_OVERRUN_CHECK_SIZE] =
! {
! '\x9a', '\x9b', '\xae', '\xaf',
! '\xbf', '\xbe', '\xce', '\xcf',
! '\xea', '\xeb', '\xec', '\xed',
! '\xdf', '\xde', '\x9c', '\x9d'
! };
static char const
xmalloc_overrun_check_trailer[XMALLOC_OVERRUN_CHECK_SIZE] =
! {
! '\xaa', '\xab', '\xac', '\xad',
! '\xba', '\xbb', '\xbc', '\xbd',
! '\xca', '\xcb', '\xcc', '\xcd',
! '\xda', '\xdb', '\xdc', '\xdd'
! };
/* Insert and extract the block size in the header. */
***************
*** 1135,1142 ****
}
abase = ABLOCK_ABASE (free_ablock);
! ABLOCKS_BUSY (abase) =
! (struct ablocks *) (2 + (intptr_t) ABLOCKS_BUSY (abase));
val = free_ablock;
free_ablock = free_ablock->x.next_free;
--- 1139,1146 ----
}
abase = ABLOCK_ABASE (free_ablock);
! ABLOCKS_BUSY (abase)
! = (struct ablocks *) (2 + (intptr_t) ABLOCKS_BUSY (abase));
val = free_ablock;
free_ablock = free_ablock->x.next_free;
***************
*** 1728,1735 ****
presence of this cookie during GC. */
#define GC_STRING_OVERRUN_COOKIE_SIZE 4
! static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] =
! { '\xde', '\xad', '\xbe', '\xef' };
#else
#define GC_STRING_OVERRUN_COOKIE_SIZE 0
--- 1732,1739 ----
presence of this cookie during GC. */
#define GC_STRING_OVERRUN_COOKIE_SIZE 4
! static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE]
! = { '\xde', '\xad', '\xbe', '\xef' };
#else
#define GC_STRING_OVERRUN_COOKIE_SIZE 0
***************
*** 1774,1786 ****
STRING_BYTES_BOUND, nor can it be so long that the size_t
arithmetic in allocate_string_data would overflow while it is
calculating a value to be passed to malloc. */
! static ptrdiff_t const STRING_BYTES_MAX =
! min (STRING_BYTES_BOUND,
! ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD
! - GC_STRING_EXTRA
! - offsetof (struct sblock, first_data)
! - SDATA_DATA_OFFSET)
! & ~(sizeof (EMACS_INT) - 1)));
/* Initialize string allocation. Called from init_alloc_once. */
--- 1778,1790 ----
STRING_BYTES_BOUND, nor can it be so long that the size_t
arithmetic in allocate_string_data would overflow while it is
calculating a value to be passed to malloc. */
! static ptrdiff_t const STRING_BYTES_MAX
! = min (STRING_BYTES_BOUND,
! ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD
! - GC_STRING_EXTRA
! - offsetof (struct sblock, first_data)
! - SDATA_DATA_OFFSET)
! & ~(sizeof (EMACS_INT) - 1)));
/* Initialize string allocation. Called from init_alloc_once. */
***************
*** 1802,1809 ****
ptrdiff_t
string_bytes (struct Lisp_String *s)
{
! ptrdiff_t nbytes =
! (s->size_byte < 0 ? s->size & ~ARRAY_MARK_FLAG : s->size_byte);
if (!PURE_POINTER_P (s)
&& s->data
--- 1806,1813 ----
ptrdiff_t
string_bytes (struct Lisp_String *s)
{
! ptrdiff_t nbytes
! = (s->size_byte < 0 ? s->size & ~ARRAY_MARK_FLAG : s->size_byte);
if (!PURE_POINTER_P (s)
&& s->data
***************
*** 5685,5693 ****
#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
{
/* Compute average percentage of zombies. */
! double nlive =
! (total_conses + total_symbols + total_markers + total_strings
! + total_vectors + total_floats + total_intervals +
total_buffers);
avg_live = (avg_live * ngcs + nlive) / (ngcs + 1);
max_live = max (nlive, max_live);
--- 5689,5697 ----
#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
{
/* Compute average percentage of zombies. */
! double nlive
! = (total_conses + total_symbols + total_markers + total_strings
! + total_vectors + total_floats + total_intervals +
total_buffers);
avg_live = (avg_live * ngcs + nlive) / (ngcs + 1);
max_live = max (nlive, max_live);