mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Use mem* function
This commit is contained in:
parent
187750556c
commit
f1a9446b99
|
@ -1038,6 +1038,7 @@ static char *abspath(const char *path, const char *cwd)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
size_t dst_size = 0, src_size = xstrlen(path), cwd_size = xstrlen(cwd);
|
size_t dst_size = 0, src_size = xstrlen(path), cwd_size = xstrlen(cwd);
|
||||||
|
size_t len = src_size;
|
||||||
const char *src;
|
const char *src;
|
||||||
char *dst;
|
char *dst;
|
||||||
/*
|
/*
|
||||||
|
@ -1058,7 +1059,7 @@ static char *abspath(const char *path, const char *cwd)
|
||||||
src = path;
|
src = path;
|
||||||
dst = resolved_path + dst_size;
|
dst = resolved_path + dst_size;
|
||||||
for (const char *next = NULL; next != path + src_size;) {
|
for (const char *next = NULL; next != path + src_size;) {
|
||||||
next = strchr(src, '/');
|
next = memchr(src, '/', len);
|
||||||
if (!next)
|
if (!next)
|
||||||
next = path + src_size;
|
next = path + src_size;
|
||||||
|
|
||||||
|
@ -1076,6 +1077,7 @@ static char *abspath(const char *path, const char *cwd)
|
||||||
}
|
}
|
||||||
|
|
||||||
src = next + 1;
|
src = next + 1;
|
||||||
|
len = src_size - (src - path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*resolved_path == '\0') {
|
if (*resolved_path == '\0') {
|
||||||
|
|
Loading…
Reference in a new issue