Code sugestions ... (patchletes?)
- From: "Marin Purgar - PMC" <pmc iskon hr>
- To: <gtk-devel-list redhat com>
- Subject: Code sugestions ... (patchletes?)
- Date: Thu, 12 Nov 1998 16:31:04 +0100
Hi!
I have two simple code suggestions for gtk+ code I recently checked out
from CVS.
Firs I see that there is getenv("HOME") call in gtkrc.c. glib provides
g_get_home_dir call. Wouldn't it be cleaner to use it ?
--- gtkrc.c.orig Thu Nov 12 00:37:56 1998
+++ gtkrc.c Thu Nov 12 00:51:52 1998
@@ -292,7 +292,7 @@
}
module_path[n++] = g_strdup(path);
g_free(path);
- var = getenv("HOME");
+ var = g_get_home_dir();
if (var)
{
path = g_malloc(strlen(var) + strlen(".gtk/lib/themes/engines")
+1);
And when referencing user theme libs one slash is missing in the concat:
--- gtkrc.c.orig Thu Nov 12 00:37:56 1998
+++ gtkrc.c Thu Nov 12 00:52:45 1998
@@ -295,8 +295,8 @@
var = getenv("HOME");
if (var)
{
- path = g_malloc(strlen(var) + strlen(".gtk/lib/themes/engines")
+1);
- sprintf(path, "%s%s", var, ".gtk/lib/themes/engines");
+ path = g_malloc(strlen(var) + strlen("/.gtk/lib/themes/engines")
+1);
+ sprintf(path, "%s%s", var, "/.gtk/lib/themes/engines");
}
module_path[n++] = g_strdup(path);
module_path[n] = NULL;
Also IMHO g_string_sprintf should be used instead of sprintf (or not?).
I am fairly new to glib so this may be only babble of beginner ;) ...
bb4now,
PMC
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]