Static variables in NCproc for parsing

Russ Allbery rra at stanford.edu
Tue Nov 3 01:08:52 UTC 2009


Julien ÉLIE <julien at trigofacile.com> writes:

> I've added a *static* variable "av" because Argify uses xstrdup and we
> need to properly free what it created last time it was called.  I think
> it works because innd reads its channels one by one, in sequence.
> Otherwise, memory will leak.

> Is it the right thing to do for "ac" and "av"?

The extra persistant state that we're recording per channel should really
be stored in the channel struct in innd.  I would add an additional
variable to the channel struct; I think it will be visible in all the
places that you need it.

In practice, this doesn't really matter that much at present since innd
uses static variables in rather too many places, but in the long run it
would be nice to get rid of them wherever possible.  (That will be needed
if we were ever to make innd threaded, for instance.)

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.



More information about the inn-workers mailing list