mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
domtop: Turn parse_argv into void
Currently, the function follows the usual pattern used in our code: int ret = -1; ... ret = 0; cleanup: return ret; However, the function always call exit() on error, so the cleanup label is never jumped onto. Therefore, it doesn't make any sense to have the parse_argv function return an integer value, if it effectively can return only value of zero. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
@@ -94,13 +94,12 @@ print_usage(const char *progname)
|
|||||||
unified_progname);
|
unified_progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
parse_argv(int argc, char *argv[],
|
parse_argv(int argc, char *argv[],
|
||||||
const char **uri,
|
const char **uri,
|
||||||
const char **dom_name,
|
const char **dom_name,
|
||||||
unsigned int *milliseconds)
|
unsigned int *milliseconds)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
int arg;
|
int arg;
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
char *p;
|
char *p;
|
||||||
@@ -155,10 +154,6 @@ parse_argv(int argc, char *argv[],
|
|||||||
|
|
||||||
if (argc > optind)
|
if (argc > optind)
|
||||||
*dom_name = argv[optind];
|
*dom_name = argv[optind];
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -368,8 +363,7 @@ main(int argc, char *argv[])
|
|||||||
unsigned int milliseconds = 500; /* Sleep this long between two API calls */
|
unsigned int milliseconds = 500; /* Sleep this long between two API calls */
|
||||||
const int connect_flags = 0; /* No connect flags for now */
|
const int connect_flags = 0; /* No connect flags for now */
|
||||||
|
|
||||||
if (parse_argv(argc, argv, &uri, &dom_name, &milliseconds) < 0)
|
parse_argv(argc, argv, &uri, &dom_name, &milliseconds);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
DEBUG("Proceeding with uri=%s dom_name=%s milliseconds=%u",
|
DEBUG("Proceeding with uri=%s dom_name=%s milliseconds=%u",
|
||||||
uri, dom_name, milliseconds);
|
uri, dom_name, milliseconds);
|
||||||
|
|||||||
Reference in New Issue
Block a user