Compare commits
2 Commits
833ee11a4e
...
076b1310e3
Author | SHA1 | Date | |
---|---|---|---|
076b1310e3 | |||
6fb5418314 |
2
compile
Normal file → Executable file
2
compile
Normal file → Executable file
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CC=clang
|
CC=gcc
|
||||||
AR=ar
|
AR=ar
|
||||||
CFLAGS="-c -fPIC -Wall -Werror -pedantic -O3 -Iinclude -Ic-cpp-aliases"
|
CFLAGS="-c -fPIC -Wall -Werror -pedantic -O3 -Iinclude -Ic-cpp-aliases"
|
||||||
SRC="src/cpath.c"
|
SRC="src/cpath.c"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#if defined(__unix__) || defined(__APPLE__) || defined(__ANDROID__)
|
#if defined(__unix__) || defined(__APPLE__) || defined(__ANDROID__)
|
||||||
INTERNAL char path_sep = '/';
|
INTERNAL char path_sep = '/';
|
||||||
#elif defined(_WIN32) || defined(_WIN64)
|
#elif defined(_WIN32) || defined(_WIN64)
|
||||||
INTERNAL char path_sep = '\';
|
INTERNAL char path_sep = '\\';
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void join_root_and_leaf(const char *root, const char *leaf, char *dst);
|
void join_root_and_leaf(const char *root, const char *leaf, char *dst);
|
||||||
@ -70,7 +70,9 @@ void join_root_and_leaf(const char *root, const char *leaf, char *dst) {
|
|||||||
++leaf_start;
|
++leaf_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(dst, root, ++root_end);
|
memcpy(dst, root, ++root_end);
|
||||||
|
|
||||||
dst[root_end] = path_sep;
|
dst[root_end] = path_sep;
|
||||||
strncpy(&(dst[++root_end]), &(leaf[leaf_start]), leaf_length - leaf_start);
|
|
||||||
|
memcpy(&(dst[++root_end]), &(leaf[leaf_start]), leaf_length - leaf_start);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user