Skip to content

Commit

Permalink
Merge pull request #3770 from yebblies/gluector
Browse files Browse the repository at this point in the history
[DDMD] Do not call constructors from the glue layer (lib*)
  • Loading branch information
9rnsr committed Jul 16, 2014
1 parent 156856d commit 64745c1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
13 changes: 6 additions & 7 deletions src/libelf.c
Expand Up @@ -105,7 +105,7 @@ void LibElf::setFilename(const char *dir, const char *filename)
arg = FileName::combine(dir, arg);
const char *libfilename = FileName::defaultExt(arg, global.lib_ext);

libfile = new File(libfilename);
libfile = File::create(libfilename);

loc.filename = libfile->name->toChars();
loc.linnum = 0;
Expand Down Expand Up @@ -312,12 +312,11 @@ void LibElf::addObject(const char *module_name, void *buf, size_t buflen)
int fromfile = 0;
if (!buf)
{ assert(module_name[0]);
FileName f((char *)module_name);
File file(&f);
readFile(Loc(), &file);
buf = file.buffer;
buflen = file.len;
file.ref = 1;
File *file = File::create((char *)module_name);
readFile(Loc(), file);
buf = file->buffer;
buflen = file->len;
file->ref = 1;
fromfile = 1;
}
int reason = 0;
Expand Down
13 changes: 6 additions & 7 deletions src/libmach.c
Expand Up @@ -115,7 +115,7 @@ void LibMach::setFilename(const char *dir, const char *filename)
arg = FileName::combine(dir, arg);
const char *libfilename = FileName::defaultExt(arg, global.lib_ext);

libfile = new File(libfilename);
libfile = File::create(libfilename);

loc.filename = libfile->name->toChars();
loc.linnum = 0;
Expand Down Expand Up @@ -323,12 +323,11 @@ void LibMach::addObject(const char *module_name, void *buf, size_t buflen)
int fromfile = 0;
if (!buf)
{ assert(module_name[0]);
FileName f((char *)module_name);
File file(&f);
readFile(Loc(), &file);
buf = file.buffer;
buflen = file.len;
file.ref = 1;
File *file = File::create((char *)module_name);
readFile(Loc(), file);
buf = file->buffer;
buflen = file->len;
file->ref = 1;
fromfile = 1;
}
int reason = 0;
Expand Down
13 changes: 6 additions & 7 deletions src/libmscoff.c
Expand Up @@ -131,7 +131,7 @@ void LibMSCoff::setFilename(const char *dir, const char *filename)
arg = FileName::combine(dir, arg);
const char *libfilename = FileName::defaultExt(arg, global.lib_ext);

libfile = new File(libfilename);
libfile = File::create(libfilename);

loc.filename = libfile->name->toChars();
loc.linnum = 0;
Expand Down Expand Up @@ -343,12 +343,11 @@ void LibMSCoff::addObject(const char *module_name, void *buf, size_t buflen)
int fromfile = 0;
if (!buf)
{ assert(module_name[0]);
FileName f((char *)module_name);
File file(&f);
readFile(Loc(), &file);
buf = file.buffer;
buflen = file.len;
file.ref = 1;
File *file = File::create((char *)module_name);
readFile(Loc(), file);
buf = file->buffer;
buflen = file->len;
file->ref = 1;
fromfile = 1;
}
int reason = 0;
Expand Down
13 changes: 6 additions & 7 deletions src/libomf.c
Expand Up @@ -111,7 +111,7 @@ void LibOMF::setFilename(const char *dir, const char *filename)
arg = FileName::combine(dir, arg);
const char *libfilename = FileName::defaultExt(arg, global.lib_ext);

libfile = new File(libfilename);
libfile = File::create(libfilename);

loc.filename = libfile->name->toChars();
loc.linnum = 0;
Expand Down Expand Up @@ -236,12 +236,11 @@ void LibOMF::addObject(const char *module_name, void *buf, size_t buflen)
#endif
if (!buf)
{ assert(module_name);
FileName f((char *)module_name);
File file(&f);
readFile(Loc(), &file);
buf = file.buffer;
buflen = file.len;
file.ref = 1;
File *file = File::create((char *)module_name);
readFile(Loc(), file);
buf = file->buffer;
buflen = file->len;
file->ref = 1;
}

unsigned g_page_size;
Expand Down

0 comments on commit 64745c1

Please sign in to comment.