lkml.org 
[lkml]   [2004]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Coding style questions for patches..
From
Date
On Mon, 14 Jun 2004 09:55:58 +1000, Neil Brown said:

> This would look better as:
>
> #ifdef CONFIG_SECURITY_RANDPID
> #include <linux/random>
> extern int security_enable_randpid;
> #else
> #define security_enable_randpid (0)
> #endif
>
> static inline int alloc_next_pid(int last_pid) {
> int next;
> if (security_enable_randpid && (last_pid >= RESERVED_PIDS)) {
> pid = (get_random_long() % (pid_max - RESERVED_PIDS)) + RESERVE
D_PIDS + 1;
> }
> else next = last_pid + 1;
> return next;
> }

OK.. Begging the question then - if I go *that* route, I can get rid of the
whole static inline and do it in the one place it gets called (since there's then
no #ifdef'ing in the main .c which was the style commentary I got)....

Would the Style Gods prefer Neils's suggested ifdef stuff in pid.h and then
the 3 line code in pid.c without ifdef's?
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:03    [W:0.032 / U:9.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site