* [PATCH] libvchan: address compiler warnings
@ 2015-02-04 16:07 Jan Beulich
2015-02-04 16:26 ` Wei Liu
0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2015-02-04 16:07 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Campbell, Ian Jackson, Wei Liu, Stefano Stabellini
[-- Attachment #1: Type: text/plain, Size: 1250 bytes --]
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.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/tools/libvchan/node-select.c
+++ b/tools/libvchan/node-select.c
@@ -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) {
[-- Attachment #2: libvchan-warnings.patch --]
[-- Type: text/plain, Size: 1283 bytes --]
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.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/tools/libvchan/node-select.c
+++ b/tools/libvchan/node-select.c
@@ -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) {
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libvchan: address compiler warnings
2015-02-04 16:07 [PATCH] libvchan: address compiler warnings Jan Beulich
@ 2015-02-04 16:26 ` Wei Liu
2015-02-05 12:47 ` Ian Campbell
0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2015-02-04 16:26 UTC (permalink / raw)
To: Jan Beulich
Cc: Ian Campbell, xen-devel, Wei Liu, Ian Jackson, Stefano Stabellini
On Wed, Feb 04, 2015 at 04:07:48PM +0000, Jan Beulich wrote:
> 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.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
Acked-by: Wei Liu <wei.liu2@citrix.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libvchan: address compiler warnings
2015-02-04 16:26 ` Wei Liu
@ 2015-02-05 12:47 ` Ian Campbell
0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2015-02-05 12:47 UTC (permalink / raw)
To: Wei Liu; +Cc: xen-devel, Ian Jackson, Jan Beulich, Stefano Stabellini
On Wed, 2015-02-04 at 16:26 +0000, Wei Liu wrote:
> On Wed, Feb 04, 2015 at 04:07:48PM +0000, Jan Beulich wrote:
> > 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.
> >
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >
>
> Acked-by: Wei Liu <wei.liu2@citrix.com>
Me too, plus applied. Thanks.
Ian.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-05 12:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-04 16:07 [PATCH] libvchan: address compiler warnings Jan Beulich
2015-02-04 16:26 ` Wei Liu
2015-02-05 12:47 ` Ian Campbell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.