Re: problem using INTERFACE_BUFFER

David Relson <[email protected]> Mon, 23 Dec 2002 10:56:21 -0500
Newsgroups gmane.mail.eps
Message-ID <[email protected]>
At 11:32 AM 12/23/02, [email protected] wrote:

>Yeah.  Version 1.4 fixes all allocation/deallocation errors, as well
>as doing away with the internal MEM_DEBUG stuff (uses an external
>library now).  I'll put 1.4 up pre-release.  It's not done yet, but it
>compiles and works.
>
>Check the link periodically http://www.inter7.com/eps/eps-1.4.tar.gz
>I should have it up in an hour or so.
>
>Good luck!

Hi Matt,

FWIW, looking over the code I found a number of interesting things to do to 
it.

Debugging can be made easier by using enumerated types (which display as 
names) instead of #defines (which display as numbers).  For example, in 
content.h I have "typedef enum enc_e { ... } enc_t" and in mime.h I have 
distinct types in the struct mime_t definition.

In several places there are "if () elseif () elseif()..." sequences that 
can be nicely replaced by switches.  eps.c, content.c, and encode.c are 
places where I've done this.

Stepping through arrays of structures can be made more readable by using 
pointers rather than an index and subscripting.  Similarly a for() loop 
(with its initialization, testing, and incrementing clauses) can replace a 
while loop (with preceding initialization statement and included increment 
statement).  For example, mime_header() can be recoded using the pointer 
technique and content_parse() can be recoded using the switch and pointer 
techniques.

David