[haiku-commits] r34282 - haiku/trunk/src/system/kernel/fs

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 26 Nov 2009 15:28:55 +0100 (CET)

Author: axeld
Date: 2009-11-26 15:28:55 +0100 (Thu, 26 Nov 2009)
New Revision: 34282
Changeset: http://dev.haiku-os.org/changeset/34282/haiku

Modified:
   haiku/trunk/src/system/kernel/fs/vfs.cpp
Log:
* Eliminated the extra buffer in dir_vnode_to_path(); we write directly to the
  specified buffer now.


Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp
===================================================================
--- haiku/trunk/src/system/kernel/fs/vfs.cpp    2009-11-26 14:22:35 UTC (rev 
34281)
+++ haiku/trunk/src/system/kernel/fs/vfs.cpp    2009-11-26 14:28:55 UTC (rev 
34282)
@@ -2634,12 +2634,8 @@
        if (!S_ISDIR(vnode->type))
                return B_NOT_A_DIRECTORY;
 
-       KPath pathBuffer(bufferSize);
-       if (pathBuffer.InitCheck() != B_OK)
-               return B_NO_MEMORY;
-
-       char* path = pathBuffer.LockBuffer();
-       int32 insert = pathBuffer.BufferSize();
+       char* path = buffer;
+       int32 insert = bufferSize;
        int32 maxLevel = 256;
        int32 length;
        status_t status;
@@ -2738,12 +2734,9 @@
 
        TRACE(("  path is: %s\n", path + insert));
 
-       // copy the path to the output buffer
-       length = pathBuffer.BufferSize() - insert;
-       if (length <= (int)bufferSize)
-               memcpy(buffer, path + insert, length);
-       else
-               status = B_RESULT_NOT_REPRESENTABLE;
+       // move the path to the start of the buffer
+       length = bufferSize - insert;
+       memmove(buffer, path + insert, length);
 
 out:
        put_vnode(vnode);


Other related posts:

  • » [haiku-commits] r34282 - haiku/trunk/src/system/kernel/fs - axeld