DragonFly BSD
DragonFly submit List (threaded) for 2005-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: vmstat WARNS6 cleanup


From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Sat, 8 Jan 2005 20:23:24 +0100
Mail-followup-to: submit@crater.dragonflybsd.org

On Sat, Jan 08, 2005 at 07:31:45PM +0100, Peter Schuller wrote:
> Note #1: This patch depends on previous dmesg patch due to the use
>          of NLIST_NAME macro,

And I don't want to commit that part :)
If you want to split out the rest of the cleanup, e.g. the statification,
I can commit that.

> 
> Note #2: Apart from vmstat itself, this patch also modifies
>          lib/devstat/devstat.(h|c|3). buildmatch() was actually
>          destructive w.r.t. the match string given due to the
>          use of strsep internally.

Commited with some additional cleanup. I prefer retval as variable name
over rc, it's also simpler to set the default value to -1. Also if you
add code, please use the normal file indentation rules.

>          Unfortunately this uglifies the function by complicating
>          subsequent exit paths; but even if one chose to use
>          alloca() (e.g. for performance) one would have to fallback
>          to malloc for large strings anyway.

Actually, alloca has the disadvantage of putting possible a lot of data
on the stack. For classic single threaded apps, that's not a problem,
for multithreaded code it might be. It's also important to keep in mind
that alloca is not really portable.

Joerg



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]