goto's ???

Mofeed Shahin (shahin@labf.org)
Sun, 23 May 1999 02:31:54 +0930 (CST)


G'day all,

I was just have a bit of a look at the fs code, and noticed something a
little odd. There are alot of 'goto' statements in the code. From what I
can see they are not needed.

eg :
line 632 of /usr/src/linux/fs/open.c :

struct file *filp_open(const char * filename, int flags, int mode)
{
struct inode * inode;
struct dentry * dentry;
struct file * f;
int flag,error;

error = -ENFILE;
f = get_empty_filp();
if (!f)
goto out;
....
<SNIP>

out:
return ERR_PTR(error);
}

this seems like an extra jmp statement to me (unless the compiler
optimises it)

ie why not just do this :
struct file *filp_open(const char * filename, int flags, int mode)
{
struct inode * inode;
struct dentry * dentry;
struct file * f;
int flag,error;

error = -ENFILE;
f = get_empty_filp();
if (!f)
return ERR_PTR(error);
....
<SNIP>
}

Cheers Mof.

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