Re: vmstat WARNS6 cleanup

看板DFBSD_submit作者時間21年前 (2005/01/09 03:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/10 (看更多)
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
文章代碼(AID): #11u3L200 (DFBSD_submit)
討論串 (同標題文章)
文章代碼(AID): #11u3L200 (DFBSD_submit)