lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev HTSprintf0 (was lynx 2.8.3dev.4 for Win32 patch)


From: Klaus Weide
Subject: lynx-dev HTSprintf0 (was lynx 2.8.3dev.4 for Win32 patch)
Date: Mon, 19 Jul 1999 08:40:59 -0500 (CDT)

On Mon, 19 Jul 1999, T.E.Dickey wrote:

> > On Mon, 19 Jul 1999, Leonid Pauzner wrote: 
> >  
> > > 3) a lot of new fixed buffer operations were added with WIN_EX and SH_EX, 
> > > perhaps most of sprintf/etc. should be replaced with safe HTSprintf/0 
> > > and so on according to current lynx style. 
> >  
> > Except perhaps if the code gets executed often.  HTSprintf/0 has overhead, 
> > in some places it should probably be avoided. 
> 
> some of those are places we can optimize by allocating a buffer of the
> appropriate size (using HTSprintf/0 for one character at a time is not a
> Good Thing, but buffer overflows are not either).

Btw. my libc6 has functions that already do the basically the same thing
as HTSprintf0:

     [ #include <stdio.h> ]
       int asprintf(char **strp, const char *format, ...);

and
     [ #include <stdarg.h> ]
       int  vasprintf(char  **strp,  const  char *format, va_list
       ap);

I don't know how widespread they are or whether they are GNU inventions.
If they are available on a system they should probably be faster.
[ I've actually replaced HTSprintf0 (not HTSprintf) with this a while
ago and it seemed to work here.  Some special considerations were
necessary for --enable-find-leaks.  It may not be worth the trouble,
since it won't cover all systems. ]


   Klaus


reply via email to

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