Remove unnecessary NULL checks before g_free(). (#369666, Morten Welinder,

2007-03-09  Matthias Clasen <mclasen@redhat.com>

        * Everywhere: Remove unnecessary NULL checks before
        g_free().  (#369666, Morten Welinder, Djihed Afifi)

        * configure.in: Check for ftw.h



svn path=/trunk/; revision=17444
This commit is contained in:
Matthias Clasen 2007-03-09 21:57:37 +00:00 committed by Matthias Clasen
parent a1e4554462
commit 82ce59cd0f
59 changed files with 126 additions and 232 deletions

View File

@ -1,3 +1,10 @@
2007-03-09 Matthias Clasen <mclasen@redhat.com>
* Everywhere: Remove unnecessary NULL checks before
g_free(). (#369666, Morten Welinder, Djihed Afifi)
* configure.in: Check for ftw.h
2007-03-09 Matthias Clasen <mclasen@redhat.com> 2007-03-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilesystemwin32.c (get_icon_path): Remove * gtk/gtkfilesystemwin32.c (get_icon_path): Remove

View File

@ -564,6 +564,7 @@ LIBS=$gtk_save_LIBS
AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H)) AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H))
AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H)) AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H)) AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H))
AC_CHECK_HEADERS(ftw.h, AC_DEFINE(HAVE_FTW_H))
saved_cflags="$CFLAGS" saved_cflags="$CFLAGS"
saved_ldflags="$LDFLAGS" saved_ldflags="$LDFLAGS"

View File

@ -691,7 +691,6 @@ static gboolean gdk_pixbuf__bmp_image_stop_load(gpointer data, GError **error)
g_return_val_if_fail(context != NULL, TRUE); g_return_val_if_fail(context != NULL, TRUE);
if (context->Colormap != NULL)
g_free(context->Colormap); g_free(context->Colormap);
if (context->pixbuf) if (context->pixbuf)

View File

