Re: [PATCH v2 09/22] sim/erc32: Removed type mismatch compiler warnings

Mike Frysinger
2015-02-22T04:43:53Z

[-- Attachment #1: Type: text/plain, Size: 697 bytes --]

On 19 Feb 2015 23:31, Jiri Gaisler wrote:
> + tmp = getline(&lbuf, &len, fp);
> + if ((strlen(lbuf) > 0) && (lbuf[strlen(lbuf) - 1] == '\n')) {

you need to check the return value of tmp before using lbuf

> + if (lbuf) free(lbuf);

no need for the if check ... free(NULL) required to work in POSIX

> + uint32 len, i, clen, j, tmp;
> ...
> + tmp = system(&cmdsave[clen]);

the return value of system() is int, not uint32 ...

then again, you aren't checking the return value. i guess you just want to
silence the warning ? that doesn't work in gcc. you'll want to do:
if (system(&cmdsave[clen])) {
/* Silence unused return value warning. */
}
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]