summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-07-27 22:21:58 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-07-27 22:42:24 +0200
commit196d590a99e309764e07c9dc23ea98897eebf53a (patch)
treed195e1c0d400200f720d5fbfe11c871720883224 /apt-pkg/contrib
parent4a97f759cd98f3b2518726b348d1b981e8a8e1d6 (diff)
(error) va_list 'args' was opened but not closed by va_end()
Reported-By: cppcheck Gbp-Dch: Ignore
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/error.cc34
-rw-r--r--apt-pkg/contrib/fileutl.cc18
2 files changed, 24 insertions, 28 deletions
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index 8a87e16e9..c06ea8364 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -68,13 +68,12 @@ bool GlobalError::NAME (const char *Function, const char *Description,...) { \
va_list args; \
size_t msgSize = 400; \
int const errsv = errno; \
- while (true) { \
+ bool retry; \
+ do { \
va_start(args,Description); \
- bool const retry = InsertErrno(TYPE, Function, Description, args, errsv, msgSize); \
+ retry = InsertErrno(TYPE, Function, Description, args, errsv, msgSize); \
va_end(args); \
- if (retry == false) \
- break; \
- } \
+ } while (retry); \
return false; \
}
GEMessage(FatalE, FATAL)
@@ -90,13 +89,12 @@ bool GlobalError::InsertErrno(MsgType const &type, const char *Function,
va_list args;
size_t msgSize = 400;
int const errsv = errno;
- while (true) {
+ bool retry;
+ do {
va_start(args,Description);
- bool const retry = InsertErrno(type, Function, Description, args, errsv, msgSize);
+ retry = InsertErrno(type, Function, Description, args, errsv, msgSize);
va_end(args);
- if (retry == false)
- break;
- }
+ } while (retry);
return false;
}
/*}}}*/
@@ -127,12 +125,12 @@ bool GlobalError::InsertErrno(MsgType type, const char* Function,
bool GlobalError::NAME (const char *Description,...) { \
va_list args; \
size_t msgSize = 400; \
- while (true) { \
+ bool retry; \
+ do { \
va_start(args,Description); \
- if (Insert(TYPE, Description, args, msgSize) == false) \
- break; \
+ retry = Insert(TYPE, Description, args, msgSize); \
va_end(args); \
- } \
+ } while (retry); \
return false; \
}
GEMessage(Fatal, FATAL)
@@ -147,12 +145,12 @@ bool GlobalError::Insert(MsgType const &type, const char *Description,...)
{
va_list args;
size_t msgSize = 400;
- while (true) {
+ bool retry;
+ do {
va_start(args,Description);
- if (Insert(type, Description, args, msgSize) == false)
- break;
+ retry = Insert(type, Description, args, msgSize);
va_end(args);
- }
+ } while (retry);
return false;
}
/*}}}*/
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index fc578cd23..8fd0ac617 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -2682,13 +2682,12 @@ bool FileFd::FileFdErrno(const char *Function, const char *Description,...)
va_list args;
size_t msgSize = 400;
int const errsv = errno;
- while (true)
- {
+ bool retry;
+ do {
va_start(args,Description);
- if (_error->InsertErrno(GlobalError::ERROR, Function, Description, args, errsv, msgSize) == false)
- break;
+ retry = _error->InsertErrno(GlobalError::ERROR, Function, Description, args, errsv, msgSize);
va_end(args);
- }
+ } while (retry);
return false;
}
/*}}}*/
@@ -2697,13 +2696,12 @@ bool FileFd::FileFdError(const char *Description,...) {
Flags |= Fail;
va_list args;
size_t msgSize = 400;
- while (true)
- {
+ bool retry;
+ do {
va_start(args,Description);
- if (_error->Insert(GlobalError::ERROR, Description, args, msgSize) == false)
- break;
+ retry = _error->Insert(GlobalError::ERROR, Description, args, msgSize);
va_end(args);
- }
+ } while (retry);
return false;
}
/*}}}*/