RE: thoughts on memory usage...

From: Larmour, Jonathan <Jonathan.Larmour@dont-contact.us>
Date: Thu, 21 Aug 1997 22:52:26 +0100

--MimeMultipartBoundary
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

>From: Michael O'Reilly
>Sent: 21 August 1997 07:36
>To: Duane Wessels
>Cc: David Luyer; Srecko Tahirovic; squid-dev@nlanr.net
>Subject: Re: thoughts on memory usage...
>
>Duane Wessels <wessels@nlanr.net> writes:
[snip]
>> DECODE(entry->url). But then things become complicated if you ever
>> need to do:
>>
>> foo(.., DECODE(e1->url), DECODE(e2->url), ...)
>>
>> because you can't just decode into a static array (i.e. like
>> inet_ntoa() does).
>
>You can actually get away with this, there's a disgusting trick you do
>to make it work (mostly).
[snip]

This is silly (and the trick is indeed disgusting :-)). Just pass in a
char* on the calling functions stack as a param to decode. It also gets
returned. In the case above, use two different char *s.

e.g.
char url1[BUFSIZE];
char url2[BUFSIZE];
foo(..., DECODE(e1->url, url1), DECODE(e2->url, url2), ...);

where DECODE is of the form
#define DECODE(a,b) { munge a into b; return b }

Shurely this is the obvious way to do it.

Jonathan L.
Origin,323 Cambridge Science Park,Cambridge,England. Tel:+44(1223)423355
-----[ It is impossible to enjoy idling thoroughly unless one has ]-----
--------------[ plenty of work to do - Jerome K. Jerome ]---------------
Fight spam! http://spam.abuse.net/ These opinions are all my own fault

--MimeMultipartBoundary--
Received on Tue Jul 29 2003 - 13:15:42 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:24 MST