From 22421447fbaba77d9480e31a69f6b78448ea2b2f Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 25 Nov 2015 16:35:05 -0700 Subject: [PATCH] fix the remaining TODOs in the source --- src/buffer.hpp | 12 ------------ src/main.cpp | 2 +- src/os.cpp | 6 ++---- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/buffer.hpp b/src/buffer.hpp index a58e8bd027..6e455d9d84 100644 --- a/src/buffer.hpp +++ b/src/buffer.hpp @@ -136,18 +136,6 @@ static inline bool buf_eql_buf(Buf *buf, Buf *other) { return buf_eql_mem(buf, buf_ptr(other), buf_len(other)); } -static inline void buf_splice_buf(Buf *buf, int start, int end, Buf *other) { - assert(buf->list.length); - - if (start != end) - zig_panic("TODO buf_splice_buf"); - - int old_buf_len = buf_len(buf); - buf_resize(buf, old_buf_len + buf_len(other)); - memmove(buf_ptr(buf) + start + buf_len(other), buf_ptr(buf) + start, old_buf_len - start); - memcpy(buf_ptr(buf) + start, buf_ptr(other), buf_len(other)); -} - static inline uint32_t buf_hash(Buf *buf) { assert(buf->list.length); // FNV 32-bit hash diff --git a/src/main.cpp b/src/main.cpp index 5ca7ffe968..bfde1d5bda 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -119,7 +119,7 @@ static int build(const char *arg0, const char *in_file, const char *out_file, code_gen(codegen); fprintf(stderr, "\nLink:\n"); - fprintf(stderr, "------------------\n"); + fprintf(stderr, "-------\n"); code_gen_link(codegen, out_file); fprintf(stderr, "OK\n"); diff --git a/src/os.cpp b/src/os.cpp index 888cf6dafc..cb9f9623a9 100644 --- a/src/os.cpp +++ b/src/os.cpp @@ -33,11 +33,9 @@ void os_spawn_process(const char *exe, ZigList &args, bool detache } void os_path_split(Buf *full_path, Buf *out_dirname, Buf *out_basename) { - if (buf_len(full_path) <= 2) - zig_panic("TODO full path small"); int last_index = buf_len(full_path) - 1; - if (buf_ptr(full_path)[buf_len(full_path) - 1] == '/') { - last_index = buf_len(full_path) - 2; + if (last_index >= 0 && buf_ptr(full_path)[last_index] == '/') { + last_index -= 1; } for (int i = last_index; i >= 0; i -= 1) { uint8_t c = buf_ptr(full_path)[i];