diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-08-07 15:00:13 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-08-07 15:00:13 +0000 |
commit | d71cc503a6f50f8c576eb8665ce3cf08d74e035b (patch) | |
tree | cfc26dcfff6c006ba76d715e8018428b1e66feac /src/libexpr | |
parent | 4cad125e088576035ea8f7955d7770278aa6ed24 (diff) | |
download | guix-d71cc503a6f50f8c576eb8665ce3cf08d74e035b.tar.gz |
* Don't allocate input files on the stack.
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/parser.y | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index 1c06240fda..82b24cd073 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -383,20 +383,8 @@ Expr parseExprFromFile(EvalState & state, Path path) if (S_ISDIR(st.st_mode)) path = canonPath(path + "/default.nix"); - /* Read the input file. We can't use SGparseFile() because it's - broken, so we read the input ourselves and call - SGparseString(). */ - AutoCloseFD fd = open(path.c_str(), O_RDONLY); - if (fd == -1) throw SysError(format("opening `%1%'") % path); - - if (fstat(fd, &st) == -1) - throw SysError(format("statting `%1%'") % path); - - char text[st.st_size + 1]; - readFull(fd, (unsigned char *) text, st.st_size); - text[st.st_size] = 0; - - return parse(state, text, path, dirOf(path)); + /* Read and parse the input file. */ + return parse(state, readFile(path).c_str(), path, dirOf(path)); } |