@ -176,10 +176,8 @@ static gboolean gdk_pixbuf__ico_image_load_increment(gpointer data,
static void static void
context_free (struct ico_progressive_state *context) context_free (struct ico_progressive_state *context)
{ {
if (context->LineBuf != NULL)
g_free (context->LineBuf); g_free (context->LineBuf);
context->LineBuf = NULL; context->LineBuf = NULL;
if (context->HeaderBuf != NULL)
g_free (context->HeaderBuf); g_free (context->HeaderBuf);
if (context->pixbuf) if (context->pixbuf)

View File

@ -103,15 +103,11 @@ fill_pcx_context(struct pcx_context *context)
static void static void
free_pcx_context(struct pcx_context *context, gboolean unref_pixbuf) free_pcx_context(struct pcx_context *context, gboolean unref_pixbuf)
{ {
if(context->header)
g_free(context->header); g_free(context->header);
if(context->buf)
g_free(context->buf); g_free(context->buf);
if(unref_pixbuf && context->pixbuf) if(unref_pixbuf && context->pixbuf)
g_object_unref(context->pixbuf); g_object_unref(context->pixbuf);
if(context->line)
g_free(context->line); g_free(context->line);
if(context->p_data)
g_free(context->p_data); g_free(context->p_data);
g_free(context); g_free(context);

View File

@ -283,7 +283,6 @@ gdk_pixbuf__png_image_load (FILE *f, GError **error)
} }
if (setjmp (png_ptr->jmpbuf)) { if (setjmp (png_ptr->jmpbuf)) {
if (rows)
g_free (rows); g_free (rows);
if (pixbuf) if (pixbuf)

View File

@ -281,9 +281,7 @@ gdk_pixbuf__ras_image_stop_load(gpointer data, GError **error)
g_return_val_if_fail(context != NULL, TRUE); g_return_val_if_fail(context != NULL, TRUE);
if (context->LineBuf != NULL)
g_free(context->LineBuf); g_free(context->LineBuf);
if (context->HeaderBuf != NULL)
g_free(context->HeaderBuf); g_free(context->HeaderBuf);
if (context->pixbuf) if (context->pixbuf)

View File

@ -228,7 +228,6 @@ static IOBuffer *io_buffer_free_segment(IOBuffer *buffer,
static void io_buffer_free(IOBuffer *buffer) static void io_buffer_free(IOBuffer *buffer)
{ {
g_return_if_fail(buffer != NULL); g_return_if_fail(buffer != NULL);
if (buffer->data)
g_free(buffer->data); g_free(buffer->data);
g_free(buffer); g_free(buffer);
} }
@ -943,10 +942,8 @@ static gboolean gdk_pixbuf__tga_stop_load(gpointer data, GError **err)
ctx->pbuf->width, ctx->pbuf->height, ctx->pbuf->width, ctx->pbuf->height,
ctx->udata); ctx->udata);
} }
if (ctx->hdr)
g_free (ctx->hdr); g_free (ctx->hdr);
if (ctx->cmap) { if (ctx->cmap) {
if (ctx->cmap->cols)
g_free (ctx->cmap->cols); g_free (ctx->cmap->cols);
g_free (ctx->cmap); g_free (ctx->cmap);
} }

View File

@ -692,7 +692,6 @@ gdk_get_program_class (void)
void void
gdk_set_program_class (const char *program_class) gdk_set_program_class (const char *program_class)
{ {
if (gdk_progclass)
g_free (gdk_progclass); g_free (gdk_progclass);
gdk_progclass = g_strdup (program_class); gdk_progclass = g_strdup (program_class);

View File

@ -465,7 +465,6 @@ gdk_event_free (GdkEvent *event)
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:
if (event->button.axes)
g_free (event->button.axes); g_free (event->button.axes);
break; break;
@ -475,7 +474,6 @@ gdk_event_free (GdkEvent *event)
break; break;
case GDK_MOTION_NOTIFY: case GDK_MOTION_NOTIFY:
if (event->motion.axes)
g_free (event->motion.axes); g_free (event->motion.axes);
break; break;

View File

@ -526,7 +526,6 @@ gdk_rgb_free_info (GdkRgbInfo *image_info)
{ {
GSList *tmp_list; GSList *tmp_list;
if (image_info->stage_buf)
g_free (image_info->stage_buf); g_free (image_info->stage_buf);
if (image_info->gray_cmap) if (image_info->gray_cmap)
@ -535,10 +534,8 @@ gdk_rgb_free_info (GdkRgbInfo *image_info)
if (image_info->own_gc) if (image_info->own_gc)
g_object_unref (image_info->own_gc); g_object_unref (image_info->own_gc);
if (image_info->colorcube)
g_free (image_info->colorcube); g_free (image_info->colorcube);
if (image_info->colorcube_d)
g_free (image_info->colorcube_d); g_free (image_info->colorcube_d);
tmp_list = image_info->cmap_info_list; tmp_list = image_info->cmap_info_list;

View File

@ -2130,7 +2130,6 @@ gdk_window_draw_trapezoids (GdkDrawable *drawable,
else else
gdk_draw_trapezoids (private->impl, gc, trapezoids, n_trapezoids); gdk_draw_trapezoids (private->impl, gc, trapezoids, n_trapezoids);
if (new_trapezoids)
g_free (new_trapezoids); g_free (new_trapezoids);
RESTORE_GC (gc); RESTORE_GC (gc);

View File

@ -835,7 +835,6 @@ miComputeWideEllipse(int lw, miArc *parc, gboolean *mustFree)
spdata = lruent->spdata; spdata = lruent->spdata;
if (!spdata || spdata->k != k) if (!spdata || spdata->k != k)
{ {
if (spdata)
g_free(spdata); g_free(spdata);
spdata = (miArcSpanData *)g_malloc(sizeof(miArcSpanData) + spdata = (miArcSpanData *)g_malloc(sizeof(miArcSpanData) +
sizeof(miArcSpan) * (k + 2)); sizeof(miArcSpan) * (k + 2));

View File

@ -195,7 +195,7 @@ void miAppendSpans(SpanGroup *spanGroup, SpanGroup *otherGroup, Spans *spans)
void miFreeSpanGroup(SpanGroup *spanGroup) void miFreeSpanGroup(SpanGroup *spanGroup)
{ {
if (spanGroup->group != NULL) g_free(spanGroup->group); g_free(spanGroup->group);
} }
static void QuickSortSpansX(register GdkSpan points[], register int numSpans) static void QuickSortSpansX(register GdkSpan points[], register int numSpans)
@ -368,9 +368,7 @@ void miFillUniqueSpanGroup(GdkDrawable *pDraw, GdkGC *pGC, SpanGroup *spanGroup)
if (!yspans || !ysizes) if (!yspans || !ysizes)
{ {
if (yspans)
g_free (yspans); g_free (yspans);
if (ysizes)
g_free (ysizes); g_free (ysizes);
miDisposeSpanGroup (spanGroup); miDisposeSpanGroup (spanGroup);
return; return;
@ -438,7 +436,6 @@ void miFillUniqueSpanGroup(GdkDrawable *pDraw, GdkGC *pGC, SpanGroup *spanGroup)
} }
g_free (yspans); g_free (yspans);
g_free (ysizes); g_free (ysizes);
if (points)
g_free (points); g_free (points);
return; return;
} }

View File

@ -251,7 +251,6 @@ _gdk_windowing_gc_copy (GdkGC *dst_gc,
dst_quartz_gc->cap_style = src_quartz_gc->cap_style; dst_quartz_gc->cap_style = src_quartz_gc->cap_style;
dst_quartz_gc->join_style = src_quartz_gc->join_style; dst_quartz_gc->join_style = src_quartz_gc->join_style;
if (dst_quartz_gc->dash_lengths)
g_free (dst_quartz_gc->dash_lengths); g_free (dst_quartz_gc->dash_lengths);
dst_quartz_gc->dash_lengths = g_memdup (src_quartz_gc->dash_lengths, dst_quartz_gc->dash_lengths = g_memdup (src_quartz_gc->dash_lengths,
sizeof (float) * src_quartz_gc->dash_count); sizeof (float) * src_quartz_gc->dash_count);

View File

@ -107,7 +107,6 @@ gdk_gc_win32_finalize (GObject *object)
if (win32_gc->values_mask & GDK_GC_FONT) if (win32_gc->values_mask & GDK_GC_FONT)
gdk_font_unref (win32_gc->font); gdk_font_unref (win32_gc->font);
if (win32_gc->pen_dashes)
g_free (win32_gc->pen_dashes); g_free (win32_gc->pen_dashes);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
@ -618,7 +617,6 @@ _gdk_windowing_gc_copy (GdkGC *dst_gc,
if (dst_win32_gc->font != NULL) if (dst_win32_gc->font != NULL)
gdk_font_unref (dst_win32_gc->font); gdk_font_unref (dst_win32_gc->font);
if (dst_win32_gc->pen_dashes)
g_free (dst_win32_gc->pen_dashes); g_free (dst_win32_gc->pen_dashes);
dst_win32_gc->hcliprgn = src_win32_gc->hcliprgn; dst_win32_gc->hcliprgn = src_win32_gc->hcliprgn;

View File

@ -240,7 +240,6 @@ gdk_property_change (GdkWindow *window,
WIN32_API_FAILED ("GlobalAlloc"); WIN32_API_FAILED ("GlobalAlloc");
if (!CloseClipboard ()) if (!CloseClipboard ())
WIN32_API_FAILED ("CloseClipboard"); WIN32_API_FAILED ("CloseClipboard");
if (buf != NULL)
g_free (buf); g_free (buf);
return; return;
} }

View File

@ -247,11 +247,8 @@ gdk_input_device_new (GdkDisplay *display,
error: error:
g_free (gdkdev->info.name); g_free (gdkdev->info.name);
if (gdkdev->axes)
g_free (gdkdev->axes); g_free (gdkdev->axes);
if (gdkdev->info.keys)
g_free (gdkdev->info.keys); g_free (gdkdev->info.keys);
if (gdkdev->info.axes)
g_free (gdkdev->info.axes); g_free (gdkdev->info.axes);
g_object_unref (gdkdev); g_object_unref (gdkdev);

View File

@ -639,7 +639,6 @@ init_xinerama_support (GdkScreen * screen)
int opcode, firstevent, firsterror; int opcode, firstevent, firsterror;
#endif #endif
if (screen_x11->monitors)
g_free (screen_x11->monitors); g_free (screen_x11->monitors);
#ifdef HAVE_XINERAMA #ifdef HAVE_XINERAMA

View File

@ -194,7 +194,6 @@ gdk_window_impl_x11_finalize (GObject *object)
_gdk_xid_table_remove (display, window_impl->toplevel->focus_window); _gdk_xid_table_remove (display, window_impl->toplevel->focus_window);
} }
if (window_impl->toplevel)
g_free (window_impl->toplevel); g_free (window_impl->toplevel);
if (window_impl->cursor) if (window_impl->cursor)

View File

@ -809,7 +809,7 @@ gtk_about_dialog_set_version (GtkAboutDialog *about,
priv = (GtkAboutDialogPrivate *)about->private_data; priv = (GtkAboutDialogPrivate *)about->private_data;
tmp = priv->version; tmp = priv->version;
priv->version = version ? g_strdup (version) : NULL; priv->version = g_strdup (version);
g_free (tmp); g_free (tmp);
update_name_version (about); update_name_version (about);
@ -862,7 +862,7 @@ gtk_about_dialog_set_copyright (GtkAboutDialog *about,
priv = (GtkAboutDialogPrivate *)about->private_data; priv = (GtkAboutDialogPrivate *)about->private_data;
tmp = priv->copyright; tmp = priv->copyright;
priv->copyright = copyright ? g_strdup (copyright) : NULL; priv->copyright = g_strdup (copyright);
g_free (tmp); g_free (tmp);
if (priv->copyright != NULL) if (priv->copyright != NULL)

View File

@ -336,7 +336,6 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
priv->stock_size = g_value_get_uint (value); priv->stock_size = g_value_get_uint (value);
break; break;
case PROP_STOCK_DETAIL: case PROP_STOCK_DETAIL:
if (priv->stock_detail)
g_free (priv->stock_detail); g_free (priv->stock_detail);
priv->stock_detail = g_value_dup_string (value); priv->stock_detail = g_value_dup_string (value);
break; break;

View File

@ -592,7 +592,6 @@ gtk_cell_renderer_text_finalize (GObject *object)
pango_font_description_free (celltext->font); pango_font_description_free (celltext->font);
if (celltext->text)
g_free (celltext->text); g_free (celltext->text);
if (celltext->extra_attrs) if (celltext->extra_attrs)
@ -1009,7 +1008,6 @@ gtk_cell_renderer_text_set_property (GObject *object,
switch (param_id) switch (param_id)
{ {
case PROP_TEXT: case PROP_TEXT:
if (celltext->text)
g_free (celltext->text); g_free (celltext->text);
if (priv->markup_set) if (priv->markup_set)
@ -1054,7 +1052,6 @@ gtk_cell_renderer_text_set_property (GObject *object,
return; return;
} }
if (celltext->text)
g_free (celltext->text); g_free (celltext->text);
if (celltext->extra_attrs) if (celltext->extra_attrs)

View File

@ -2525,7 +2525,6 @@ set_cell_contents (GtkCList *clist,
!GTK_CLIST_AUTO_RESIZE_BLOCKED (clist)) !GTK_CLIST_AUTO_RESIZE_BLOCKED (clist))
column_auto_resize (clist, clist_row, column, requisition.width); column_auto_resize (clist, clist_row, column, requisition.width);
if (old_text)
g_free (old_text); g_free (old_text);
if (old_pixmap) if (old_pixmap)
gdk_pixmap_unref (old_pixmap); gdk_pixmap_unref (old_pixmap);
@ -6324,7 +6323,6 @@ column_title_new (GtkCList *clist,
gint column, gint column,
const gchar *title) const gchar *title)
{ {
if (clist->column[column].title)
g_free (clist->column[column].title); g_free (clist->column[column].title);
clist->column[column].title = g_strdup (title); clist->column[column].title = g_strdup (title);
@ -6336,7 +6334,6 @@ columns_delete (GtkCList *clist)
gint i; gint i;
for (i = 0; i < clist->columns; i++) for (i = 0; i < clist->columns; i++)
if (clist->column[i].title)
g_free (clist->column[i].title); g_free (clist->column[i].title);
g_free (clist->column); g_free (clist->column);

View File

@ -232,7 +232,6 @@ gtk_combo_entry_key_press (GtkEntry * entry, GdkEventKey * event, GtkCombo * com
gtk_editable_set_position (editable, pos); gtk_editable_set_position (editable, pos);
} }
if (nprefix)
g_free (nprefix); g_free (nprefix);
g_free (prefix); g_free (prefix);
g_completion_free (cmpl); g_completion_free (cmpl);

View File

@ -3024,7 +3024,6 @@ set_cell_contents (GtkCList *clist,
!GTK_CLIST_AUTO_RESIZE_BLOCKED (clist)) !GTK_CLIST_AUTO_RESIZE_BLOCKED (clist))
column_auto_resize (clist, clist_row, column, requisition.width); column_auto_resize (clist, clist_row, column, requisition.width);
if (old_text)
g_free (old_text); g_free (old_text);
if (old_pixmap) if (old_pixmap)
gdk_pixmap_unref (old_pixmap); gdk_pixmap_unref (old_pixmap);

View File

@ -350,7 +350,6 @@ gtk_curve_interpolate (GtkCurve *c, gint width, gint height)
if (c->num_points != width) if (c->num_points != width)
{ {
c->num_points = width; c->num_points = width;
if (c->point)
g_free (c->point); g_free (c->point);
c->point = g_malloc (c->num_points * sizeof (c->point[0])); c->point = g_malloc (c->num_points * sizeof (c->point[0]));
} }
@ -687,7 +686,6 @@ gtk_curve_set_curve_type (GtkCurve *c, GtkCurveType new_type)
} }
else if (c->curve_type == GTK_CURVE_TYPE_FREE) else if (c->curve_type == GTK_CURVE_TYPE_FREE)
{ {
if (c->ctlpoint)
g_free (c->ctlpoint); g_free (c->ctlpoint);
c->num_ctlpoints = 9; c->num_ctlpoints = 9;
c->ctlpoint = g_malloc (c->num_ctlpoints * sizeof (*c->ctlpoint)); c->ctlpoint = g_malloc (c->num_ctlpoints * sizeof (*c->ctlpoint));
@ -746,7 +744,6 @@ gtk_curve_size_graph (GtkCurve *curve)
static void static void
gtk_curve_reset_vector (GtkCurve *curve) gtk_curve_reset_vector (GtkCurve *curve)
{ {
if (curve->ctlpoint)
g_free (curve->ctlpoint); g_free (curve->ctlpoint);
curve->num_ctlpoints = 2; curve->num_ctlpoints = 2;
@ -1030,9 +1027,7 @@ gtk_curve_finalize (GObject *object)
curve = GTK_CURVE (object); curve = GTK_CURVE (object);
if (curve->pixmap) if (curve->pixmap)
g_object_unref (curve->pixmap); g_object_unref (curve->pixmap);
if (curve->point)
g_free (curve->point); g_free (curve->point);
if (curve->ctlpoint)
g_free (curve->ctlpoint); g_free (curve->ctlpoint);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);

View File

@ -3402,7 +3402,6 @@ gtk_entry_create_layout (GtkEntry *entry,
pango_layout_set_attributes (layout, tmp_attrs); pango_layout_set_attributes (layout, tmp_attrs);
if (preedit_string)
g_free (preedit_string); g_free (preedit_string);
if (preedit_attrs) if (preedit_attrs)
pango_attr_list_unref (preedit_attrs); pango_attr_list_unref (preedit_attrs);

View File

@ -573,7 +573,6 @@ gtk_entry_completion_finalize (GObject *object)
if (priv->action_view) if (priv->action_view)
g_object_unref (priv->action_view); g_object_unref (priv->action_view);
if (priv->case_normalized_key)
g_free (priv->case_normalized_key); g_free (priv->case_normalized_key);
if (priv->popup_window) if (priv->popup_window)
@ -1095,7 +1094,6 @@ gtk_entry_completion_complete (GtkEntryCompletion *completion)
if (!completion->priv->filter_model) if (!completion->priv->filter_model)
return; return;
if (completion->priv->case_normalized_key)
g_free (completion->priv->case_normalized_key); g_free (completion->priv->case_normalized_key);
tmp = g_utf8_normalize (gtk_entry_get_text (GTK_ENTRY (completion->priv->entry)), tmp = g_utf8_normalize (gtk_entry_get_text (GTK_ENTRY (completion->priv->entry)),

View File

@ -846,7 +846,6 @@ gtk_file_chooser_entry_changed (GtkEditable *editable)
file_part_pos = 0; file_part_pos = 0;
} }
if (chooser_entry->file_part)
g_free (chooser_entry->file_part); g_free (chooser_entry->file_part);
chooser_entry->file_part = file_part; chooser_entry->file_part = file_part;

View File

@ -130,7 +130,6 @@ gtk_file_filter_finalize (GObject *object)
g_slist_foreach (filter->rules, (GFunc)filter_rule_free, NULL); g_slist_foreach (filter->rules, (GFunc)filter_rule_free, NULL);
g_slist_free (filter->rules); g_slist_free (filter->rules);
if (filter->name)
g_free (filter->name); g_free (filter->name);
G_OBJECT_CLASS (gtk_file_filter_parent_class)->finalize (object); G_OBJECT_CLASS (gtk_file_filter_parent_class)->finalize (object);
@ -179,7 +178,6 @@ gtk_file_filter_set_name (GtkFileFilter *filter,
{ {
g_return_if_fail (GTK_IS_FILE_FILTER (filter)); g_return_if_fail (GTK_IS_FILE_FILTER (filter));
if (filter->name)
g_free (filter->name); g_free (filter->name);
filter->name = g_strdup (name); filter->name = g_strdup (name);

View File

@ -2386,7 +2386,6 @@ gtk_file_selection_file_changed (GtkTreeSelection *selection,
if (index != -1) if (index != -1)
{ {
if (fs->last_selected != NULL)
g_free (fs->last_selected); g_free (fs->last_selected);
fs->last_selected = g_strdup (g_ptr_array_index (new_names, index)); fs->last_selected = g_strdup (g_ptr_array_index (new_names, index));
@ -2701,13 +2700,9 @@ cmpl_free_state (CompletionState* cmpl_state)
cmpl_free_dir_list (cmpl_state->directory_storage); cmpl_free_dir_list (cmpl_state->directory_storage);
cmpl_free_dir_sent_list (cmpl_state->directory_sent_storage); cmpl_free_dir_sent_list (cmpl_state->directory_sent_storage);
if (cmpl_state->user_dir_name_buffer)
g_free (cmpl_state->user_dir_name_buffer); g_free (cmpl_state->user_dir_name_buffer);
if (cmpl_state->user_directories)
g_free (cmpl_state->user_directories); g_free (cmpl_state->user_directories);
if (cmpl_state->the_completion.text)
g_free (cmpl_state->the_completion.text); g_free (cmpl_state->the_completion.text);
if (cmpl_state->updated_text)
g_free (cmpl_state->updated_text); g_free (cmpl_state->updated_text);
g_free (cmpl_state); g_free (cmpl_state);
@ -3948,9 +3943,7 @@ get_pwdb (CompletionState* cmpl_state)
error: error:
if (cmpl_state->user_dir_name_buffer)
g_free (cmpl_state->user_dir_name_buffer); g_free (cmpl_state->user_dir_name_buffer);
if (cmpl_state->user_directories)
g_free (cmpl_state->user_directories); g_free (cmpl_state->user_directories);
cmpl_state->user_dir_name_buffer = NULL; cmpl_state->user_dir_name_buffer = NULL;

View File

@ -103,13 +103,9 @@ gtk_file_info_free (GtkFileInfo *info)
{ {
g_return_if_fail (info != NULL); g_return_if_fail (info != NULL);
if (info->display_name)
g_free (info->display_name); g_free (info->display_name);
if (info->mime_type)
g_free (info->mime_type); g_free (info->mime_type);
if (info->display_key)
g_free (info->display_key); g_free (info->display_key);
if (info->icon_name)
g_free (info->icon_name); g_free (info->icon_name);
g_free (info); g_free (info);
@ -158,7 +154,6 @@ gtk_file_info_set_display_name (GtkFileInfo *info,
if (display_name == info->display_name) if (display_name == info->display_name)
return; return;
if (info->display_name)
g_free (info->display_name); g_free (info->display_name);
if (info->display_key) if (info->display_key)
{ {
@ -217,7 +212,6 @@ gtk_file_info_set_mime_type (GtkFileInfo *info,
{ {
g_return_if_fail (info != NULL); g_return_if_fail (info != NULL);
if (info->mime_type)
g_free (info->mime_type); g_free (info->mime_type);
info->mime_type = g_strdup (mime_type); info->mime_type = g_strdup (mime_type);
@ -264,7 +258,6 @@ gtk_file_info_set_icon_name (GtkFileInfo *info,
{ {
g_return_if_fail (info != NULL); g_return_if_fail (info != NULL);
if (info->icon_name)
g_free (info->icon_name); g_free (info->icon_name);
info->icon_name = g_strdup (icon_name); info->icon_name = g_strdup (icon_name);

View File

@ -999,9 +999,7 @@ insert_theme (GtkIconTheme *icon_theme, const char *theme_name)
static void static void
free_unthemed_icon (UnthemedIcon *unthemed_icon) free_unthemed_icon (UnthemedIcon *unthemed_icon)
{ {
if (unthemed_icon->svg_filename)
g_free (unthemed_icon->svg_filename); g_free (unthemed_icon->svg_filename);
if (unthemed_icon->no_svg_filename)
g_free (unthemed_icon->no_svg_filename); g_free (unthemed_icon->no_svg_filename);
g_slice_free (UnthemedIcon, unthemed_icon); g_slice_free (UnthemedIcon, unthemed_icon);
} }
@ -2434,10 +2432,8 @@ gtk_icon_info_free (GtkIconInfo *icon_info)
{ {
g_return_if_fail (icon_info != NULL); g_return_if_fail (icon_info != NULL);
if (icon_info->filename)
g_free (icon_info->filename); g_free (icon_info->filename);
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
if (icon_info->cp_filename)
g_free (icon_info->cp_filename); g_free (icon_info->cp_filename);
#endif #endif
if (icon_info->pixbuf) if (icon_info->pixbuf)
@ -2560,7 +2556,6 @@ load_svg_at_size (const gchar *filename,
bail: bail:
if (loader) if (loader)
g_object_unref (loader); g_object_unref (loader);
if (contents)
g_free (contents); g_free (contents);
return pixbuf; return pixbuf;

View File

@ -7017,7 +7017,6 @@ gtk_icon_view_item_accessible_action_set_description (AtkAction *action,
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (action); item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (action);
if (item->action_descriptions[i])
g_free (item->action_descriptions[i]); g_free (item->action_descriptions[i]);
item->action_descriptions[i] = g_strdup (description); item->action_descriptions[i] = g_strdup (description);

View File

@ -1894,7 +1894,6 @@ gtk_image_reset (GtkImage *image)
break; break;
case GTK_IMAGE_ICON_NAME: case GTK_IMAGE_ICON_NAME:
if (image->data.name.icon_name)
g_free (image->data.name.icon_name); g_free (image->data.name.icon_name);
image->data.name.icon_name = NULL; image->data.name.icon_name = NULL;
if (image->data.name.pixbuf) if (image->data.name.pixbuf)

View File

@ -1144,7 +1144,6 @@ button_data_free (ButtonData *button_data)
gtk_file_path_free (button_data->path); gtk_file_path_free (button_data->path);
button_data->path = NULL; button_data->path = NULL;
if (button_data->dir_name)
g_free (button_data->dir_name); g_free (button_data->dir_name);
button_data->dir_name = NULL; button_data->dir_name = NULL;

View File

@ -200,7 +200,6 @@ gtk_preview_size (GtkPreview *preview,
GTK_WIDGET (preview)->requisition.width = width; GTK_WIDGET (preview)->requisition.width = width;
GTK_WIDGET (preview)->requisition.height = height; GTK_WIDGET (preview)->requisition.height = height;
if (preview->buffer)
g_free (preview->buffer); g_free (preview->buffer);
preview->buffer = NULL; preview->buffer = NULL;
} }
@ -416,7 +415,6 @@ gtk_preview_finalize (GObject *object)
g_return_if_fail (GTK_IS_PREVIEW (object)); g_return_if_fail (GTK_IS_PREVIEW (object));
preview = GTK_PREVIEW (object); preview = GTK_PREVIEW (object);
if (preview->buffer)
g_free (preview->buffer); g_free (preview->buffer);
preview->type = (GtkPreviewType) -1; preview->type = (GtkPreviewType) -1;
@ -549,7 +547,6 @@ gtk_preview_make_buffer (GtkPreview *preview)
(preview->buffer_width != width) || (preview->buffer_width != width) ||
(preview->buffer_height != height)) (preview->buffer_height != height))
{ {
if (preview->buffer)
g_free (preview->buffer); g_free (preview->buffer);
preview->buffer_width = width; preview->buffer_width = width;

View File

@ -273,7 +273,6 @@ gtk_progress_finalize (GObject *object)
if (progress->offscreen_pixmap) if (progress->offscreen_pixmap)
g_object_unref (progress->offscreen_pixmap); g_object_unref (progress->offscreen_pixmap);
if (progress->format)
g_free (progress->format); g_free (progress->format);
G_OBJECT_CLASS (gtk_progress_parent_class)->finalize (object); G_OBJECT_CLASS (gtk_progress_parent_class)->finalize (object);

View File

@ -1166,13 +1166,11 @@ gtk_rc_style_finalize (GObject *object)
rc_style = GTK_RC_STYLE (object); rc_style = GTK_RC_STYLE (object);
rc_priv = GTK_RC_STYLE_GET_PRIVATE (rc_style); rc_priv = GTK_RC_STYLE_GET_PRIVATE (rc_style);
if (rc_style->name)
g_free (rc_style->name); g_free (rc_style->name);
if (rc_style->font_desc) if (rc_style->font_desc)
pango_font_description_free (rc_style->font_desc); pango_font_description_free (rc_style->font_desc);
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
if (rc_style->bg_pixmap_name[i])
g_free (rc_style->bg_pixmap_name[i]); g_free (rc_style->bg_pixmap_name[i]);
/* Now remove all references to this rc_style from /* Now remove all references to this rc_style from
@ -3039,7 +3037,6 @@ gtk_rc_parse_style (GtkRcContext *context,
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
{ {
if (rc_style->bg_pixmap_name[i])
g_free (rc_style->bg_pixmap_name[i]); g_free (rc_style->bg_pixmap_name[i]);
rc_style->bg_pixmap_name[i] = g_strdup (parent_style->bg_pixmap_name[i]); rc_style->bg_pixmap_name[i] = g_strdup (parent_style->bg_pixmap_name[i]);
} }
@ -3395,7 +3392,6 @@ gtk_rc_parse_bg_pixmap (GtkRcContext *context,
if (pixmap_file) if (pixmap_file)
{ {
if (rc_style->bg_pixmap_name[state])
g_free (rc_style->bg_pixmap_name[state]); g_free (rc_style->bg_pixmap_name[state]);
rc_style->bg_pixmap_name[state] = pixmap_file; rc_style->bg_pixmap_name[state] = pixmap_file;
} }
@ -4051,7 +4047,6 @@ gtk_rc_parse_im_module_file (GScanner *scanner)
if (token != G_TOKEN_STRING) if (token != G_TOKEN_STRING)
return G_TOKEN_STRING; return G_TOKEN_STRING;
if (im_module_file)
g_free (im_module_file); g_free (im_module_file);
im_module_file = g_strdup (scanner->value.v_string); im_module_file = g_strdup (scanner->value.v_string);

View File

@ -128,7 +128,6 @@ gtk_recent_filter_finalize (GObject *object)
{ {
GtkRecentFilter *filter = GTK_RECENT_FILTER (object); GtkRecentFilter *filter = GTK_RECENT_FILTER (object);
if (filter->name)
g_free (filter->name); g_free (filter->name);
if (filter->rules) if (filter->rules)
@ -202,7 +201,6 @@ gtk_recent_filter_set_name (GtkRecentFilter *filter,
{ {
g_return_if_fail (GTK_IS_RECENT_FILTER (filter)); g_return_if_fail (GTK_IS_RECENT_FILTER (filter));
if (filter->name)
g_free (filter->name); g_free (filter->name);
if (name) if (name)

View File

@ -360,7 +360,6 @@ gtk_recent_manager_finalize (GObject *object)
if (priv->poll_timeout) if (priv->poll_timeout)
g_source_remove (priv->poll_timeout); g_source_remove (priv->poll_timeout);
if (priv->filename)
g_free (priv->filename); g_free (priv->filename);
if (priv->recent_items) if (priv->recent_items)
@ -1737,10 +1736,8 @@ recent_app_info_free (RecentAppInfo *app_info)
if (!app_info) if (!app_info)
return; return;
if (app_info->name)
g_free (app_info->name); g_free (app_info->name);
if (app_info->exec)
g_free (app_info->exec); g_free (app_info->exec);
g_free (app_info); g_free (app_info);

View File

@ -1116,7 +1116,6 @@ gtk_selection_data_set (GtkSelectionData *selection_data,
const guchar *data, const guchar *data,
gint length) gint length)
{ {
if (selection_data->data)
g_free (selection_data->data); g_free (selection_data->data);
selection_data->type = type; selection_data->type = type;
@ -2933,7 +2932,6 @@ gtk_selection_data_free (GtkSelectionData *data)
{ {
g_return_if_fail (data != NULL); g_return_if_fail (data != NULL);
if (data->data)
g_free (data->data); g_free (data->data);
g_free (data); g_free (data);

View File

@ -1862,7 +1862,6 @@ settings_update_font_options (GtkSettings *settings)
hint_style = CAIRO_HINT_STYLE_FULL; hint_style = CAIRO_HINT_STYLE_FULL;
} }
if (hint_style_str)
g_free (hint_style_str); g_free (hint_style_str);
cairo_font_options_set_hint_style (options, hint_style); cairo_font_options_set_hint_style (options, hint_style);

View File

@ -940,7 +940,6 @@ gtk_text_insert (GtkText *text,
g_free (text->text.ch); g_free (text->text.ch);
text->text.wc = g_new (GdkWChar, INITIAL_BUFFER_SIZE); text->text.wc = g_new (GdkWChar, INITIAL_BUFFER_SIZE);
text->text_len = INITIAL_BUFFER_SIZE; text->text_len = INITIAL_BUFFER_SIZE;
if (text->scratch_buffer.ch)
g_free (text->scratch_buffer.ch); g_free (text->scratch_buffer.ch);
text->scratch_buffer.wc = NULL; text->scratch_buffer.wc = NULL;
text->scratch_buffer_len = 0; text->scratch_buffer_len = 0;
@ -1224,12 +1223,10 @@ gtk_text_finalize (GObject *object)
if (text->use_wchar) if (text->use_wchar)
{ {
if (text->scratch_buffer.wc)
g_free (text->scratch_buffer.wc); g_free (text->scratch_buffer.wc);
} }
else else
{ {
if (text->scratch_buffer.ch)
g_free (text->scratch_buffer.ch); g_free (text->scratch_buffer.ch);
} }

View File

@ -4318,7 +4318,6 @@ _gtk_text_buffer_get_line_log_attrs (GtkTextBuffer *buffer,
} }
/* Not in cache; open up the first cache entry */ /* Not in cache; open up the first cache entry */
if (cache->entries[ATTR_CACHE_SIZE-1].attrs)
g_free (cache->entries[ATTR_CACHE_SIZE-1].attrs); g_free (cache->entries[ATTR_CACHE_SIZE-1].attrs);
g_memmove (cache->entries + 1, cache->entries, g_memmove (cache->entries + 1, cache->entries,

View File

@ -1325,7 +1325,6 @@ gtk_text_iter_get_tags (const GtkTextIter *iter)
/* No tags, use default style */ /* No tags, use default style */
if (tags == NULL || tag_count == 0) if (tags == NULL || tag_count == 0)
{ {
if (tags)
g_free (tags); g_free (tags);
return NULL; return NULL;
@ -1743,7 +1742,6 @@ gtk_text_iter_get_attributes (const GtkTextIter *iter,
/* No tags, use default style */ /* No tags, use default style */
if (tags == NULL || tag_count == 0) if (tags == NULL || tag_count == 0)
{ {
if (tags)
g_free (tags); g_free (tags);
return FALSE; return FALSE;

View File

@ -537,7 +537,6 @@ gtk_text_layout_set_preedit_string (GtkTextLayout *layout,
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout)); g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
g_return_if_fail (preedit_attrs != NULL || preedit_string == NULL); g_return_if_fail (preedit_attrs != NULL || preedit_string == NULL);
if (layout->preedit_string)
g_free (layout->preedit_string); g_free (layout->preedit_string);
if (layout->preedit_attrs) if (layout->preedit_attrs)
@ -1087,7 +1086,6 @@ get_style (GtkTextLayout *layout,
gtk_text_attributes_ref (layout->default_style); gtk_text_attributes_ref (layout->default_style);
layout->one_style_cache = layout->default_style; layout->one_style_cache = layout->default_style;
if (tags)
g_free (tags); g_free (tags);
return layout->default_style; return layout->default_style;

View File

@ -3859,7 +3859,6 @@ internal_insert_element (GtkToolbar *toolbar,
content = toolbar_content_new_compatibility (toolbar, type, child_widget, content = toolbar_content_new_compatibility (toolbar, type, child_widget,
child_icon, child_label, position); child_icon, child_label, position);
if (free_me)
g_free (free_me); g_free (free_me);
return child_widget; return child_widget;

View File

@ -254,7 +254,6 @@ gtk_tool_item_finalize (GObject *object)
{ {
GtkToolItem *item = GTK_TOOL_ITEM (object); GtkToolItem *item = GTK_TOOL_ITEM (object);
if (item->priv->menu_item_id)
g_free (item->priv->menu_item_id); g_free (item->priv->menu_item_id);
if (item->priv->menu_item) if (item->priv->menu_item)
@ -1068,7 +1067,6 @@ gtk_tool_item_set_proxy_menu_item (GtkToolItem *tool_item,
g_return_if_fail (menu_item == NULL || GTK_IS_MENU_ITEM (menu_item)); g_return_if_fail (menu_item == NULL || GTK_IS_MENU_ITEM (menu_item));
g_return_if_fail (menu_item_id != NULL); g_return_if_fail (menu_item_id != NULL);
if (tool_item->priv->menu_item_id)
g_free (tool_item->priv->menu_item_id); g_free (tool_item->priv->menu_item_id);
tool_item->priv->menu_item_id = g_strdup (menu_item_id); tool_item->priv->menu_item_id = g_strdup (menu_item_id);

View File

@ -231,7 +231,6 @@ _gtk_tree_data_list_value_to_node (GtkTreeDataList *list,
list->data.v_double = g_value_get_double (value); list->data.v_double = g_value_get_double (value);
break; break;
case G_TYPE_STRING: case G_TYPE_STRING:
if (list->data.v_pointer)
g_free (list->data.v_pointer); g_free (list->data.v_pointer);
list->data.v_pointer = g_value_dup_string (value); list->data.v_pointer = g_value_dup_string (value);
break; break;

View File

@ -375,7 +375,6 @@ gtk_tree_model_filter_finalize (GObject *object)
if (filter->priv->root) if (filter->priv->root)
gtk_tree_model_filter_free_level (filter, filter->priv->root); gtk_tree_model_filter_free_level (filter, filter->priv->root);
if (filter->priv->modify_types)
g_free (filter->priv->modify_types); g_free (filter->priv->modify_types);
if (filter->priv->modify_destroy) if (filter->priv->modify_destroy)

View File

@ -7238,7 +7238,6 @@ gtk_widget_finalize (GObject *object)
g_object_unref (widget->style); g_object_unref (widget->style);
widget->style = NULL; widget->style = NULL;
if (widget->name)
g_free (widget->name); g_free (widget->name);
aux_info =_gtk_widget_get_aux_info (widget, FALSE); aux_info =_gtk_widget_get_aux_info (widget, FALSE);

View File

@ -523,7 +523,6 @@ maybe_cache_image_data (Image *image,
image->image_data = idata; image->image_data = idata;
if (path2)
g_free (path2); g_free (path2);
} }
} }
@ -572,7 +571,6 @@ maybe_cache_icon_data (Image *image,
image->icon_data = idata; image->icon_data = idata;
if (path2)
g_free (path2); g_free (path2);
} }
} }

View File

@ -375,7 +375,6 @@ theme_parse_detail(GScanner * scanner,
if (token != G_TOKEN_STRING) if (token != G_TOKEN_STRING)
return G_TOKEN_STRING; return G_TOKEN_STRING;
if (data->match_data.detail)
g_free (data->match_data.detail); g_free (data->match_data.detail);
data->match_data.detail = g_strdup(scanner->value.v_string); data->match_data.detail = g_strdup(scanner->value.v_string);
@ -622,7 +621,6 @@ theme_image_unref (ThemeImage *data)
data->refcount--; data->refcount--;
if (data->refcount == 0) if (data->refcount == 0)
{ {
if (data->match_data.detail)
g_free (data->match_data.detail); g_free (data->match_data.detail);
if (data->background) if (data->background)
theme_pixbuf_destroy (data->background); theme_pixbuf_destroy (data->background);

View File

@ -487,7 +487,6 @@ theme_pixbuf_set_filename (ThemePixbuf *theme_pb,
theme_pb->pixbuf = NULL; theme_pb->pixbuf = NULL;
} }
if (theme_pb->filename)
g_free (theme_pb->filename); g_free (theme_pb->filename);
if (filename) if (filename)

View File

@ -1159,7 +1159,6 @@ preedit_draw_callback (XIC xic,
context->preedit_length += diff; context->preedit_length += diff;
if (new_text)
g_free (new_text); g_free (new_text);
if (!context->finalizing) if (!context->finalizing)

View File

@ -613,7 +613,6 @@ cups_dispatch_watch_finalize (GSource *source)
dispatch->backend = NULL; dispatch->backend = NULL;
} }
if (dispatch->data_poll != NULL)
g_free (dispatch->data_poll); g_free (dispatch->data_poll);
} }

View File

@ -39,7 +39,6 @@ get_screen_response (GtkDialog *dialog,
{ {
if (response_id == GTK_RESPONSE_DELETE_EVENT) if (response_id == GTK_RESPONSE_DELETE_EVENT)
return; return;
if (screen2_name)
g_free (screen2_name); g_free (screen2_name);
screen2_name = g_strdup (gtk_entry_get_text (entry)); screen2_name = g_strdup (gtk_entry_get_text (entry));
} }