httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <...@apache.org>
Subject Re: My first Apache module!
Date Thu, 25 Aug 2011 00:44:03 GMT

On 24 Aug 2011, at 22:59, Chris London wrote:

> Hey everyone,
> 
> I don't like to bother mailing lists with beginner questions so I spent
> a few hours on Google looking for info and tutorials.

Good!

> Here's the source code:
> https://github.com/chrislondon/Dynamic-Stylesheets/blob/master/mod_dss.c

Hey, I thought for a moment you were doing something with DSSSL.
You got me all excited!

You're at risk of leaking memory and file descriptors anytime something
sends processing into an error path while they're allocated/open.
The solution is to use pools.  See http://www.apachetutor.org/dev/pools

Less crucially, the APR abstraction of file IO is preferred over FILE*.

Minor point: it's good practice to make your symbols static unless they're
an exported API.  Why is T_fread spilled over to global namespace?

Once you're a bit more confident, you might want to re-write the
parser as a filter, so it can process your data format not just from
a static file but also from a dynamic or proxied source.

-- 
Nick Kew

Mime
View raw message