Messages in this thread |  | | | Date | Tue, 25 May 1999 14:37:34 +0200 | | From | Jan Kara <> | | Subject | Re: goto's ??? |
| |
Hello.
> 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> > } The way used is a bit more generic - ie. if you later find out that you need to release some lock or so, you just add it there and can be happy. Otherwise you have to change the code and probably miss some case :-). And I think that gcc is clever enough to optimize the jumps...
Honza.
- 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/
|  |