From eafe336a8e5580bbd76546970351956810f01d8f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 7 Feb 2010 23:08:53 +0100 Subject: *: remove all usages of C++ streams (-10k in code size) Also add copyright banners to all files which were missing them Signed-off-by: Denys Vlasenko --- lib/Plugins/CCpp.cpp | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) (limited to 'lib/Plugins/CCpp.cpp') diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index 50423b7..7b3eab1 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -17,10 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include -#include +*/ #include #include //#include @@ -702,21 +699,21 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir) { perror_msg("abrt-backtrace not executed properly, " "status: %x signal: %d", status, WIFSIGNALED(status)); - } + } else { int exit_status = WEXITSTATUS(status); if (exit_status == 79) /* EX_PARSINGFAILED */ { - /* abrt-backtrace returns alternative backtrace - representation in this case, so everything will work + /* abrt-backtrace returns alternative backtrace + representation in this case, so everything will work as expected except worse duplication detection */ log_msg("abrt-backtrace failed to parse the backtrace"); } else if (exit_status == 80) /* EX_THREADDETECTIONFAILED */ { - /* abrt-backtrace returns backtrace with all threads - in this case, so everything will work as expected + /* abrt-backtrace returns backtrace with all threads + in this case, so everything will work as expected except worse duplication detection */ log_msg("abrt-backtrace failed to determine crash frame"); } @@ -890,12 +887,13 @@ static int set_limits() void CAnalyzerCCpp::Init() { - ifstream fInCorePattern; - fInCorePattern.open(CORE_PATTERN_IFACE); - if (fInCorePattern.is_open()) + FILE *fp = fopen(CORE_PATTERN_IFACE, "r"); + if (fp) { - getline(fInCorePattern, m_sOldCorePattern); - fInCorePattern.close(); + char line[PATH_MAX]; + if (fgets(line, sizeof(line), fp)) + m_sOldCorePattern = line; + fclose(fp); } if (m_sOldCorePattern[0] == '|') { @@ -915,28 +913,26 @@ void CAnalyzerCCpp::Init() } } #ifdef HOSTILE_KERNEL - if(set_limits() != 0) + if (set_limits() != 0) log("warning: failed to set core_size limit, ABRT won't detect crashes in" "compiled apps"); #endif - ofstream fOutCorePattern; - fOutCorePattern.open(CORE_PATTERN_IFACE); - if (fOutCorePattern.is_open()) + fp = fopen(CORE_PATTERN_IFACE, "w"); + if (fp) { - fOutCorePattern << CORE_PATTERN << endl; - fOutCorePattern.close(); + fputs(CORE_PATTERN, fp); + fclose(fp); } } void CAnalyzerCCpp::DeInit() { - ofstream fOutCorePattern; - fOutCorePattern.open(CORE_PATTERN_IFACE); - if (fOutCorePattern.is_open()) + FILE *fp = fopen(CORE_PATTERN_IFACE, "w"); + if (fp) { - fOutCorePattern << m_sOldCorePattern << endl; - fOutCorePattern.close(); + fputs(m_sOldCorePattern.c_str(), fp); + fclose(fp); } } -- cgit