Skip to contentSkip to conversation

libvchan: address compiler warnings

PATCH In review Jan Beulich 3 participants 3 messages Feb 4, 2015 – Feb 5, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libvchan: address compiler warnings

Both vchan_wr() and stdout_wr() should be defined with a non-empty argument list (i.e. void). Additionally both of them as well as usage() should be static to make clear that no other code is referencing them.

Further, statements should follow declarations.

tools/libvchan/node-select.c +9 -5
@@ -39,7 +39,7 @@
 
 #include <libxenvchan.h>
 
-void usage(char** argv)
+static void usage(char** argv)
 {
 	fprintf(stderr, "usage:\n"
 		"\t%s [client|server] domainid nodepath [rbufsiz wbufsiz]\n",
@@ -54,10 +54,12 @@ int insiz = 0;
 int outsiz = 0;
 struct libxenvchan *ctrl = 0;
 
-void vchan_wr() {
+static void vchan_wr(void) {
+	int ret;
+
 	if (!insiz)
 		return;
-	int ret = libxenvchan_write(ctrl, inbuf, insiz);
+	ret = libxenvchan_write(ctrl, inbuf, insiz);
 	if (ret < 0) {
 		fprintf(stderr, "vchan write failed\n");
 		exit(1);
@@ -68,10 +70,12 @@ void vchan_wr() {
 	}
 }
 
-void stdout_wr() {
+static void stdout_wr(void) {
+	int ret;
+
 	if (!outsiz)
 		return;
-	int ret = write(1, outbuf, outsiz);
+	ret = write(1, outbuf, outsiz);
 	if (ret < 0 && errno != EAGAIN)
 		exit(1);
 	if (ret > 0) {

libvchan: address compiler warnings

Both vchan_wr() and stdout_wr() should be defined with a non-empty argument list (i.e. void). Additionally both of them as well as usage() should be static to make clear that no other code is referencing them.

Further, statements should follow declarations.

tools/libvchan/node-select.c +9 -5
@@ -39,7 +39,7 @@
 
 #include <libxenvchan.h>
 
-void usage(char** argv)
+static void usage(char** argv)
 {
 	fprintf(stderr, "usage:\n"
 		"\t%s [client|server] domainid nodepath [rbufsiz wbufsiz]\n",
@@ -54,10 +54,12 @@ int insiz = 0;
 int outsiz = 0;
 struct libxenvchan *ctrl = 0;
 
-void vchan_wr() {
+static void vchan_wr(void) {
+	int ret;
+
 	if (!insiz)
 		return;
-	int ret = libxenvchan_write(ctrl, inbuf, insiz);
+	ret = libxenvchan_write(ctrl, inbuf, insiz);
 	if (ret < 0) {
 		fprintf(stderr, "vchan write failed\n");
 		exit(1);
@@ -68,10 +70,12 @@ void vchan_wr() {
 	}
 }
 
-void stdout_wr() {
+static void stdout_wr(void) {
+	int ret;
+
 	if (!outsiz)
 		return;
-	int ret = write(1, outbuf, outsiz);
+	ret = write(1, outbuf, outsiz);
 	if (ret < 0 && errno != EAGAIN)
 		exit(1);
 	if (ret > 0) {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jan Beulich

Both vchan_wr() and stdout_wr() should be defined with a non-empty argument list (i.e. void). Additionally both of them as well as usage() should be static to make clear that no other code is referencing them.

Further, statements should follow declarations.

#2 lore raw
Quoted 11 lines · Wei Liu
Quoted 8 lines · Jan Beulich

Both vchan_wr() and stdout_wr() should be defined with a non-empty argument list (i.e. void). Additionally both of them as well as usage() should be static to make clear that no other code is referencing them.

Further, statements should follow declarations.

Me too, plus applied. Thanks.

Ian.