Archived
1
0
Fork 0

path.c: dirname_s: allow 'path' to point to the static buffer.

feeding the function a pointer to sb.buf results in path also being cleared
by the call to strbuf_reduce and the information is lost.
This commit is contained in:
Henrik Hautakoski 2011-02-16 16:53:26 +02:00
parent 3c2436867e
commit a1a85267f0
2 changed files with 9 additions and 3 deletions

View file

@ -96,6 +96,7 @@ void test_basename() {
void test_dirname() {
int i;
const char *path = "/one/two/three/four/";
char data[13][2][64] = {
{ "", "." },
@ -115,6 +116,9 @@ void test_dirname() {
for(i=0; i < 12; i++)
assert_string(dirname_s(data[i][0], 0), data[i][1]);
path = dirname_s(path, 1);
assert_string(dirname_s(path, 1), "/one/two/");
}
void test_path_isparent() {