[ltt-dev] [LTTV PATCH] Fix warnings int the lttv/sync directory
Yannick Brosseau
yannick.brosseau at gmail.com
Mon Jan 24 13:05:20 EST 2011
Mostly wrong usages of g_error
Signed-off-by: Yannick Brosseau <yannick.brosseau at gmail.com>
---
lttv/lttv/sync/event_analysis_chull.c | 6 +++---
lttv/lttv/sync/event_analysis_eval.c | 22 +++++++++++-----------
lttv/lttv/sync/event_matching_broadcast.c | 6 +++---
lttv/lttv/sync/event_matching_tcp.c | 6 +++---
lttv/lttv/sync/graph_functions.c | 16 ++++++++--------
lttv/lttv/sync/sync_chain_lttv.c | 2 +-
6 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/lttv/lttv/sync/event_analysis_chull.c b/lttv/lttv/sync/event_analysis_chull.c
index 21f2889..d36022c 100644
--- a/lttv/lttv/sync/event_analysis_chull.c
+++ b/lttv/lttv/sync/event_analysis_chull.c
@@ -240,7 +240,7 @@ static void openGraphFiles(SyncState* const syncState)
if ((analysisData->graphsData->hullPoints[i][j]= fopen(name, "w")) ==
NULL)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
}
@@ -249,7 +249,7 @@ static void openGraphFiles(SyncState* const syncState)
retval= chdir(cwd);
if (retval == -1)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
free(cwd);
}
@@ -329,7 +329,7 @@ static void closeGraphFiles(SyncState* const syncState)
retval= fclose(analysisData->graphsData->hullPoints[i][j]);
if (retval != 0)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
}
diff --git a/lttv/lttv/sync/event_analysis_eval.c b/lttv/lttv/sync/event_analysis_eval.c
index 8632b6a..6ea6b7b 100644
--- a/lttv/lttv/sync/event_analysis_eval.c
+++ b/lttv/lttv/sync/event_analysis_eval.c
@@ -161,7 +161,7 @@ static void initAnalysisEval(SyncState* const syncState)
rttStream= fopen(optionEvalRttFile.arg, "r");
if (rttStream == NULL)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
readRttInfo(analysisData->rttInfo, rttStream);
@@ -169,7 +169,7 @@ static void initAnalysisEval(SyncState* const syncState)
retval= fclose(rttStream);
if (retval == EOF)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
@@ -274,14 +274,14 @@ static AnalysisHistogramEval* constructAnalysisHistogramEval(const char* const
if ((*(FILE**)((void*) histogram + loopValues[i].pointsOffset)=
fopen(name, "w")) == NULL)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
retval= chdir(cwd);
if (retval == -1)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
free(cwd);
@@ -314,7 +314,7 @@ static void destroyAnalysisHistogramEval(AnalysisHistogramEval* const
retval= fclose(*(FILE**)((void*) histogram + loopValues[i].pointsOffset));
if (retval != 0)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
@@ -463,11 +463,11 @@ static void writeHistogram(FILE* graphsStream, const struct RttKey* rttKey,
// Remove the ",\\\n" from the last graph plot line
if (ftruncate(fileno(graphsStream), ftell(graphsStream) - 3) == -1)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
if (fseek(graphsStream, 0, SEEK_END) == -1)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
fprintf(graphsStream, "\n");
}
@@ -550,7 +550,7 @@ static void analyzeMessageEval(SyncState* const syncState, Message* const
message)
{
AnalysisDataEval* analysisData= syncState->analysisData;
- MessageStats* messageStats;
+ MessageStats* messageStats = NULL;
double* rtt;
double tt;
struct RttKey rttKey;
@@ -1111,7 +1111,7 @@ static void readRttInfo(GHashTable* rttInfo, FILE* rttStream)
if (retval == -1 && !feof(rttStream))
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
if (line[retval - 1] == '\n')
@@ -1124,7 +1124,7 @@ static void readRttInfo(GHashTable* rttInfo, FILE* rttStream)
&tmp);
if (retval == EOF)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
else if (retval != 3)
{
@@ -1187,7 +1187,7 @@ static void positionStream(FILE* stream)
}
else
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
}
diff --git a/lttv/lttv/sync/event_matching_broadcast.c b/lttv/lttv/sync/event_matching_broadcast.c
index 9c83d9c..4c66d18 100644
--- a/lttv/lttv/sync/event_matching_broadcast.c
+++ b/lttv/lttv/sync/event_matching_broadcast.c
@@ -382,7 +382,7 @@ static void openGraphDataFiles(SyncState* const syncState)
g_assert_cmpint(retval, <=, sizeof(name) - 1);
if ((graphs->accuracyPoints[i][j]= fopen(name, "w")) == NULL)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
}
@@ -390,7 +390,7 @@ static void openGraphDataFiles(SyncState* const syncState)
retval= chdir(cwd);
if (retval == -1)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
free(cwd);
}
@@ -460,7 +460,7 @@ static void closeGraphDataFiles(SyncState* const syncState)
retval= fclose(graphs->accuracyPoints[i][j]);
if (retval != 0)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
free(graphs->accuracyPoints[i]);
diff --git a/lttv/lttv/sync/event_matching_tcp.c b/lttv/lttv/sync/event_matching_tcp.c
index 90d6c43..2d4fe51 100644
--- a/lttv/lttv/sync/event_matching_tcp.c
+++ b/lttv/lttv/sync/event_matching_tcp.c
@@ -604,7 +604,7 @@ static void openGraphDataFiles(SyncState* const syncState)
if ((matchingData->messagePoints[i][j]= fopen(name, "w")) ==
NULL)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
}
@@ -613,7 +613,7 @@ static void openGraphDataFiles(SyncState* const syncState)
retval= chdir(cwd);
if (retval == -1)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
free(cwd);
}
@@ -676,7 +676,7 @@ static void closeGraphDataFiles(SyncState* const syncState)
retval= fclose(matchingData->messagePoints[i][j]);
if (retval != 0)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
}
diff --git a/lttv/lttv/sync/graph_functions.c b/lttv/lttv/sync/graph_functions.c
index c347b24..91feef0 100644
--- a/lttv/lttv/sync/graph_functions.c
+++ b/lttv/lttv/sync/graph_functions.c
@@ -55,11 +55,11 @@ FILE* createGraphsDir(const char* const graphsDir)
S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH
| S_IWOTH | S_IXOTH)) == -1)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
if ((result= fdopen(graphsFp, "w")) == NULL)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
fprintf(result,
@@ -69,7 +69,7 @@ FILE* createGraphsDir(const char* const graphsDir)
retval= chdir(cwd);
if (retval == -1)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
free(cwd);
@@ -95,7 +95,7 @@ char* changeToGraphsDir(const char* const graphsDir)
cwd= getcwd(NULL, 0);
if (cwd == NULL)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
while ((retval= chdir(graphsDir)) != 0)
{
@@ -105,12 +105,12 @@ char* changeToGraphsDir(const char* const graphsDir)
S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH);
if (retval != 0)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
else
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
@@ -233,11 +233,11 @@ void writeGraphsScript(SyncState* const syncState)
if (ftruncate(fileno(syncState->graphsStream), trunc) == -1)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
if (fseek(syncState->graphsStream, 0, SEEK_END) == -1)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
fprintf(syncState->graphsStream,
diff --git a/lttv/lttv/sync/sync_chain_lttv.c b/lttv/lttv/sync/sync_chain_lttv.c
index 95bef44..bb49bbd 100644
--- a/lttv/lttv/sync/sync_chain_lttv.c
+++ b/lttv/lttv/sync/sync_chain_lttv.c
@@ -388,7 +388,7 @@ bool syncTraceset(LttvTracesetContext* const traceSetContext)
if (fclose(syncState->graphsStream) != 0)
{
- g_error(strerror(errno));
+ g_error("%s", strerror(errno));
}
}
--
1.7.2.3
More information about the lttng-dev
mailing list