list all available services with ListServices, not only already activated

Marcin Krzyzanowski krzak at hakore.com
Wed Dec 1 04:13:52 PST 2004


Użytkownik Havoc Pennington napisał:
> Hi,
> 
> Some comments:
> 
>  - it looks like you're doing:
>    - copy each string into a list
>    - copy each string again from the list into an array
>    - copy again into the message to be returned
>    Maybe that can be sped up.

Right, I just thought that list may be more useful for 
get_activatable_services in activation.c, however I have changed it to 
char** list, and eliminate this one copying.

> 
>  - it would be good to avoid assignment and declaration on the same 
>    line, so:
>     int a = foo ()
>    vs. 
>     int a;
>     a = foo()

ok.

> 
>  - bus_activation_get_activations() I would rename something 
>    like get_activatable_services()

right.

> 
>  - leaking memory in some cases, e.g.:
>      activations_list = bus_activation_get_activations(activation);
> 
>      if (!activations_list)
>        return FALSE;
>   
>      len = _dbus_list_get_length (&activations_list);
>      retval = dbus_new (char *, len + 1);
>  
>      if (retval == NULL)
>        return FALSE;

changed.

>  
>    "make check" should reveal this sort of bug, if you add a test to dispatch.c for your new 
>    stuff.

I'm trying to write it, but it's hard for me to write it without 
possibility of checking with cvs code. Where is cvs repository now 
available, or maybe it is not yet ?

updated patch available from the same URL : 
http://krzak.linux.net.pl/patches/dbus-ListActivatableServices.patch

> Havoc

Thanks.

-- 
Marcin Krzyżanowski


More information about the dbus mailing list