A lint question

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Nov 29 23:02:26 AEST 1988


In article <1256 at vsedev.VSE.COM> logan at vsedev.VSE.COM (James Logan III) writes:
>function argument ( number ) used inconsistently
>    malloc( arg 1 )   	llib-lc(338) :: findlinks.c(114)
>    read( arg 3 )   	llib-lc(104) :: findlinks.c(127)
>I assume that lint is telling me that I am calling malloc() and
>read() with an inconsistent number or parameters.  How can I be
>inconsistent with the number of parameters with one call to malloc()?

If you look closely, you can see that "lint" is telling you that
the usage on line 114 of findlinks.c is inconsistent with line 338
of llib-lc.  the latter is the "lint library" that defines the
expected types for system interfaces.

>directory = (char *)malloc((int)stbuf.st_size);

char *malloc(unsigned) according to the lint library.

>if (read(fd, directory, (int)stbuf.st_size) != (int)stbuf.st_size) {
>while (read(fd, &mntbuf, sizeof(MNT)) == sizeof(MNT)) {
>while (read(fd, nextentry, sizeof(nextentry)) == sizeof(nextentry)) {

int read(int, char *, unsigned) according to the lint library.
Case 1 has int for argument 3
Case 2 has the wrong pointer type for argument 2
Case 3 is a bug unless nextentry is a char[].



More information about the Comp.lang.c mailing list