Re: [PATCH] USB: add scatter-gather support to usbmon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 30 Nov 2009, Pete Zaitcev wrote:

> On Fri, 6 Nov 2009 12:32:23 -0500 (EST)
> Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> 
> > Pete might not like the argument and return-value changes to
> > mon_bin_get_data(), but they made sense to me.
> 
> > -		ep->flag_data = mon_bin_get_data(rp, offset, urb, length);
> > -		if (ep->flag_data != 0) {	/* Yes, it's 0x00, not '0' */
> > +		length = mon_bin_get_data(rp, offset, urb, length,
> > +				&ep->flag_data);
> 
> It's a very GNOMEist way to program. Sure you won a stack word
> (assuming you have enough registers), but who the heck cares?
> I'd pass length by reference, which clearly tells us that it's
> intended to be modified. But it's not a big deal.

Heh.  When you have a function that needs to return two values, the 
choice of which to return directly and which to return by reference is 
pretty arbitrary.  I chose to return length because it is more 
important in the caller's context.

In this case, both ep->flag_data and length are intended to be 
modified.  I don't know why you call this "GNOMEist", but then I've 
never tried to read any GNOME programs.

Maybe it would look better (or more consistent) if _both_ values were
returned by reference?  :-)

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux