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