[PATCH] Add a miniobj macro for pointer acquisitions

Dridi Boukelmoune dridi at varni.sh
Thu Mar 17 14:03:55 CET 2016


On Thu, Mar 17, 2016 at 12:50 PM, Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:
> --------
> In message <CABoVN9COqLsa72X4Qa-=ft7eqNUbsDiBY2e3fBbzLQQkSFUEDA at mail.gmail.com>, Dridi Boukelmoune writes:
>
>>In this evening's offline self-hackathon in the train I came up with a
>>macro for a recurring pattern in Varnish Cache that I also happen to
>>use in at least one VMOD so it might benefit others too.
>
> I agree that we should beautify this pattern, but I can't get used
> to the word "ACQUIRE" for it, particular because we are inside a
> "release" functionality.
>
> Could we call it "TAKE_OBJ_NOTMULL()" ?
>
> That matches what we are doing to the object reference much better.
>
> I think TAKEOVER_OBJ_NOTNULL() would be too clunky?

As I said, I'm lacking imagination here. Maybe STEAL_OBJ_NOTNULL?

Synonyms to take according to my search engine:

   Verb: take, occupy, use up, lead, direct, conduct, guide, get hold
   of, assume, acquire.

Synonyms to steal:

   Verb: slip, advance, gain, gain ground, get ahead, make headway,
   move, pull ahead, take, win.

The ones I could see myself using, in alphabetical order:

ASSUME_ (as in "it becomes my responsibility")
MOVE_ (as in C++ or Rust move semantics IIUC)
OWN_
STEAL_ (stolen from vbc terminology)
TAKE_
UNDERTAKE_ (not sure it'd fit better than take over)

Thoughts?



More information about the varnish-dev mailing list