bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-indent] Re: Bug#206785: Fixed: Bug#206785: indent segfaults on the


From: Erik de Castro Lopo
Subject: [Bug-indent] Re: Bug#206785: Fixed: Bug#206785: indent segfaults on the attached file
Date: Tue, 23 Sep 2003 23:46:54 +1000

On Tue, 23 Sep 2003 15:32:05 +0200 (CEST)
Santiago Vila <address@hidden> wrote:

> You probably mean this:

Err, actually, no :-).

> diff -ru indent-2.2.9.orig/src/indent.c indent-2.2.9/src/indent.c
> --- indent-2.2.9.orig/src/indent.c    Tue Sep 23 15:24:10 2003
> +++ indent-2.2.9/src/indent.c Tue Sep 23 15:26:17 2003
> @@ -875,6 +875,7 @@
>                                                   * imply we are in a stmt */
>          for (t_ptr = s_code; *t_ptr; ++t_ptr)
>          {
> +            check_lab_size();
>              *e_lab++ = *t_ptr;  /* turn everything so far into a label */
>          }
> 
> since check_lab_size() already checks that e_lab >= l_lab :-)

Mine is a little more efficient. In my version, the function call is only made
if the potential error condition occurs. In your version, the function call
happens every time. On CPUs like i386, the function call overhead is 
significantly higher than the comparison anyway, so add the extra check in
line is a worthwhile addition in a tight inner loop like this one.

Cheers,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  address@hidden (Yes it's valid)
+-----------------------------------------------------------+
Perl  : executable line noise
Python: executable pseudo-code




reply via email to

[Prev in Thread] Current Thread [Next in Thread]