innfeed busy logging timer stats

Russ Allbery rra at
Wed Jun 22 22:24:53 UTC 2011

Florian Schlichting <fschlich at CIS.FU-Berlin.DE> writes:

> while poking around the issue, I happened upon a few things I don't
> understand. So in the hope that you can teach me or tell me it's old
> cruft that should be cleaned up...

The innfeed coding style is a little strange, so indeed there's a lot of
historical cruft.

> 1) What's the point of declaring and defining a function on adjacent
> lines, e.g. innfeed/endpoint.c:~1396

> void timerCallback (void *cd) ;
> void timerCallback (void *cd)
> { 
>   d_printf (1,"Callback \n") ;
> }

The only reason why that would change anything is to avoid a warning if
that function isn't declared in any header file.  But in that case it
should either be added to an internal header file (if it's used outside
that file) or made static if it's only used in that file.  Either way, I
agree that the internal prototype is unnecessary here.

> 2) In light of the confusion it might cause, is there any use in having
> declaration and definition disagree about the name of the function's
> parameters? (innfeed/endpoint.c:~1425, *d doesn't seem to be used?
> Similarly: prepareRead() in innfeed/endpoint.c/.h - the comments
> disagree in yet another way):

They should definitely match if the variable names are present in the
prototype at all.

> void lineIsRead (EndPoint myEp, IoStatus status, Buffer *buffer, void *data);
> void lineIsRead (EndPoint myEp, IoStatus status, Buffer *buffer, void *d)
> {
>   Buffer *writeBuffers, *readBuffers ;
>   Buffer newBuff1, newBuff2 ;
>   Buffer newInputBuffer ;
>   char *data, *p ;
>   ...

> 3) Would it be ok to rename "Buffer *buffer" to "Buffer *buffers" in the
> above code, and "*d" to "*unused"? Preferable?

buffers seems better.  For the data pointer, I assume this function is
used as a callback.  In that case, the variable names should generally
match in all the callback functions with the same prototype, just for aid
in reading the code.  (But if it's not used, it should be marked with

Russ Allbery (rra at             <>

    Please send questions to the list rather than mailing me directly.
     <> explains why.

More information about the inn-workers mailing list