From 40cc5e32663cd0350b791b8e54825f564489343f Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 22 Jul 2020 18:26:56 +0200 Subject: Imported some things from master --- src/lib/def.h | 18 ------------------ src/lib/inc/def.h | 20 ++++++++++++++++++++ src/lib/inc/string.h | 10 ++++++++++ src/lib/string.c | 11 +++++++++++ 4 files changed, 41 insertions(+), 18 deletions(-) delete mode 100644 src/lib/def.h create mode 100644 src/lib/inc/def.h create mode 100644 src/lib/inc/string.h create mode 100644 src/lib/string.c (limited to 'src/lib') diff --git a/src/lib/def.h b/src/lib/def.h deleted file mode 100644 index dc3cc55..0000000 --- a/src/lib/def.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef DEF_H -#define DEF_H - -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - -#define NULL ((void *)0) - -#endif diff --git a/src/lib/inc/def.h b/src/lib/inc/def.h new file mode 100644 index 0000000..69b43e3 --- /dev/null +++ b/src/lib/inc/def.h @@ -0,0 +1,20 @@ +// MIT License, Copyright (c) 2020 Marvin Borner + +#ifndef DEF_H +#define DEF_H + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long long s64; +typedef unsigned long long u64; + +#define NULL ((void *)0) + +#endif diff --git a/src/lib/inc/string.h b/src/lib/inc/string.h new file mode 100644 index 0000000..c97fada --- /dev/null +++ b/src/lib/inc/string.h @@ -0,0 +1,10 @@ +// MIT License, Copyright (c) 2020 Marvin Borner + +#ifndef STRING_H +#define STRING_H + +#include + +u32 strlen(const char *str); + +#endif diff --git a/src/lib/string.c b/src/lib/string.c new file mode 100644 index 0000000..1b7a2b8 --- /dev/null +++ b/src/lib/string.c @@ -0,0 +1,11 @@ +// MIT License, Copyright (c) 2020 Marvin Borner + +#include + +u32 strlen(const char *str) +{ + u32 len = 0; + while (str[len]) + len++; + return len; +} -- cgit v1.2.3