From: Benjamin Kramer Date: Mon, 9 Nov 2009 18:24:53 +0000 (+0000) Subject: Writing to a struct passed by value is pointless. Remove dead code. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=858e5de143d36815b9cd4dcaf01614e1a8e502f2;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86568 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp index 8fba3cf6b5..ac297e64a1 100644 --- a/tools/CIndex/CIndex.cpp +++ b/tools/CIndex/CIndex.cpp @@ -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)