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

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

gawk non-necessary line in init_profiling()


From: Stepan Kasal
Subject: gawk non-necessary line in init_profiling()
Date: Fri, 17 May 2002 14:52:37 +0200
User-agent: Mutt/1.2.5.1i

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

Attachment: gawk-3.1.1-prof_fp.patch
Description: Text document


reply via email to

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