Re: Coding style questions for patches..

From: Valdis . Kletnieks
Date: Sun Jun 13 2004 - 19:22:18 EST


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?

Attachment: pgp00000.pgp
Description: PGP signature