lib: c: re-organise into separate static modules, plus a single shared library

This commit is contained in:
2026-03-10 19:15:59 +00:00
parent 6d88cf4bf3
commit ea6ec785a9
18 changed files with 291 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
set(source_dirs stdlib)
set(source_dirs stdlib string)
file(GLOB sources *.c *.h)

View File

@@ -0,0 +1,14 @@
#include <stdlib.h>
#include <string.h>
char *strdup(char *s)
{
size_t len = strlen(s);
char *out = malloc(len + 1);
if (!out) {
return NULL;
}
memcpy(out, s, len + 1);
return out;
}