On 5/2/15, Andy Goth <andrew.m.g...@gmail.com> wrote:
> I have a hard time locating where functions are defined, as opposed to
> where they are prototyped or used.  Yeah I know I could use ctags or
> such, but I prefer simple greps when possible.
>
> There are a few stylistic techniques to make it easy to find a function
> definition.  One is to put the function name at the very start of its
> own line, for example:
>
> int
> content_get(int rid, Blob *pBlob){
>
> Now this function's definition can be found by grepping "^content_get",
> or "^content_get(" to weed out functions prefixed by this name.
>
> Another is to include the function name in a comment before the
> function, then follow the function name with space-dash-dash or some
> other sequence that is rarely or never used.
>
> /*
> ** content_get --
> ** Extract the content for ID rid and put it into the
> ** uninitialized blob.  Return 1 on success.  If the record
> ** is a phantom, zero pBlob and return 0.
> */
> int content_get(int rid, Blob *pBlob){
>
> The Tcl source code does both.
>
> Is there any interest in adopting these techniques or others in the
> Fossil source?

No.  Especially not the second as that would be a redundancy.

You could use "grep '^[a-z].*content_get' *.c" to find the
implementation.  Function definitions will always begin with an
typename at the left margin, where as calls to the function will be be
on a line that starts with whitespace.

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
fossil-dev mailing list
fossil-dev@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/fossil-dev

Reply via email to