Started on path resolution algorithm

- The algorithm will work once I am of better mind to deal with
raw C strings
- The resolution should look at each entry divided by '/'.
  if the entry is not there then we can quit early, however for
now I am mostly concerned with getting the names of directory entries
we would need to look for.
This commit is contained in:
2023-02-19 22:14:58 +01:00
parent dbb147e110
commit 94a2de3847
7 changed files with 210 additions and 16 deletions

View File

@ -1,6 +1,7 @@
#pragma once
// NOTE: These should not be inline
inline void* memset (void* ptr, int value, size_t num){
inline void* memset (void* ptr, int value, size_t num)
{
for( int i = 0; i < num; i++ )
{
unsigned char* data = (unsigned char*)ptr+ i;
@ -12,19 +13,19 @@ inline void* memset (void* ptr, int value, size_t num){
inline int memcmp( const void* ptr1, const void* ptr2, size_t num)
{
const unsigned char * cs = (const unsigned char*) ptr1;
const unsigned char * ct = (const unsigned char*) ptr2;
{
const unsigned char * cs = (const unsigned char*) ptr1;
const unsigned char * ct = (const unsigned char*) ptr2;
for (int i = 0 ; i < num ; i++, cs++, ct++ ){
if( *cs < *ct){
return -1;
} else if( *cs > *ct){
return 1;
}
}
for (int i = 0 ; i < num ; i++, cs++, ct++ ){
if( *cs < *ct){
return -1;
} else if( *cs > *ct){
return 1;
}
}
return 0;
return 0;
}
}