summaryrefslogtreecommitdiffhomepage
path: root/DDKit/KernelString.c
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-07-30 08:49:23 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-07-30 08:49:23 +0200
commitbf642edd6c77d405637f0695452460640b8e540d (patch)
treee8e78f658e5eac62790a0fb8129a491183db92d5 /DDKit/KernelString.c
parent60902ec5fc462128d264f63f279c7fc362a72e1d (diff)
[Refactor] SCIKit and DDKit.
[IMP} Prevent DDK from being included when we aren't in kernel mode. Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'DDKit/KernelString.c')
-rw-r--r--DDKit/KernelString.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/DDKit/KernelString.c b/DDKit/KernelString.c
new file mode 100644
index 00000000..3ef65cf2
--- /dev/null
+++ b/DDKit/KernelString.c
@@ -0,0 +1,39 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies
+
+ Purpose: DDK Strings.
+
+------------------------------------------- */
+
+#include <DDKit/KernelString.h>
+
+DK_EXTERN size_t kernelStringLength(const char* in)
+{
+ if (in == nil)
+ return 0;
+ if (*in == 0)
+ return 0;
+
+ size_t index = 0;
+
+ while (in[index] != 0)
+ {
+ ++index;
+ }
+
+ return index;
+}
+
+DK_EXTERN int kernelStringCopy(char* dst, const char* src, size_t len)
+{
+ size_t index = 0;
+
+ while (index != len)
+ {
+ dst[index] = src[index];
+ ++index;
+ }
+
+ return index;
+}