* Eliminated the extra buffer in dir_vnode_to_path(); we write directly to the

specified buffer now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34282 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-11-26 14:28:55 +00:00
parent 648aeae3bc
commit 7ce581d7eb

View File

@ -2634,12 +2634,8 @@ dir_vnode_to_path(struct vnode* vnode, char* buffer, size_t bufferSize,
if (!S_ISDIR(vnode->type)) if (!S_ISDIR(vnode->type))
return B_NOT_A_DIRECTORY; return B_NOT_A_DIRECTORY;
KPath pathBuffer(bufferSize); char* path = buffer;
if (pathBuffer.InitCheck() != B_OK) int32 insert = bufferSize;
return B_NO_MEMORY;
char* path = pathBuffer.LockBuffer();
int32 insert = pathBuffer.BufferSize();
int32 maxLevel = 256; int32 maxLevel = 256;
int32 length; int32 length;
status_t status; status_t status;
@ -2738,12 +2734,9 @@ dir_vnode_to_path(struct vnode* vnode, char* buffer, size_t bufferSize,
TRACE((" path is: %s\n", path + insert)); TRACE((" path is: %s\n", path + insert));
// copy the path to the output buffer // move the path to the start of the buffer
length = pathBuffer.BufferSize() - insert; length = bufferSize - insert;
if (length <= (int)bufferSize) memmove(buffer, path + insert, length);
memcpy(buffer, path + insert, length);
else
status = B_RESULT_NOT_REPRESENTABLE;
out: out:
put_vnode(vnode); put_vnode(vnode);