Re: replace() function

From: Daniel Stenberg <Daniel.Stenberg_at_sth.frontec.se_at_hypermail-project.org>
Date: Wed, 14 Oct 1998 10:59:52 +0200 (MET DST)
Message-ID: <Pine.SO4.4.05.9810141051580.10189-100000_at_wcsw062>


On Fri, 9 Oct 1998, Byron C. Darrah wrote:

> char *replace(char *string, char *oldpiece, char *newpiece)
> {
> int str_index, newstr_index, oldpiece_index, end,
> new_len, old_len, cpy_len;
> char *c;
> static char newstring[MAXLINE];

This is the old -- bad -- way of solving problems like this. Hypermail must be cleaned off *ALL* uses of static buffers used in manners like this. I know Kent has shouldered the problem to update a lot of the functions for b4, but it also requires that the rest of us, as source contributers, follow the new way of doing it and start producing more robust and less error prone code.

There is no maximum line length anymore. We cannot assume that the input is shorter than MAXLINE and we can certainly not assume that the output is shorter than MAXLINE.

This is not meant to be personal nor do I want to scare off contributors. I just want hypermail to become a superb and stable piece of software.

-- 
   Daniel Stenberg    http://www.fts.frontec.se/~dast     0708-317742
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
Received on Wed 14 Oct 1998 11:02:35 AM GMT

This archive was generated by hypermail 2.3.0 : Sat 13 Mar 2010 03:46:11 AM GMT GMT