mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-29 02:40:05 +00:00
Merge branch 'master' into compiler-improvements-2023-01
This commit is contained in:
@@ -1536,6 +1536,25 @@ gb_internal bool init_build_paths(String init_filename) {
|
||||
output_name = remove_extension_from_path(output_name);
|
||||
output_name = copy_string(ha, string_trim_whitespace(output_name));
|
||||
output_path = path_from_string(ha, output_name);
|
||||
|
||||
// Note(Dragos): This is a fix for empty filenames
|
||||
// Turn the trailing folder into the file name
|
||||
if (output_path.name.len == 0) {
|
||||
isize len = output_path.basename.len;
|
||||
while (len > 1 && output_path.basename[len - 1] != '/') {
|
||||
len -= 1;
|
||||
}
|
||||
// We reached the slash
|
||||
String old_basename = output_path.basename;
|
||||
output_path.basename.len = len - 1; // Remove the slash
|
||||
output_path.name = substring(old_basename, len, old_basename.len);
|
||||
output_path.basename = copy_string(ha, output_path.basename);
|
||||
output_path.name = copy_string(ha, output_path.name);
|
||||
// The old basename is wrong. Delete it
|
||||
gb_free(ha, old_basename.text);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Replace extension.
|
||||
if (output_path.ext.len > 0) {
|
||||
|
||||
@@ -107,7 +107,9 @@ gb_internal String path_to_string(gbAllocator a, Path path) {
|
||||
|
||||
isize i = 0;
|
||||
gb_memmove(str+i, path.basename.text, path.basename.len); i += path.basename.len;
|
||||
|
||||
gb_memmove(str+i, "/", 1); i += 1;
|
||||
|
||||
gb_memmove(str+i, path.name.text, path.name.len); i += path.name.len;
|
||||
if (path.ext.len > 0) {
|
||||
gb_memmove(str+i, ".", 1); i += 1;
|
||||
@@ -150,6 +152,7 @@ gb_internal Path path_from_string(gbAllocator a, String const &path) {
|
||||
return res;
|
||||
}
|
||||
|
||||
// Note(Dragos): Is the copy_string required if it's a substring?
|
||||
isize name_start = (res.basename.len > 0) ? res.basename.len + 1 : res.basename.len;
|
||||
res.name = substring(fullpath, name_start, fullpath.len);
|
||||
res.name = remove_extension_from_path(res.name);
|
||||
|
||||
+4
-4
@@ -699,7 +699,7 @@ extern "C" int __ulock_wake(uint32_t operation, void *addr, uint64_t wake_value)
|
||||
gb_internal void futex_signal(Futex *f) {
|
||||
for (;;) {
|
||||
int ret = __ulock_wake(UL_COMPARE_AND_WAIT | ULF_NO_ERRNO, f, 0);
|
||||
if (ret == 0) {
|
||||
if (ret >= 0) {
|
||||
return;
|
||||
}
|
||||
if (ret == -EINTR || ret == -EFAULT) {
|
||||
@@ -732,14 +732,14 @@ gb_internal void futex_broadcast(Futex *f) {
|
||||
gb_internal void futex_wait(Futex *f, Footex val) {
|
||||
for (;;) {
|
||||
int ret = __ulock_wait(UL_COMPARE_AND_WAIT | ULF_NO_ERRNO, f, val, 0);
|
||||
if (ret == 0) {
|
||||
if (ret >= 0) {
|
||||
if (*f != val) {
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (ret == -EINTR || ret == -EFAULT) {
|
||||
-continue;
|
||||
if (ret == -EINTR || ret == -EFAULT) {continue;
|
||||
ret = -ret;
|
||||
}
|
||||
if (ret == -ENOENT) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user