fix the remaining TODOs in the source

master
Andrew Kelley 2015-11-25 16:35:05 -07:00
parent e48717e091
commit 22421447fb
3 changed files with 3 additions and 17 deletions

View File

@ -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

View File

@ -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");

View File

@ -33,11 +33,9 @@ void os_spawn_process(const char *exe, ZigList<const char *> &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];