From: Kyotaro Horiguchi <horikyota....@gmail.com>
> + pqTraceOutputR(const char *message, FILE *f)
> + {
> +     int     cursor = 0;
> +
> +     pqTraceOutputInt32(message, &cursor, f);
> 
> I don't understand the reason for spliting message and &cursor here.
> 
> + pqTraceOutputR(const char *message, FILE *f)
> + {
> +     char *p = message;
> +
> +     pqTraceOutputInt32(&p, f);
> 
> works well.

Yes, that would also work.  But I like the separate cursor + fixed starting 
point here, probably because it's sometimes confusing to see the pointer value 
changed inside functions.  (And a pointer itself is an allergy for some people, 
not to mention a pointer to ointer...)  Also, libpq uses cursors for network 
I/O buffers.  So, I think the patch can be as it is now.


> +static void
> +pqTraceOutputT(const char *message, int end, FILE *f)
> +{
> +     int     cursor = 0;
> +     int nfields;
> +     int     i;
> +
> +     nfields = pqTraceOutputInt16(message, &cursor, f);
> +
> +     for (i = 0; i < nfields; i++)
> +     {
> +             pqTraceOutputString(message, &cursor, end, f);
> +             pqTraceOutputInt32(message, &cursor, f);
> +             pqTraceOutputInt16(message, &cursor, f);
> +             pqTraceOutputInt32(message, &cursor, f);
> +             pqTraceOutputInt16(message, &cursor, f);
> +             pqTraceOutputInt32(message, &cursor, f);
> +             pqTraceOutputInt16(message, &cursor, f);
> +     }
> +}
> 
> I didn't looked closer, but lookong the usage of the variable "end",
> something's wrong in the function.

Ah, end doesn't serve any purpose.  I guess the compiler emitted a warning "end 
is not used".  I think end can be removed.



        Regards
Takayuki Tsunakawa}



Reply via email to