Move string functions to libstring
All checks were successful
Build documentation / build-and-deploy (push) Successful in 27s

This commit is contained in:
2026-02-12 23:05:04 +01:00
parent ec6cd43a14
commit ab758d8929
13 changed files with 50 additions and 9 deletions

View File

@@ -8,3 +8,4 @@ include make/libmsl.mk
include make/liballoc.mk
include make/libterminal.mk
include make/libprocess.mk
include make/libstring.mk

View File

@@ -12,6 +12,7 @@ make -B all_libmsl
make -B all_liballoc
make -B all_libprocess
make -B all_libterminal
make -B all_libstring
make -B all_apps
make -B all_dist
./aux/limine_iso_amd64.sh

View File

@@ -7,4 +7,5 @@ make -B format_libmsl
make -B format_libterminal
make -B format_libprocess
make -B format_liballoc
make -B format_libstring
make -B format_apps

View File

@@ -3,5 +3,6 @@ include ../make/ufuncs.mk
$(eval $(call add_lib,libterminal))
$(eval $(call add_lib,liballoc))
$(eval $(call add_lib,libprocess))
$(eval $(call add_lib,libstring))
include ../make/user.mk

View File

@@ -2,7 +2,7 @@
#include <process/process.h>
#include <stddef.h>
#include <stdint.h>
#include <string/string.h>
#include <string.h>
#include <terminal/terminal.h>
#define MUTEX 2000

View File

@@ -1,4 +1,3 @@
include $(platform)/src.mk
include init/src.mk
include m/src.mk
include string/src.mk

View File

@@ -1,3 +0,0 @@
c += string/string.c
o += string/string.o

28
libstring/Makefile Normal file
View File

@@ -0,0 +1,28 @@
cc := clang
o :=
c :=
cflags := -isystem . -isystem ../libmsl
buildtype ?= release
include src.mk
include ../generic/flags.mk
include ../$(platform)/flags.mk
all: build/libstring.a
build/libstring.a: $(o)
llvm-ar rcs $@ $^
%.o: %.c
$(cc) -c -o $@ $(cflags) $<
%.o: %.S
$(cc) -c -o $@ $(cflags) $<
clean:
rm -f $(o) build/libstring.a
format:
clang-format -i $$(git ls-files '*.c' '*.h')
.PHONY: all clean format

3
libstring/src.mk Normal file
View File

@@ -0,0 +1,3 @@
c += string.c
o += string.o

View File

@@ -1,6 +1,6 @@
#include <stddef.h>
#include <stdint.h>
#include <string/string.h>
#include <string.h>
size_t memset (void* dst, uint8_t b, size_t n) {
uint8_t* dst1 = dst;

View File

@@ -1,5 +1,5 @@
#ifndef _LIBMSL_STRING_STRING_H
#define _LIBMSL_STRING_STRING_H
#ifndef _LIBSTRING_STRING_H
#define _LIBSTRING_STRING_H
#include <stddef.h>
#include <stdint.h>
@@ -10,4 +10,4 @@ void strncpy (char* dst, const char* src, size_t n);
size_t strlen (const char* str);
int memcmp (const void* s1, const void* s2, size_t n);
#endif // _LIBMSL_STRING_STRING_H
#endif // _LIBSTRING_STRING_H

10
make/libstring.mk Normal file
View File

@@ -0,0 +1,10 @@
all_libstring:
make -C libstring platform=$(platform) all
clean_libstring:
make -C libstring platform=$(platform) clean
format_libstring:
make -C libstring platform=$(platform) format
.PHONY: all_libstring clean_libstring format_libstring