Small fixes
This commit is contained in:
@@ -36,10 +36,8 @@ Array<S8_String> &operator+=(Array<S8_String> &a, S8_String s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//@todo: split on any whitespace instead!
|
//@todo: split on any whitespace instead!
|
||||||
Array<S8_String> Split(char *str) {
|
Array<S8_String> Split(S8_String s, S8_String sep = " ") {
|
||||||
S8_String s = S8_MakeFromChar(str);
|
S8_List list = S8_Split(Perm, s, sep, 0);
|
||||||
S8_List list = S8_Split(Perm, s, S8_Lit(" "), 0);
|
|
||||||
|
|
||||||
Array<S8_String> result = {*Perm};
|
Array<S8_String> result = {*Perm};
|
||||||
S8_For(it, list) result.add(it->string);
|
S8_For(it, list) result.add(it->string);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ int main(int argument_count, char **arguments) {
|
|||||||
flags += "-Wno-writable-strings";
|
flags += "-Wno-writable-strings";
|
||||||
flags += "-fno-exceptions";
|
flags += "-fno-exceptions";
|
||||||
flags += "-fno-rtti";
|
flags += "-fno-rtti";
|
||||||
|
flags += "-lm";
|
||||||
flags += Fmt("-o %.*s", S8_Expand(exe_name));
|
flags += Fmt("-o %.*s", S8_Expand(exe_name));
|
||||||
result = Run(cc + build_file + flags);
|
result = Run(cc + build_file + flags);
|
||||||
}
|
}
|
||||||
@@ -69,6 +70,7 @@ int main(int argument_count, char **arguments) {
|
|||||||
flags += "-Wno-write-strings";
|
flags += "-Wno-write-strings";
|
||||||
flags += "-fno-exceptions";
|
flags += "-fno-exceptions";
|
||||||
flags += "-fno-rtti";
|
flags += "-fno-rtti";
|
||||||
|
flags += "-lm";
|
||||||
flags += Fmt("-o %.*s", S8_Expand(exe_name));
|
flags += Fmt("-o %.*s", S8_Expand(exe_name));
|
||||||
result = Run(cc + build_file + flags);
|
result = Run(cc + build_file + flags);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ S8_API S8_String S8_MergeWithSeparator(S8_Allocator allocator, S8_List list, S8_
|
|||||||
int64_t base_size = (list.char_count + 1);
|
int64_t base_size = (list.char_count + 1);
|
||||||
int64_t sep_size = (list.node_count - 1) * separator.len;
|
int64_t sep_size = (list.node_count - 1) * separator.len;
|
||||||
int64_t size = base_size + sep_size;
|
int64_t size = base_size + sep_size;
|
||||||
char *buff = (char *)S8_ALLOCATE(allocator, sizeof(char) * size);
|
char *buff = (char *)S8_ALLOCATE(allocator, sizeof(char) * (size + 1));
|
||||||
S8_String string = S8_Make(buff, 0);
|
S8_String string = S8_Make(buff, 0);
|
||||||
for (S8_Node *it = list.first; it; it = it->next) {
|
for (S8_Node *it = list.first; it; it = it->next) {
|
||||||
S8_ASSERT(string.len + it->string.len <= size);
|
S8_ASSERT(string.len + it->string.len <= size);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define FIRST_S8_STRING
|
#define FIRST_S8_STRING
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifndef S8_API
|
#ifndef S8_API
|
||||||
#define S8_API
|
#define S8_API
|
||||||
|
|||||||
Reference in New Issue
Block a user