summaryrefslogtreecommitdiffhomepage
path: root/dev/DDKit/KernelString.c
blob: 410ce8260f141b575f2bbe6f87b9112ac9f83f4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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;
}