[llvm-commits] CVS: llvm/lib/Bytecode/Archive/Archive.cpp ArchiveWriter.cpp

Reid Spencer reid at x10sys.com
Thu Mar 29 12:06:34 PDT 2007



Changes in directory llvm/lib/Bytecode/Archive:

Archive.cpp updated: 1.18 -> 1.19
ArchiveWriter.cpp updated: 1.35 -> 1.36
---
Log message:

For PR789: http://llvm.org/PR789 :
Make the sys::Path::getFileStatus function more efficient by having it
return a pointer to the FileStatus structure rather than copy it. Adjust
uses of the function accordingly. Also, fix some memory issues in sys::Path.


---
Diffs of the changes:  (+8 -2)

 Archive.cpp       |    5 ++++-
 ArchiveWriter.cpp |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)


Index: llvm/lib/Bytecode/Archive/Archive.cpp
diff -u llvm/lib/Bytecode/Archive/Archive.cpp:1.18 llvm/lib/Bytecode/Archive/Archive.cpp:1.19
--- llvm/lib/Bytecode/Archive/Archive.cpp:1.18	Thu Mar 29 11:48:16 2007
+++ llvm/lib/Bytecode/Archive/Archive.cpp	Thu Mar 29 14:05:44 2007
@@ -116,7 +116,10 @@
     path.getMagicNumber(magic,4);
     signature = magic.c_str();
     std::string err;
-    if (path.getFileStatus(info, false, ErrMsg))
+    const sys::FileStatus *FSinfo = path.getFileStatus(false, ErrMsg);
+    if (FSinfo)
+      info = *FSinfo;
+    else
       return true;
   }
 


Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp
diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.35 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.36
--- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.35	Thu Mar 29 11:48:16 2007
+++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp	Thu Mar 29 14:05:44 2007
@@ -163,7 +163,10 @@
 
   mbr->data = 0;
   mbr->path = filePath;
-  if (mbr->path.getFileStatus(mbr->info, false, ErrMsg))
+  const sys::FileStatus *FSInfo = mbr->path.getFileStatus(false, ErrMsg);
+  if (FSInfo)
+    mbr->info = *FSInfo;
+  else
     return true;
 
   unsigned flags = 0;






More information about the llvm-commits mailing list