Obviously my gcc do not warn me about some uninitialized or unused variables.
But fortunately we have freebsd build in the CI.
Both patches pushed under trivial rule.
Michal Privoznik (2):
qemuGetDomainHugepagePath: Initialize @ret
vsh: Mark some function arguments as unused
src/qemu/qemu_conf.c | 2 +-
tools/vsh.c | 10 +++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
--
2.11.0
Show replies by date
The variable may be used uninitialized in this function.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index ad85551e9..23a5504e1 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1473,7 +1473,7 @@ qemuGetDomainHugepagePath(const virDomainDef *def,
{
char *base = qemuGetBaseHugepagePath(hugepage);
char *domPath = virDomainObjGetShortName(def);
- char *ret;
+ char *ret = NULL;
if (base && domPath)
ignore_value(virAsprintf(&ret, "%s/%s", base, domPath));
--
2.11.0
Some arguments in vshErrorHandler, vshReadlineCompletion and
cmdSelfTest functions are not used. Mark them as such.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/vsh.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/vsh.c b/tools/vsh.c
index c1fc041cf..d2024be91 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -242,7 +242,8 @@ virErrorPtr last_error;
* Quieten libvirt until we're done with the command.
*/
void
-vshErrorHandler(void *opaque ATTRIBUTE_UNUSED, virErrorPtr error)
+vshErrorHandler(void *opaque ATTRIBUTE_UNUSED,
+ virErrorPtr error ATTRIBUTE_UNUSED)
{
virFreeError(last_error);
last_error = virSaveLastError();
@@ -2856,7 +2857,9 @@ vshReadlineParse(const char *text, int state)
}
static char **
-vshReadlineCompletion(const char *text, int start, int end ATTRIBUTE_UNUSED)
+vshReadlineCompletion(const char *text,
+ int start ATTRIBUTE_UNUSED,
+ int end ATTRIBUTE_UNUSED)
{
char **matches = (char **) NULL;
@@ -3359,7 +3362,8 @@ const vshCmdInfo info_selftest[] = {
* That runs vshCmddefOptParse which validates
* the per-command options structure. */
bool
-cmdSelfTest(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
+cmdSelfTest(vshControl *ctl ATTRIBUTE_UNUSED,
+ const vshCmd *cmd ATTRIBUTE_UNUSED)
{
const vshCmdGrp *grp;
const vshCmdDef *def;
--
2.11.0