diff options
author | Tim Janik <timj@gimp.org> | 1998-03-08 02:04:26 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-03-08 02:04:26 +0000 |
commit | 76d01a826ca213bcd1b7ee71acdf687de9c9d7f0 (patch) | |
tree | 541c170d68302211c261ca92fcaa7af7d0af557a /gdk/gdkpixmap.c | |
parent | 2395ed082603df688b4cb06ac8c51a44148ff414 (diff) | |
download | gtk+-76d01a826ca213bcd1b7ee71acdf687de9c9d7f0.tar.gz |
define the version variables in config.h.
Sun Mar 8 03:00:17 1998 Tim Janik <timj@gimp.org>
* configure.in: define the version variables in config.h.
* gtk/gtkmain.h:
* gtk/gtkmain.c: added static version variables.
* gdk/gdkpixmap.c: fixed memory leaks (gtk-gronlund-980307-1.patch.gz)
Diffstat (limited to 'gdk/gdkpixmap.c')
-rw-r--r-- | gdk/gdkpixmap.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index ab131e6aca..81adacc41a 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -320,8 +320,7 @@ gdk_pixmap_extract_color (gchar *buffer) return NULL; else if (ptr[0] == '#') { - retcol = g_new(gchar, strlen (ptr) + 1); - strcpy (retcol, ptr); + retcol = g_strdup (ptr); return retcol; } @@ -346,8 +345,7 @@ gdk_pixmap_extract_color (gchar *buffer) } } - retcol = g_new(gchar, strlen (color) + 1); - strcpy (retcol, color); + retcol = g_strdup (color); return retcol; } @@ -366,7 +364,7 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, GdkGC *gc; GdkColor tmp_color; gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt; - gchar *buffer = NULL, *color_name = NULL, pixel_str[32]; + gchar *buffer = NULL, pixel_str[32]; guint buffer_size = 0; _GdkPixmapColor *colors = NULL, *color = NULL; gulong index; @@ -399,6 +397,8 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, for (cnt = 0; cnt < num_cols; cnt++) { + gchar *color_name; + gdk_pixmap_seek_char (infile, '"'); fseek (infile, -1, SEEK_CUR); gdk_pixmap_read_string (infile, &buffer, &buffer_size); @@ -409,9 +409,6 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, colors[cnt].color_string[n] = 0; colors[cnt].transparent = FALSE; - if (color_name != NULL) - g_free (color_name); - color_name = gdk_pixmap_extract_color (&buffer[cpp]); if (color_name != NULL) @@ -428,6 +425,8 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, colors[cnt].transparent = TRUE; } + g_free (color_name); + gdk_color_alloc (colormap, &colors[cnt].color); } @@ -527,7 +526,7 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, GdkGC *gc; GdkColor tmp_color; gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt, i; - gchar *buffer, *color_name = NULL, pixel_str[32]; + gchar *buffer, pixel_str[32]; _GdkPixmapColor *colors = NULL, *color = NULL; gulong index; @@ -550,6 +549,8 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, for (cnt = 0; cnt < num_cols; cnt++) { + gchar *color_name; + buffer = data[i++]; colors[cnt].color_string = g_new(gchar, cpp + 1); @@ -558,9 +559,6 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, colors[cnt].color_string[n] = 0; colors[cnt].transparent = FALSE; - if (color_name != NULL) - g_free (color_name); - color_name = gdk_pixmap_extract_color (&buffer[cpp]); if (color_name != NULL) @@ -577,6 +575,8 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, colors[cnt].transparent = TRUE; } + g_free (color_name); + gdk_color_alloc (colormap, &colors[cnt].color); } |