From: "Jan Beulich" Subject: [PATCH] libvchan: address compiler warnings Date: Wed, 04 Feb 2015 16:07:48 +0000 Message-ID: <54D251E4020000780005CF0E@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part695CE2C4.2__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ2UX-0001YB-Hi for xen-devel@lists.xenproject.org; Wed, 04 Feb 2015 16:07:49 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Ian Campbell , Ian Jackson , Wei Liu , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part695CE2C4.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 --- a/tools/libvchan/node-select.c +++ b/tools/libvchan/node-select.c @@ -39,7 +39,7 @@ =20 #include =20 -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 =3D 0; int outsiz =3D 0; struct libxenvchan *ctrl =3D 0; =20 -void vchan_wr() { +static void vchan_wr(void) { + int ret; + if (!insiz) return; - int ret =3D libxenvchan_write(ctrl, inbuf, insiz); + ret =3D libxenvchan_write(ctrl, inbuf, insiz); if (ret < 0) { fprintf(stderr, "vchan write failed\n"); exit(1); @@ -68,10 +70,12 @@ void vchan_wr() { } } =20 -void stdout_wr() { +static void stdout_wr(void) { + int ret; + if (!outsiz) return; - int ret =3D write(1, outbuf, outsiz); + ret =3D write(1, outbuf, outsiz); if (ret < 0 && errno !=3D EAGAIN) exit(1); if (ret > 0) { --=__Part695CE2C4.2__= Content-Type: text/plain; name="libvchan-warnings.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="libvchan-warnings.patch" libvchan: address compiler warnings=0A=0ABoth vchan_wr() and stdout_wr() = should be defined with a non-empty=0Aargument list (i.e. void). Additionall= y both of them as well as usage()=0Ashould be static to make clear that no = other code is referencing them.=0A=0AFurther, statements should follow = declarations.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/tools/libvchan/node-select.c=0A+++ b/tools/libvchan/node-select.c=0A@@ = -39,7 +39,7 @@=0A =0A #include =0A =0A-void usage(char** = argv)=0A+static void usage(char** argv)=0A {=0A fprintf(stderr, = "usage:\n"=0A "\t%s [client|server] domainid nodepath [rbufsiz = wbufsiz]\n",=0A@@ -54,10 +54,12 @@ int insiz =3D 0;=0A int outsiz =3D = 0;=0A struct libxenvchan *ctrl =3D 0;=0A =0A-void vchan_wr() {=0A+static = void vchan_wr(void) {=0A+ int ret;=0A+=0A if (!insiz)=0A = return;=0A- int ret =3D libxenvchan_write(ctrl, inbuf, insiz);=0A+ = ret =3D libxenvchan_write(ctrl, inbuf, insiz);=0A if (ret < 0) {=0A = fprintf(stderr, "vchan write failed\n");=0A exit(1);=0A= @@ -68,10 +70,12 @@ void vchan_wr() {=0A }=0A }=0A =0A-void = stdout_wr() {=0A+static void stdout_wr(void) {=0A+ int ret;=0A+=0A = if (!outsiz)=0A return;=0A- int ret =3D write(1, = outbuf, outsiz);=0A+ ret =3D write(1, outbuf, outsiz);=0A if (ret < = 0 && errno !=3D EAGAIN)=0A exit(1);=0A if (ret > 0) {=0A --=__Part695CE2C4.2__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part695CE2C4.2__=--