Path: utzoo!utgpu!watmath!clyde!att!rutgers!cmcl2!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn )
Newsgroups: comp.lang.c
Subject: Re: A lint question
Message-ID: <9005@smoke.BRL.MIL>
Date: 29 Nov 88 13:02:26 GMT
References: <1256@vsedev.VSE.COM>
Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) )
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 25

In article <1256@vsedev.VSE.COM> logan@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[].