From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103462 invoked by alias); 2 Mar 2015 01:04:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 103450 invoked by uid 89); 2 Mar 2015 01:04:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 02 Mar 2015 01:04:49 +0000 Received: from vapier (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with SMTP id 34D1C340910; Mon, 2 Mar 2015 01:04:47 +0000 (UTC) Date: Mon, 02 Mar 2015 01:04:00 -0000 From: Mike Frysinger To: Jiri Gaisler Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v3 02/14] sim/erc32: Removed type mismatch compiler warnings Message-ID: <20150302010447.GG19363@vapier> Mail-Followup-To: Jiri Gaisler , gdb-patches@sourceware.org References: <1425244244-27709-1-git-send-email-jiri@gaisler.se> <1425244244-27709-3-git-send-email-jiri@gaisler.se> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WkfBGePaEyrk4zXB" Content-Disposition: inline In-Reply-To: <1425244244-27709-3-git-send-email-jiri@gaisler.se> X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00029.txt.bz2 --WkfBGePaEyrk4zXB Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1011 On 01 Mar 2015 22:10, Jiri Gaisler wrote: > while (!feof(fp)) { > - lbuf[0] =3D 0; > - fgets(lbuf, 1023, fp); > - if ((strlen(lbuf) > 0) && (lbuf[strlen(lbuf) - 1] =3D=3D '\n')) > + if (getline(&lbuf, &len, fp) =3D=3D -1) > + break; do you still need the feof check ? getline will do that for you: while (getline(&lbuf, &len, fp) !=3D -1) > + if ((strlen(lbuf) > 0) && (lbuf[strlen(lbuf) - 1] =3D=3D '\n')) { > lbuf[strlen(lbuf) - 1] =3D 0; is gcc smart enough to cache that strlen call ? might be better to do it=20 yourself: size_t slen =3D strlen(lbuf); if (slen && lbuf[slen - 1] =3D=3D '\n') lbuf[slen - 1] =3D 0; > @@ -383,7 +387,7 @@ exec_cmd(sregs, cmd) > { > char *cmd1, *cmd2; > int32 stat; > - uint32 len, i, clen, j; > + uint32 len, i, clen, j, tmp; > static uint32 daddr =3D 0; > char *cmdsave; >=20=20 do you still need |tmp| now that you changed how the system() warning is silenced ? -mike --WkfBGePaEyrk4zXB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJU87cvAAoJEEFjO5/oN/WB1vMQAJywJBJQMylZor4Wq/iPaGpp 4RtTwcyi04hdyg+9GOA1gK2wQkiQZksS61sx2SOuHwEbOeaft2LXJBgNOx/pnvad Ijx44YXH5dpr0pBDe2rAkqvDhjBGn3nLuqEGLSbVEWS4h2ITeoH+eotjeZlg7ORF aplAK/5VlyjOobXyMw85YZmHUsMxrdbbf+TcOGhyaDd3b4uamfnhKVKRWA/KIg2f 8ddiaCZrwEAGVOWpaQUR7mJFaUuaDS/yYZfdbNxdHlYX8jeoySiVWk196+YHjHBb jQLRIciRCq8b8b52yfwgcSaIUrNAY6xSIZCoG7ouCbHr469cC6AY0JPURWEMmD2n f+8tEzY+eJ1PCoOz0aGBsE+uVjGoo6HZc+l1xLjMLJkPsxZmF1/VXqpJwIVBgov9 tYFz0jv74orBFVpbQ67Kj/aBrbGTkzbuJ4miKMMaKf76YFfyyuKCfTcKjr/8m2Pm qp7XMzbUe2gisq9fNpX++D4KBfpBneuKjIRKmnrx9ECPVCNCgI5w/iN1RJ6YuTKC 3HtciWrSbCoePfUGIFhXu5ViYXwkS07bzWGCa/oqSCLV7zeEWsq9gRWvdmBLwbRi hSO4wmaQwyhd4aD4AEKi/F6o6WRUaHuAEyr6h0ZhCzI0t+2t7boHExK5k9IMXK4p 9qSW16o7s58B4d0lrptp =rRVU -----END PGP SIGNATURE----- --WkfBGePaEyrk4zXB--