Compare commits

..

No commits in common. "759fb4fe0e2f80592f014897cb0887aafc982aa2" and "c17e1a5802cfd424c6d5b406db52dfca8bd01ac7" have entirely different histories.

6 changed files with 13 additions and 67 deletions

View File

@ -1,4 +1,4 @@
/* string.h: String and memory manipulation. */
/* string.h: String manipulation. */
#ifndef _STRING_H
#define _STRING_H
@ -89,12 +89,6 @@ extern "C"
/* Locate a string (needle) in another one (haystack). */
char* strstr(const char* haystack, const char* needle);
/* Compare two null-terminated strings, ignoring case. */
int strcasecmp(const char* a, const char* b);
/* Compare two fixed-size null-terminated strings, ignoring case. */
int strncasecmp(const char* a, const char* b, size_t max);
#ifdef __cplusplus
}
#endif

View File

@ -1,23 +0,0 @@
/* strings.h: String operations. */
#ifndef _STRINGS_H
#define _STRINGS_H
#include <sys/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
/* Compare two null-terminated strings, ignoring case. */
int strcasecmp(const char* a, const char* b);
/* Compare two fixed-size null-terminated strings, ignoring case. */
int strncasecmp(const char* a, const char* b, size_t max);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -7,7 +7,7 @@ extern "C"
void* memset(void* buf, int c, usize n);
int memcmp(const void* a, const void* b, usize n);
void* memmove(void* dest, const void* src, usize n);
void* memchr(const void* buf, int c, usize n);
void* memchr(const void* buf, int c, size_t n);
usize strlen(const char* str);
usize strnlen(const char* str, usize max);
@ -41,7 +41,4 @@ extern "C"
char* strpbrk(const char* s, const char* accept);
char* strstr(const char* haystack, const char* needle);
int strcasecmp(const char* a, const char* b);
int strncasecmp(const char* a, const char* b, usize max);
}

View File

@ -1,6 +1,5 @@
#include <luna/Alloc.h>
#include <luna/CString.h>
#include <luna/CType.h>
extern "C"
{
@ -298,25 +297,4 @@ extern "C"
return nullptr;
}
int strcasecmp(const char* a, const char* b)
{
while (*a && (_tolower(*a) == _tolower(*b)))
{
a++;
b++;
}
return _tolower(*(const u8*)a) - _tolower(*(const u8*)b);
}
int strncasecmp(const char* a, const char* b, usize max)
{
const char* s = a;
while (*a && (_tolower(*a) == _tolower(*b)) && (usize)(a - s) < (max - 1))
{
a++;
b++;
}
return _tolower(*(const u8*)a) - _tolower(*(const u8*)b);
}
}

View File

@ -11,16 +11,16 @@ SOURCES=($(printf -- '%s\n' "${SOURCES[@]}" | grep -v libc | grep -v "Types.h" |
for f in ${SOURCES[@]}
do
sed -i 's/uint8_t /u8 /g' $f
sed -i 's/uint16_t /u16 /g' $f
sed -i 's/uint32_t /u32 /g' $f
sed -i 's/uint64_t /u64 /g' $f
sed -i 's/uint8_t/u8/g' $f
sed -i 's/uint16_t/u16/g' $f
sed -i 's/uint32_t/u32/g' $f
sed -i 's/uint64_t/u64/g' $f
sed -i 's/int8_t /i8 /g' $f
sed -i 's/int16_t /i16 /g' $f
sed -i 's/int32_t /i32 /g' $f
sed -i 's/int64_t /i64 /g' $f
sed -i 's/int8_t/i8/g' $f
sed -i 's/int16_t/i16/g' $f
sed -i 's/int32_t/i32/g' $f
sed -i 's/int64_t/i64/g' $f
sed -i 's/size_t /usize /g' $f
sed -i 's/ssize_t /isize /g' $f
sed -i 's/size_t/usize/g' $f
sed -i 's/ssize_t/isize/g' $f
done

View File

@ -4,7 +4,7 @@ source $(dirname $0)/env.sh
cd $LUNA_ROOT
FOLDERS=(kernel libc libos libluna apps shell tests)
FOLDERS=(kernel libc libos libluna apps)
SOURCES=($(find ${FOLDERS[@]} -type f -name "*.cpp"))
SOURCES+=($(find ${FOLDERS[@]} -type f -name "*.h"))