Skip to content
Snippets Groups Projects
Commit 5c44cf81 authored by Avi Kivity's avatar Avi Kivity
Browse files

file: fold falloc_noinstall() into make_file()


Simpler.

Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
parent 31c32930
No related branches found
No related tags found
No related merge requests found
......@@ -152,21 +152,6 @@ int fget(int fd, struct file **out_fp)
return 0;
}
/*
* Allocate a file structure without installing it into the descriptor table.
*/
static int falloc_noinstall(struct file **resultfp)
{
struct file *fp;
fp = new (std::nothrow) file;
if (!fp)
return ENOMEM;
*resultfp = fp;
return 0;
}
static void finit(struct file *fp, unsigned flags, filetype_t type, void *opaque,
struct fileops *ops)
{
......@@ -183,10 +168,9 @@ static void finit(struct file *fp, unsigned flags, filetype_t type, void *opaque
fileref make_file(unsigned flags, filetype_t type, void *opaque,
struct fileops *ops)
{
file* fp;
auto error = falloc_noinstall(&fp);
if (error) {
throw error;
file* fp = new (std::nothrow) file;
if (!fp) {
throw ENOMEM;
}
finit(fp, flags, type, opaque, ops);
return fileref(fp, false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment