Re: Code cleanup

2000-09-02 Thread Federico Mena Quintero
Nick Lamb <[EMAIL PROTECTED]> writes: > > If p is a null pointer then "free (p)" may (and should!) crash. You > > are incorrect here. > > You are completely wrong, see K&R's treatment of ANSI C Sorry, my bad. I just checked the ISO standard and indeed, free(NULL) is safe. I guess that makes

Re: Code cleanup

2000-08-31 Thread Garry R. Osgood
Maurits Rijk wrote: > I just had a look at the code of some of the plug-ins and I noticed that > there is often lot's of room for improvement: Yep. > > So my question: is it worth the effort to carefully go through all the > code (not only plug-ins) and clean things up? Worth relates to wheth

Re: Code cleanup

2000-08-31 Thread Nick Lamb
On Thu, Aug 31, 2000 at 03:48:37PM -0400, Federico Mena Quintero wrote: > If p is a null pointer then "free (p)" may (and should!) crash. You > are incorrect here. You are completely wrong, see K&R's treatment of ANSI C Standard Library, Section B6 void free(void *p) free deallocates the sp

Re: Code cleanup

2000-08-31 Thread Marc Lehmann
On Thu, Aug 31, 2000 at 09:22:56PM +0200, Mail Delivery System <[EMAIL PROTECTED]> wrote: > > if (p) > >free(p); > > > I would not assume that it is safe to free() a NULL pointer in _all_ True. OTOH, this has been an internationally accepted standard since 11 years. The question is

Re: Code cleanup

2000-08-31 Thread David Odin
On Thu, Aug 31, 2000 at 03:48:37PM -0400, Federico Mena Quintero wrote: > Maurits Rijk <[EMAIL PROTECTED]> writes: > > [ ... ] > > > 3) sometimes it's just lack of C knowledge: > > > > if (p) > >free(p); > > > > can be simply replaced by just: > > > > free(p); > > If p is a

Re: Code cleanup

2000-08-31 Thread Maurits Rijk
Federico Mena Quintero wrote: > > 3) sometimes it's just lack of C knowledge: > > > > if (p) > > free(p); > > > > can be simply replaced by just: > > > > free(p); > > If p is a null pointer then "free (p)" may (and should!) crash. You > are incorrect here. Hm. According to

Re: Code cleanup

2000-08-31 Thread Federico Mena Quintero
Maurits Rijk <[EMAIL PROTECTED]> writes: > I just had a look at the code of some of the plug-ins and I noticed that > there is often lot's of room for improvement: > > 1) some constructions are plain clumsy, for example somewhere I saw: > > for (k = 0; k < bytes; k++) destline++; > > ins

Re: Code cleanup

2000-08-31 Thread Austin Donnelly
On Thursday, 31 Aug 2000, Maurits Rijk wrote: > 3) sometimes it's just lack of C knowledge: > > if (p) > free(p); > > can be simply replaced by just: > > free(p); I would not assume that it is safe to free() a NULL pointer in _all_ vendor's libc implementations. That's

Code cleanup

2000-08-31 Thread Maurits Rijk
I just had a look at the code of some of the plug-ins and I noticed that there is often lot's of room for improvement: 1) some constructions are plain clumsy, for example somewhere I saw: for (k = 0; k < bytes; k++) destline++; instead of simply: destline += bytes; 2) a lot o