Major restructure
This commit is contained in:
parent
0562c2fe5a
commit
c52e19de83
25 changed files with 574 additions and 188 deletions
|
|
@ -1,7 +1,45 @@
|
|||
#pragma once
|
||||
#include <types.h>
|
||||
#ifndef KERNEL_STRING_H
|
||||
#define KERNEL_STRING_H
|
||||
|
||||
void *memcpy(void *s1, const void *s2, size_t n);
|
||||
void *memmove(void *s1, const void *s2, size_t n);
|
||||
void *memset(void *dest, int c, size_t n);
|
||||
int memcmp(const void *s1, const void *s2, size_t n);
|
||||
#include <stdint.h>
|
||||
|
||||
// void *memcpy(void *s1, const void *s2, size_t n);
|
||||
// void *memmove(void *s1, const void *s2, size_t n);
|
||||
// void *memset(void *dest, int c, size_t n);
|
||||
// int memcmp(const void *s1, const void *s2, size_t n);
|
||||
|
||||
/** Integer to ascii */
|
||||
char *itoa(int value, char *str, int base);
|
||||
|
||||
/** Fill memory with constant byte */
|
||||
void *memset(void *dst, int c, size_t len);
|
||||
|
||||
/** Copy `len` bytes from `src` to `dst`. Undefined if regions overlap. */
|
||||
void *memcpy(void *dst, const void *src, size_t len);
|
||||
|
||||
/** Copy `len` bytes from `src` to `dst`, safe for overlapping regions. */
|
||||
void *memmove(void *dst, const void *src, size_t len);
|
||||
|
||||
/** Compare `len` bytes of `s1` and `s2`.
|
||||
* Returns 0 if equal, <0 if s1 < s2, >0 if s1 > s2. */
|
||||
int memcmp(const void *s1, const void *s2, size_t len);
|
||||
|
||||
/** Returns the length of a null-terminated string */
|
||||
size_t strlen(const char *s);
|
||||
|
||||
/** Return length of string `s`, up to a max of `maxlen` bytes */
|
||||
size_t strnlen(const char *s, size_t maxlen);
|
||||
|
||||
// TODO: These:
|
||||
/*
|
||||
int strcmp(const char *s1, const char *s2);
|
||||
int strncmp(const char *s1, const char *s2, size_t n);
|
||||
|
||||
char *strcpy(char *dst, const char *src);
|
||||
char *strncpy(char *dst, const char *src, size_t n);
|
||||
|
||||
char *strchr(const char *s, int c);
|
||||
char *strrchr(const char *s, int c);
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue