diff options
| author | Amlal El Mahrouss <zka-holder@mahrouss-logic.com> | 2024-10-14 05:58:38 +0000 |
|---|---|---|
| committer | Amlal El Mahrouss <zka-holder@mahrouss-logic.com> | 2024-10-14 05:58:38 +0000 |
| commit | 7ad3739afdfaa2466723467f5ef2526f171c87c3 (patch) | |
| tree | 37775f4299281598b0f5121df4c188392daebd04 /dev/zka/src/String.cxx | |
| parent | 7477a0f942c374b652da4f80cdb36d4661aac3c8 (diff) | |
| parent | d9d82713326069478e6dd212763d1fac15e65370 (diff) | |
Merge branch 'port-stage1-hello-world' into 'unstable'
IMP: Basic ARM64 port.
See merge request mahrouss/zka-dev!20
Diffstat (limited to 'dev/zka/src/String.cxx')
| -rw-r--r-- | dev/zka/src/String.cxx | 48 |
1 files changed, 3 insertions, 45 deletions
diff --git a/dev/zka/src/String.cxx b/dev/zka/src/String.cxx index bb0f80e3..520e42f3 100644 --- a/dev/zka/src/String.cxx +++ b/dev/zka/src/String.cxx @@ -86,52 +86,10 @@ namespace Kernel if (!data || *data == 0) return {}; - StringView view(rt_string_len(data)); + StringView* view = new StringView(rt_string_len(data)); + (*view) += data; - view += data; - - return ErrorOr<StringView>(view); - } - - const Char* StringBuilder::FromInt(const Char* fmt, int i) - { - if (!fmt) - return ("-1"); - - char* ret = (char*)ALLOCA(sizeof(char) * 8 + rt_string_len(fmt)); - - if (!ret) - return ("-1"); - - Char result[8]; - - if (!rt_to_string(result, sizeof(int), i)) - { - return ("-1"); - } - - const auto fmt_len = rt_string_len(fmt); - const auto res_len = rt_string_len(result); - - for (Size idx = 0; idx < fmt_len; ++idx) - { - if (fmt[idx] == '%') - { - SizeT result_cnt = idx; - - for (auto y_idx = idx; y_idx < res_len; ++y_idx) - { - ret[result_cnt] = result[y_idx]; - ++result_cnt; - } - - break; - } - - ret[idx] = fmt[idx]; - } - - return ret; /* Copy that ret into a buffer, 'ALLOCA' allocates to the stack */ + return ErrorOr<StringView>(*view); } const Char* StringBuilder::FromBool(const Char* fmt, bool i) |
