Re: [CFT] [JANITORIAL] Unbork fs.h

From: Daniel Phillips (phillips@bonn-fries.net)
Date: Thu Jan 03 2002 - 20:44:39 EST


On January 4, 2002 12:25 am, J.A. Magallon wrote:
> Perhaps it is a silly question for kernel hackers, but I found it useful
> for making code more readable...
> Why dont you use things like:
>
> typedef struct inode inode;
> typedef struct super_block super_block;
>
> so you can write things like
>
> static inline inode* new_inode(super_block* cb)
> {
> inode* ni;
> ni = (inode*)malloc(sizeof(inode));
> ...
> }
>
> (ie, kill 'struct' visual pollution...)
>
> ??
>
> Isn't it more readable ?
>
> Just curious...

Needing to type 'struct' everywhere is annoying and makes for long lines.
Other than that it's harmless, and actually, the situation where you have two
ways of spelling everything is annoying too. Anyway, if it was to be done,
I'd spell it:

        typedef struct super_struct super;
        typedef struct inode_struct inode;

        static inline inode *new_inode(super *sb)
        {
                inode *ni = (inode *) malloc(sizeof(inode));
                ...
        }

It won't happen though, because it would generate a massive diff for the sole
reason of making things prettier, and a very high percentage of existing
patches would break immediately. If you're going to clean stuff up, you have
to do it a bit at a time while you're working on other things.

--
Daniel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 07 2002 - 21:00:23 EST