From: Mike Frysinger <vapier@gentoo.org>
To: Jiri Gaisler <jiri@gaisler.se>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v3 02/14] sim/erc32: Removed type mismatch compiler warnings
Date: Mon, 02 Mar 2015 01:04:00 -0000 [thread overview]
Message-ID: <20150302010447.GG19363@vapier> (raw)
In-Reply-To: <1425244244-27709-3-git-send-email-jiri@gaisler.se>
[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]
On 01 Mar 2015 22:10, Jiri Gaisler wrote:
> while (!feof(fp)) {
> - lbuf[0] = 0;
> - fgets(lbuf, 1023, fp);
> - if ((strlen(lbuf) > 0) && (lbuf[strlen(lbuf) - 1] == '\n'))
> + if (getline(&lbuf, &len, fp) == -1)
> + break;
do you still need the feof check ? getline will do that for you:
while (getline(&lbuf, &len, fp) != -1)
> + if ((strlen(lbuf) > 0) && (lbuf[strlen(lbuf) - 1] == '\n')) {
> lbuf[strlen(lbuf) - 1] = 0;
is gcc smart enough to cache that strlen call ? might be better to do it
yourself:
size_t slen = strlen(lbuf);
if (slen && lbuf[slen - 1] == '\n')
lbuf[slen - 1] = 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 = 0;
> char *cmdsave;
>
do you still need |tmp| now that you changed how the system() warning is
silenced ?
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-03-02 1:04 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-01 21:10 [PATCH v3 00/14] Update of the SPARC SIS simulator Jiri Gaisler
2015-03-01 21:10 ` [PATCH v3 02/14] sim/erc32: Removed type mismatch compiler warnings Jiri Gaisler
2015-03-02 1:04 ` Mike Frysinger [this message]
2015-03-01 21:10 ` [PATCH v3 05/14] sim/erc32: Use memory_iread() function for instruction fetching Jiri Gaisler
2015-03-02 1:15 ` Mike Frysinger
[not found] ` <55020795.4080009@gaisler.se>
2015-03-13 0:15 ` Mike Frysinger
2015-03-01 21:10 ` [PATCH v3 03/14] sim/erc32: Switched emulated memory to host endian order Jiri Gaisler
2015-03-02 1:13 ` Mike Frysinger
2015-03-12 21:25 ` Jiri Gaisler
2015-03-12 23:55 ` Mike Frysinger
[not found] ` <55029ED9.5070009@gaisler.se>
2015-03-14 7:45 ` Mike Frysinger
[not found] ` <5503FDF9.8000109@gaisler.se>
2015-03-14 10:24 ` Mike Frysinger
2015-03-14 20:44 ` Jiri Gaisler
2015-03-17 8:06 ` Mike Frysinger
2015-03-21 20:40 ` Jiri Gaisler
2015-03-01 21:10 ` [PATCH v3 06/14] sim/erc32: Fix a few compiler warnings Jiri Gaisler
2015-03-02 1:18 ` Mike Frysinger
2015-03-01 21:11 ` [PATCH v3 11/14] sim/erc32: Add support for LEON2 processor emulation Jiri Gaisler
2015-03-01 21:11 ` [PATCH v3 13/14] sim/erc32: Add data watchpoint support Jiri Gaisler
2015-03-01 21:11 ` [PATCH v3 14/14] Add watchpoint support to gdb simulator interface Jiri Gaisler
2015-03-01 21:11 ` [PATCH v3 04/14] sim/erc32: use SIM_AC_OPTION_HOSTENDIAN to probe for host endianess Jiri Gaisler
2015-03-16 5:19 ` Mike Frysinger
2015-03-01 21:11 ` [PATCH v3 07/14] sim/erc32: Use gdb callback for UART I/O when linked with gdb Jiri Gaisler
2015-03-02 1:19 ` Mike Frysinger
2015-03-01 21:11 ` [PATCH v3 10/14] sim/erc32: Add support for LEON3 processor emulation Jiri Gaisler
2015-03-05 17:35 ` Mike Frysinger
2015-03-05 17:49 ` Joel Brobecker
2015-03-05 18:20 ` Mike Frysinger
2015-03-01 21:11 ` [PATCH v3 01/14] sim/erc32: Added -v command line switch for verbose output Jiri Gaisler
2015-03-02 0:59 ` Mike Frysinger
2015-03-01 21:11 ` [PATCH v3 12/14] sim/erc32: Updated documentation Jiri Gaisler
2015-03-01 21:11 ` [PATCH v3 08/14] sim/erc32: Access memory subsystem through struct memsys Jiri Gaisler
2015-03-02 1:20 ` Mike Frysinger
2015-03-01 21:11 ` [PATCH v3 09/14] sim/erc32: Move local extern declarations into sis.h Jiri Gaisler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150302010447.GG19363@vapier \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.org \
--cc=jiri@gaisler.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox