[cfe-commits] r86568 - /cfe/trunk/tools/CIndex/CIndex.cpp

Benjamin Kramer benny.kra at googlemail.com
Mon Nov 9 10:24:53 PST 2009


Author: d0k
Date: Mon Nov  9 12:24:53 2009
New Revision: 86568

URL: http://llvm.org/viewvc/llvm-project?rev=86568&view=rev
Log:
Writing to a struct passed by value is pointless. Remove dead code.

- free(NULL) is a nop anyway.
- if someone thinks calling clang_disposeString twice should be legal
  please change the method to take a pointer.

Modified:
    cfe/trunk/tools/CIndex/CIndex.cpp

Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=86568&r1=86567&r2=86568&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Mon Nov  9 12:24:53 2009
@@ -958,13 +958,8 @@
  
 // Free CXString.
 void clang_disposeString(CXString string) {
-  if (string.MustFreeString) {
-    if (string.Spelling) {
-      free((void *)string.Spelling);
-      string.Spelling = NULL;
-    }
-    string.MustFreeString = 0;
-  }
+  if (string.MustFreeString)
+    free((void*)string.Spelling);
 }
 
 unsigned clang_getCursorColumn(CXCursor C)





More information about the cfe-commits mailing list