All of lore.kernel.org
 help / color / mirror / Atom feed
From: harry <harry@hebutterworth.freeserve.co.uk>
To: NAHieu <nahieu@gmail.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: USB virt 2.6 split driver patch series
Date: Tue, 22 Nov 2005 10:24:29 +0000	[thread overview]
Message-ID: <1132655069.5956.5.camel@localhost.localdomain> (raw)
In-Reply-To: <5d7aca950511211800j9799a2dy3186ef4133213417@mail.gmail.com>

On Tue, 2005-11-22 at 11:00 +0900, NAHieu wrote:
> On 11/22/05, NAHieu <nahieu@gmail.com> 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.

  reply	other threads:[~2005-11-22 10:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-21 13:18 USB virt 2.6 split driver patch series harry
2005-11-21 13:49 ` Vincent Hanquez
2005-11-21 14:01   ` harry
2005-11-21 14:27     ` Vincent Hanquez
2005-11-21 14:29     ` Dave Feustel
2005-11-21 14:41     ` NAHieu
2005-11-21 15:14       ` harry
2005-11-21 15:27         ` NAHieu
2005-11-21 15:39           ` harry
2005-11-21 17:02             ` NAHieu
2005-11-21 17:17               ` harry
2005-11-22  1:59                 ` NAHieu
2005-11-22  2:00                   ` NAHieu
2005-11-22 10:24                     ` harry [this message]
2005-11-22 11:07                       ` Vincent Hanquez
2005-11-22 15:37                         ` Anthony Liguori
2005-11-22 20:27                           ` Vincent Hanquez
2005-11-21 15:44         ` Muli Ben-Yehuda
2005-11-21 18:49           ` Harry Butterworth
2005-11-21 18:58             ` Muli Ben-Yehuda
2005-11-25 19:16           ` harry
2005-11-21 17:26     ` Oleg Goldshmidt
2005-11-21 15:34       ` harry
2005-11-21 14:25   ` Dave Feustel
2005-11-21 14:36     ` Vincent Hanquez
2005-11-21 15:24       ` Dave Feustel
2005-11-21 16:03         ` Vincent Hanquez
2005-11-21 16:30           ` Dave Feustel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1132655069.5956.5.camel@localhost.localdomain \
    --to=harry@hebutterworth.freeserve.co.uk \
    --cc=nahieu@gmail.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.