aboutsummaryrefslogtreecommitdiff
path: root/tools/regression
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2017-04-22 20:27:46 +0000
committerEnji Cooper <ngie@FreeBSD.org>2017-04-22 20:27:46 +0000
commite1915a59014fcc4fcfbce75ea256296c58bff7bb (patch)
tree948d682c966c7c19ef318d1494e812cea7dd5def /tools/regression
parentb58910a05f4669b5e83607ae8079aad72aecacba (diff)
downloadsrc-e1915a59014fcc4fcfbce75ea256296c58bff7bb.tar.gz
src-e1915a59014fcc4fcfbce75ea256296c58bff7bb.zip
gctl_test_helper: apply polish
- Staticize variables to fix warnings. - Sprinkle asserts around for calls that can fail - Apply style(9) for main(..) definition. - ANSIify usage(..) definition. MFC after: 5 weeks Sponsored by: Dell EMC Isilon
Notes
Notes: svn path=/head/; revision=317293
Diffstat (limited to 'tools/regression')
-rw-r--r--tools/regression/geom_gpt/gctl_test_helper.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/regression/geom_gpt/gctl_test_helper.c b/tools/regression/geom_gpt/gctl_test_helper.c
index 8c160fa1f050..c6a8d334f270 100644
--- a/tools/regression/geom_gpt/gctl_test_helper.c
+++ b/tools/regression/geom_gpt/gctl_test_helper.c
@@ -28,6 +28,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
@@ -42,11 +43,11 @@ struct retval {
char *value;
};
-struct retval *retval;
-int verbose;
+static struct retval *retval;
+static int verbose;
static void
-usage()
+usage(void)
{
fprintf(stdout, "usage: %s [-v] param[:len][=value] ...\n",
getprogname());
@@ -105,7 +106,8 @@ parse(char *arg, char **param, char **value, int *len)
return (0);
}
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
struct retval *rv;
struct gctl_req *req;
@@ -114,6 +116,7 @@ int main(int argc, char *argv[])
int c, len;
req = gctl_get_handle();
+ assert(req != NULL);
gctl_ro_param(req, "class", -1, "GPT");
while ((c = getopt(argc, argv, "v")) != -1) {
@@ -133,6 +136,7 @@ int main(int argc, char *argv[])
if (!parse(argv[optind++], &param, &value, &len)) {
if (len > 0) {
rv = malloc(sizeof(struct retval));
+ assert(rv != NULL);
rv->param = param;
rv->value = value;
rv->retval = retval;