bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: gawk non-necessary line in init_profiling()


From: Aharon Robbins
Subject: Re: gawk non-necessary line in init_profiling()
Date: Fri, 24 May 2002 12:25:48 +0300

Applied. Thanks.  --Arnold

> From: Stepan Kasal <address@hidden>
> To: address@hidden
> Subject: gawk non-necessary line in init_profiling()
> Date: Fri, 17 May 2002 14:52:37 +0200
>
> --bp/iNruPH9dso1Pn
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
>
> Hallo,
>       I propose to remove the following line from gawk-3.1.1/profile.c,
> function init_profiling():
>
>               prof_fp = stderr;
>
> If we do profiling (either because of --profile option or because pgawk was
> called), the prof_fp is set in set_prof_file().
> If we don't do profiling, prof_fp may be left NULL.  If we try to write to
> prof_fp by mistake, we should rather crash on NULL dereference than write
> to stderr, I think.
>
> Another argument is that the comment in main.c, which says
>    "Don't bother if the command line already set profling up."
> should rather say "Be careful not to call it ..."
>
> The attached patch makes the comment true.
>
> Hope you don't mind hassling with such a detail.  I guess this may save a few
> seconds for people who will read the gawk source.
>
> Cheers,
>       Stepan Kasal
>
> --bp/iNruPH9dso1Pn
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: attachment; filename="gawk-3.1.1-prof_fp.patch"
>
> --- gawk-3.1.1.orig/profile.c Tue Apr 16 13:58:49 2002
> +++ gawk-3.1.1/profile.c      Fri May 17 14:30:28 2002
> @@ -71,9 +71,6 @@
>  void
>  init_profiling(int *flag, const char *def_file)
>  {
> -     /* run time init avoids glibc innovations */
> -     prof_fp = stderr;
> -
>  #ifdef PROFILING
>       if (*flag == FALSE) {
>               *flag = TRUE;
>
> --bp/iNruPH9dso1Pn--
>
> _______________________________________________
> Bug-gnu-utils mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-gnu-utils



reply via email to

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