]> granicus.if.org Git - clang/commitdiff
Writing to a struct passed by value is pointless. Remove dead code.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 9 Nov 2009 18:24:53 +0000 (18:24 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 9 Nov 2009 18:24:53 +0000 (18:24 +0000)
- free(NULL) is a nop anyway.
- if someone thinks calling clang_disposeString twice should be legal
  please change the method to take a pointer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86568 91177308-0d34-0410-b5e6-96231b3b80d8

tools/CIndex/CIndex.cpp

index 8fba3cf6b5cd0f74428900c4617c284e26a443f0..ac297e64a1361914cac3aa0da5507c9b3ee4a529 100644 (file)
@@ -958,13 +958,8 @@ const char *clang_getCString(CXString string) {
  
 // 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)