Compare commits

..

No commits in common. "076b1310e3c74d0a0ae3076a33e40862234d19d1" and "833ee11a4e1ab85e79f8a116d54ecb4432e87b01" have entirely different histories.

3 changed files with 4 additions and 6 deletions

0
build Executable file → Normal file
View File

2
compile Executable file → Normal file
View File

@ -1,6 +1,6 @@
#!/bin/bash
CC=gcc
CC=clang
AR=ar
CFLAGS="-c -fPIC -Wall -Werror -pedantic -O3 -Iinclude -Ic-cpp-aliases"
SRC="src/cpath.c"

View File

@ -7,7 +7,7 @@
#if defined(__unix__) || defined(__APPLE__) || defined(__ANDROID__)
INTERNAL char path_sep = '/';
#elif defined(_WIN32) || defined(_WIN64)
INTERNAL char path_sep = '\\';
INTERNAL char path_sep = '\';
#endif
void join_root_and_leaf(const char *root, const char *leaf, char *dst);
@ -70,9 +70,7 @@ void join_root_and_leaf(const char *root, const char *leaf, char *dst) {
++leaf_start;
}
memcpy(dst, root, ++root_end);
strncpy(dst, root, ++root_end);
dst[root_end] = path_sep;
memcpy(&(dst[++root_end]), &(leaf[leaf_start]), leaf_length - leaf_start);
strncpy(&(dst[++root_end]), &(leaf[leaf_start]), leaf_length - leaf_start);
}