[17:46] <Keybuk> void foo() {
[17:46] <Keybuk>     nih_local char *foo;
[17:46] <Keybuk>     foo = nih_strdup (NULL, foo);
[17:46] <Keybuk> }
[17:46] <Keybuk> \o/
[17:46]  * Keybuk is a genius
[17:46] <Keybuk> that pointer will be automatically freed when the function returns ;)
[19:20] <ion_> keybuk: Ooh. How does it work? Using some gcc extension, i presume.
[19:21] <Keybuk> ion_: yup ;)
[19:22] <Keybuk> only works because of the new allocator, of course
[19:22] <Keybuk> the great thing is, that this works:
[19:22] <Keybuk> void foo() {
[19:22] <Keybuk>      nih_local char *foo;
[19:22] <Keybuk>      foo = nih_strdup (NULL, foo);
[19:22] <Keybuk>      pass_to_some_func (foo);
[19:22] <Keybuk> }
[19:22] <Keybuk> if pass_to_some_func() references foo, it won't be freed :-)
[19:22] <ion_> Neat
[19:23] <Keybuk> but if it doesn't, foo is freed ;-)
[19:23] <ion_> Heh, if i type “? libnih” to the address bar, Firefox opens http://fi.wikipedia.org/wiki/Gottfried_Leibniz
[19:25] <ion_> libnih’s trunk doesn’t seem to contain nih_local. What is it defined as?
[19:29] <Keybuk> I haven't pushed it yet
[19:30] <Keybuk> uses __attribute__((cleanup))
[19:30] <Keybuk> which calls a function and passes a pointer to the variable when it goes out of scope
[19:31] <ion_> Alright
[19:33] <Keybuk> I thought about just having something like
[19:33] <Keybuk>   nih_local_context ctx;
[19:33] <Keybuk> where you'd pass that in instead of NULL for the given block
[19:33] <Keybuk> but decided that "nih_local type *var;" was nicer ;)
[19:33] <ion_> Yeah
[19:35] <sadmac> Keybuk: what else is on the list of nih improvements?
[19:36] <Keybuk> d-bus properties
[19:36] <Keybuk> signal handling, etc.
[19:36] <Keybuk> better main loop
[19:37] <sadmac> Keybuk: do you have asynchronous method calls for dbus? That'd help for some initctl stuff
[19:37] <Keybuk> that's on the todo list
[19:38] <sadmac> is there enough on launchpad for me to pitch in?
[19:40] <Keybuk> for the d-bus stuff?
[19:40] <Keybuk> it hasn't changed in months
[19:40] <Keybuk> and I believe I suggested it as something for you to do months ago, and gave you notes ;-)
[19:41] <sadmac> Keybuk: I assume the new memory management would want to be underneath all of it though.
[19:42] <Keybuk> I don't think the D-Bus functions use anything that has changed
[19:42] <Keybuk> only functions that call nih_alloc_reparent are affected
[19:42] <Keybuk> otherwise the API is entirely compatible
[20:50] <keesj> is nih used for other projects?
[20:55] <sadmac> keesj: no, and its really not set up to be right now
[20:55] <sadmac> it operates more as a code patch than an actual library
[20:56] <sadmac> we only barely get away with that because upstart is the only consumer
[20:56] <sadmac> (and its due to change soon)
[20:59] <ion_> My idlemeter uses libnih. :-P
[21:00] <Keybuk> my train set controller uses libnih too ;)
[21:00] <Keybuk> it wasn't even originally written for upstart (which is why upstart uses less than half of it)
[21:00] <Keybuk> it was originally written for dpkg2 ;-)
[21:01] <Keybuk> keesj: if you treat it as a library that changes API on a whim, it's quite usable
[21:01] <Keybuk> ie. don't bzr update libnih in your tree unless you've read the coming changes
[21:01] <keesj> in the old days it was lib.
[21:01] <sadmac> Keybuk: but right now nobody else other than us and the trains are using it, right?
[21:01] <keesj> I see.
[21:02] <keesj> tha's why the compiling upstart from bzr is so stangely not compiling nih but only configuring...
[21:02] <sadmac> oh, and ion_
[21:04] <sadmac> Keybuk: so my thoughts on not waiting for dbus reply is to simply not wait if the user NULLs out the out arguments.
[21:04] <Keybuk> my thought was just to use the async function and NULL the callback ;)
[21:05] <sadmac> that works too.