aboutsummaryrefslogtreecommitdiff
path: root/src/stage1/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-10-26 16:06:14 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-10-26 16:06:14 -0700
commit435c8ad703503e4dcc102b0907b45459d2693822 (patch)
tree2c2a1847430064d4ddb6bd4a74d1e3076ce7680f /src/stage1/analyze.cpp
parent1ce09948975a148e09bf405f6a899e4fb0730ce6 (diff)
downloadzig-435c8ad703503e4dcc102b0907b45459d2693822.tar.gz
zig-435c8ad703503e4dcc102b0907b45459d2693822.zip
non-hacky workaround for the empty file bug
See #3328
Diffstat (limited to 'src/stage1/analyze.cpp')
-rw-r--r--src/stage1/analyze.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp
index 24530307a2..fd0de8e907 100644
--- a/src/stage1/analyze.cpp
+++ b/src/stage1/analyze.cpp
@@ -8052,13 +8052,10 @@ not_integer:
}
Error file_fetch(CodeGen *g, Buf *resolved_path, Buf *contents_buf) {
- size_t len = 0xAA;
+ size_t len;
const char *contents = stage2_fetch_file(&g->stage1, buf_ptr(resolved_path), buf_len(resolved_path), &len);
- if (len == 0) {
- // File exists but is empty (otherwise it would be 0xAA)
- } else if (contents == nullptr) {
+ if (contents == nullptr)
return ErrorFileNotFound;
- }
buf_init_from_mem(contents_buf, contents, len);
return ErrorNone;
}