authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2015-11-25 16:35:05-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2015-11-25 16:36:03-07:00
log22421447fbaba77d9480e31a69f6b78448ea2b2f
tree1425e81c43696b71bc04da8f0cb07181aa554807
parente48717e09131fed8c7c6b743f351486b423e3452

fix the remaining TODOs in the source


3 files changed, 3 insertions(+), 17 deletions(-)

src/buffer.hpp-12
...@@ -136,18 +136,6 @@ static inline bool buf_eql_buf(Buf *buf, Buf *other) {...@@ -136,18 +136,6 @@ static inline bool buf_eql_buf(Buf *buf, Buf *other) {
136 return buf_eql_mem(buf, buf_ptr(other), buf_len(other));136 return buf_eql_mem(buf, buf_ptr(other), buf_len(other));
137}137}
138138
139static inline void buf_splice_buf(Buf *buf, int start, int end, Buf *other) {
140 assert(buf->list.length);
141
142 if (start != end)
143 zig_panic("TODO buf_splice_buf");
144
145 int old_buf_len = buf_len(buf);
146 buf_resize(buf, old_buf_len + buf_len(other));
147 memmove(buf_ptr(buf) + start + buf_len(other), buf_ptr(buf) + start, old_buf_len - start);
148 memcpy(buf_ptr(buf) + start, buf_ptr(other), buf_len(other));
149}
150
151static inline uint32_t buf_hash(Buf *buf) {139static inline uint32_t buf_hash(Buf *buf) {
152 assert(buf->list.length);140 assert(buf->list.length);
153 // FNV 32-bit hash141 // FNV 32-bit hash
src/main.cpp+1-1
...@@ -119,7 +119,7 @@ static int build(const char *arg0, const char *in_file, const char *out_file,...@@ -119,7 +119,7 @@ static int build(const char *arg0, const char *in_file, const char *out_file,
119 code_gen(codegen);119 code_gen(codegen);
120120
121 fprintf(stderr, "\nLink:\n");121 fprintf(stderr, "\nLink:\n");
122 fprintf(stderr, "------------------\n");122 fprintf(stderr, "-------\n");
123 code_gen_link(codegen, out_file);123 code_gen_link(codegen, out_file);
124 fprintf(stderr, "OK\n");124 fprintf(stderr, "OK\n");
125125
src/os.cpp+2-4
...@@ -33,11 +33,9 @@ void os_spawn_process(const char *exe, ZigList<const char *> &args, bool detache...@@ -33,11 +33,9 @@ void os_spawn_process(const char *exe, ZigList<const char *> &args, bool detache
33}33}
3434
35void os_path_split(Buf *full_path, Buf *out_dirname, Buf *out_basename) {35void os_path_split(Buf *full_path, Buf *out_dirname, Buf *out_basename) {
36 if (buf_len(full_path) <= 2)
37 zig_panic("TODO full path small");
38 int last_index = buf_len(full_path) - 1;36 int last_index = buf_len(full_path) - 1;
39 if (buf_ptr(full_path)[buf_len(full_path) - 1] == '/') {37 if (last_index >= 0 && buf_ptr(full_path)[last_index] == '/') {
40 last_index = buf_len(full_path) - 2;38 last_index -= 1;
41 }39 }
42 for (int i = last_index; i >= 0; i -= 1) {40 for (int i = last_index; i >= 0; i -= 1) {
43 uint8_t c = buf_ptr(full_path)[i];41 uint8_t c = buf_ptr(full_path)[i];