[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] USB virt 2.6 split driver patch series
On Tue, 2005-11-22 at 11:00 +0900, NAHieu wrote: > On 11/22/05, NAHieu <nahieu@xxxxxxxxx> wrote: > > I had a look at xenidc code, and found some code like this: > > > > -- > > static void xenidc_endpoint_destroy_1(xenidc_callback * callback) > > { > > trace(); > > > > { > > xenidc_endpoint_callback *endpoint_callback = > > container_of(callback, xenidc_endpoint_callback, > > callback); > > > > endpoint_callback->destroyed = 1; > > > > xenidc_work_wake_up(); > > } > > } > > -- > > > > Why name it *destroy_1? it is a common practice to name a local > > function with _ or __ as prefix. So for example > > xenidc_endpoint_destroy_1() should be named > > _xenidc_endpoint_destroy_1() or __xenidc_endpoint_destroy_1() > > > > Oops, typo. I meant _xenidc_endpoint_destroy_1() should be named > _xenidc_endpoint_destroy() or __xenidc_endpoint_destroy() > This is for chains of functions which are logically part of the same operation but are split by asynchronous callbacks. The first function is called something: xenidc_endpoint_destroy() for example the next xenidc_endpoint_destroy_1, the next xenidc_endpoint_destroy_2 and so on. Leading underscores won't work past _1. Unless you want _ then __ then ___ :-) Also identifiers with two leading underscores are reserved by ANSI C for the C compiler implementation so I think it's not a good idea to use them. Thanks Harry. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |