From 248315ada26ff8e308bb99d5e46f25534e148620 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 23 Jul 2009 17:13:49 +0200 Subject: style fix by popular (Zdenek's) demand Zdenek said: Ahother thing: commit "CCpp.cpp: fix handling of pipes when we fork children". You added piece code with while(1) and then there is a break inside the loop. Personally, I don't like infinite loops :-). There can be something like: ... int r; while ((r = read(pipeout[0], buff, sizeof(buff) - 1) > 0) { Signed-off-by: Denys Vlasenko --- lib/Plugins/CCpp.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index b96540a4..176a77a4 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -132,9 +132,10 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage) bool already_installed = false; - while (1) + int r; + while (r = read(pipeout[0], buff, sizeof(buff) - 1) > 0) { -/* Does not seem to be needed +/* Was before read, does not seem to be needed fd_set rsfd; FD_ZERO(&rsfd); @@ -148,10 +149,6 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage) if (!FD_ISSET(pipeout[0], &rsfd)) continue; */ - int r = read(pipeout[0], buff, sizeof(buff) - 1); - if (r <= 0) - break; - buff[r] = '\0'; comm_layer_inner_debug(buff); if (strstr(buff, packageName.c_str()) != NULL && -- cgit