Re: smproxy/save.c



Hi,

>     const gchar *path;
>     ...
>     ...
> 
>     path = getenv ("SM_SAVE_DIR");
>     if (!path)
>       path = gnome_util_home_file (NULL); (needs to be freed)
>     if (!path)
>       path = g_get_home_dir ();
>     if (!path)
>       path = getenv ("HOME");
>     if (!path)
>       path = ".";
> 
> But I can't see how to sanely free this without redoing the whole
> function since it's assigned using different methods where some allocate
> new memory and others don't and the variable is declared as const so the
> compiler will complain loudly if you try to free it...
I don't think any of those functions are likely to return different
values during the lifetime of the program.  I'd make the variable
static, and take some of the lines out, because those functions overlap
in functionality.

Maybe just do..
static const gchar *path = NULL;

if (!path)
    path = (const gchar *) g_getenv ("SM_SAVE_DIR");

if (!path)
    path = (const gchar *) g_build_filename (g_get_home_dir (),
".gnome2", NULL);

> Is this piece of code worth bothering to fix? It seems FC3 doesn't even
> use the session proxy at all. I don't have any ~/.gnome2/.gnome-smproxy-
> * files at least...
Probably not.  The smproxy stuff is just so pre-xsmp applications can
work with gnome-session.  My thoughts are that those applications aren't
integrated with the desktop in so many other ways that spending time so
that they can restore their state on login doesn't really seem useful.

--Ray Strode




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]