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>
* 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(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_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_ldflags="$LDFLAGS"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -692,8 +692,7 @@ gdk_get_program_class (void)
void
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);
}

View File

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

View File

@ -526,8 +526,7 @@ gdk_rgb_free_info (GdkRgbInfo *image_info)
{
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)
gdk_rgb_cmap_free (image_info->gray_cmap);
@ -535,11 +534,9 @@ gdk_rgb_free_info (GdkRgbInfo *image_info)
if (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;
while (tmp_list)

View File

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

View File

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

View File

@ -195,7 +195,7 @@ void miAppendSpans(SpanGroup *spanGroup, SpanGroup *otherGroup, Spans *spans)
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)
@ -368,10 +368,8 @@ void miFillUniqueSpanGroup(GdkDrawable *pDraw, GdkGC *pGC, SpanGroup *spanGroup)
if (!yspans || !ysizes)
{
if (yspans)
g_free (yspans);
if (ysizes)
g_free (ysizes);
g_free (yspans);
g_free (ysizes);
miDisposeSpanGroup (spanGroup);
return;
}
@ -438,8 +436,7 @@ void miFillUniqueSpanGroup(GdkDrawable *pDraw, GdkGC *pGC, SpanGroup *spanGroup)
}
g_free (yspans);
g_free (ysizes);
if (points)
g_free (points);
g_free (points);
return;
}
count = 0;

View File

@ -251,8 +251,7 @@ _gdk_windowing_gc_copy (GdkGC *dst_gc,
dst_quartz_gc->cap_style = src_quartz_gc->cap_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,
sizeof (float) * src_quartz_gc->dash_count);
dst_quartz_gc->dash_count = src_quartz_gc->dash_count;

View File

@ -107,8 +107,7 @@ gdk_gc_win32_finalize (GObject *object)
if (win32_gc->values_mask & GDK_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);
}
@ -618,8 +617,7 @@ _gdk_windowing_gc_copy (GdkGC *dst_gc,
if (dst_win32_gc->font != NULL)
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;
if (dst_win32_gc->hcliprgn)

View File

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

View File

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

View File

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

View File

@ -194,8 +194,7 @@ gdk_window_impl_x11_finalize (GObject *object)
_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)
gdk_cursor_unref (window_impl->cursor);

View File

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

View File

@ -336,8 +336,7 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
priv->stock_size = g_value_get_uint (value);
break;
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);
break;
case PROP_ICON_NAME:

View File

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

View File

@ -2525,8 +2525,7 @@ set_cell_contents (GtkCList *clist,
!GTK_CLIST_AUTO_RESIZE_BLOCKED (clist))
column_auto_resize (clist, clist_row, column, requisition.width);
if (old_text)
g_free (old_text);
g_free (old_text);
if (old_pixmap)
gdk_pixmap_unref (old_pixmap);
if (old_mask)
@ -6324,8 +6323,7 @@ column_title_new (GtkCList *clist,
gint column,
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);
}
@ -6336,8 +6334,7 @@ columns_delete (GtkCList *clist)
gint 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);
}

View File

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

View File

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

View File

@ -350,8 +350,7 @@ gtk_curve_interpolate (GtkCurve *c, gint width, gint height)
if (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]));
}
@ -687,8 +686,7 @@ gtk_curve_set_curve_type (GtkCurve *c, GtkCurveType new_type)
}
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->ctlpoint = g_malloc (c->num_ctlpoints * sizeof (*c->ctlpoint));
@ -746,8 +744,7 @@ gtk_curve_size_graph (GtkCurve *curve)
static void
gtk_curve_reset_vector (GtkCurve *curve)
{
if (curve->ctlpoint)
g_free (curve->ctlpoint);
g_free (curve->ctlpoint);
curve->num_ctlpoints = 2;
curve->ctlpoint = g_malloc (2 * sizeof (curve->ctlpoint[0]));
@ -1030,10 +1027,8 @@ gtk_curve_finalize (GObject *object)
curve = GTK_CURVE (object);
if (curve->pixmap)
g_object_unref (curve->pixmap);
if (curve->point)
g_free (curve->point);
if (curve->ctlpoint)
g_free (curve->ctlpoint);
g_free (curve->point);
g_free (curve->ctlpoint);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

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

View File

@ -573,8 +573,7 @@ gtk_entry_completion_finalize (GObject *object)
if (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)
gtk_widget_destroy (priv->popup_window);
@ -1095,8 +1094,7 @@ gtk_entry_completion_complete (GtkEntryCompletion *completion)
if (!completion->priv->filter_model)
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)),
-1, G_NORMALIZE_ALL);

View File

@ -846,8 +846,7 @@ gtk_file_chooser_entry_changed (GtkEditable *editable)
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_pos = file_part_pos;

View File

@ -130,8 +130,7 @@ gtk_file_filter_finalize (GObject *object)
g_slist_foreach (filter->rules, (GFunc)filter_rule_free, NULL);
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);
}
@ -179,8 +178,7 @@ gtk_file_filter_set_name (GtkFileFilter *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);
}

View File

@ -2386,8 +2386,7 @@ gtk_file_selection_file_changed (GtkTreeSelection *selection,
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));
filename = get_real_filename (fs->last_selected, FALSE);
@ -2701,14 +2700,10 @@ cmpl_free_state (CompletionState* cmpl_state)
cmpl_free_dir_list (cmpl_state->directory_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);
if (cmpl_state->user_directories)
g_free (cmpl_state->user_directories);
if (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->user_dir_name_buffer);
g_free (cmpl_state->user_directories);
g_free (cmpl_state->the_completion.text);
g_free (cmpl_state->updated_text);
g_free (cmpl_state);
}
@ -3948,10 +3943,8 @@ get_pwdb (CompletionState* cmpl_state)
error:
if (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_dir_name_buffer);
g_free (cmpl_state->user_directories);
cmpl_state->user_dir_name_buffer = NULL;
cmpl_state->user_directories = NULL;

View File

@ -103,14 +103,10 @@ gtk_file_info_free (GtkFileInfo *info)
{
g_return_if_fail (info != NULL);
if (info->display_name)
g_free (info->display_name);
if (info->mime_type)
g_free (info->mime_type);
if (info->display_key)
g_free (info->display_key);
if (info->icon_name)
g_free (info->icon_name);
g_free (info->display_name);
g_free (info->mime_type);
g_free (info->display_key);
g_free (info->icon_name);
g_free (info);
}
@ -158,8 +154,7 @@ gtk_file_info_set_display_name (GtkFileInfo *info,
if (display_name == info->display_name)
return;
if (info->display_name)
g_free (info->display_name);
g_free (info->display_name);
if (info->display_key)
{
g_free (info->display_key);
@ -217,8 +212,7 @@ gtk_file_info_set_mime_type (GtkFileInfo *info,
{
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);
}
@ -264,8 +258,7 @@ gtk_file_info_set_icon_name (GtkFileInfo *info,
{
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);
}

View File

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

View File

@ -7017,8 +7017,7 @@ gtk_icon_view_item_accessible_action_set_description (AtkAction *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);

View File

@ -1894,8 +1894,7 @@ gtk_image_reset (GtkImage *image)
break;
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;
if (image->data.name.pixbuf)
g_object_unref (image->data.name.pixbuf);

View File

@ -1144,8 +1144,7 @@ button_data_free (ButtonData *button_data)
gtk_file_path_free (button_data->path);
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->button = NULL;

View File

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

View File

@ -273,8 +273,7 @@ gtk_progress_finalize (GObject *object)
if (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);
}

View File

@ -1166,14 +1166,12 @@ gtk_rc_style_finalize (GObject *object)
rc_style = GTK_RC_STYLE (object);
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)
pango_font_description_free (rc_style->font_desc);
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
* realized_style_ht
@ -3039,8 +3037,7 @@ gtk_rc_parse_style (GtkRcContext *context,
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]);
}
}
@ -3395,8 +3392,7 @@ gtk_rc_parse_bg_pixmap (GtkRcContext *context,
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;
}
@ -4051,8 +4047,7 @@ gtk_rc_parse_im_module_file (GScanner *scanner)
if (token != 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);

View File

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

View File

@ -360,8 +360,7 @@ gtk_recent_manager_finalize (GObject *object)
if (priv->poll_timeout)
g_source_remove (priv->poll_timeout);
if (priv->filename)
g_free (priv->filename);
g_free (priv->filename);
if (priv->recent_items)
g_bookmark_file_free (priv->recent_items);
@ -1737,11 +1736,9 @@ recent_app_info_free (RecentAppInfo *app_info)
if (!app_info)
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);
}

View File

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

View File

@ -1862,8 +1862,7 @@ settings_update_font_options (GtkSettings *settings)
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);

View File

@ -940,8 +940,7 @@ gtk_text_insert (GtkText *text,
g_free (text->text.ch);
text->text.wc = g_new (GdkWChar, 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_len = 0;
}
@ -1224,13 +1223,11 @@ gtk_text_finalize (GObject *object)
if (text->use_wchar)
{
if (text->scratch_buffer.wc)
g_free (text->scratch_buffer.wc);
g_free (text->scratch_buffer.wc);
}
else
{
if (text->scratch_buffer.ch)
g_free (text->scratch_buffer.ch);
g_free (text->scratch_buffer.ch);
}
g_list_free (text->tab_stops);

View File

@ -4318,8 +4318,7 @@ _gtk_text_buffer_get_line_log_attrs (GtkTextBuffer *buffer,
}
/* 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,
sizeof (CacheEntry) * (ATTR_CACHE_SIZE - 1));

View File

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

View File

@ -537,8 +537,7 @@ gtk_text_layout_set_preedit_string (GtkTextLayout *layout,
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
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)
pango_attr_list_unref (layout->preedit_attrs);
@ -1087,8 +1086,7 @@ get_style (GtkTextLayout *layout,
gtk_text_attributes_ref (layout->default_style);
layout->one_style_cache = layout->default_style;
if (tags)
g_free (tags);
g_free (tags);
return layout->default_style;
}

View File

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

View File

@ -254,8 +254,7 @@ gtk_tool_item_finalize (GObject *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)
g_object_unref (item->priv->menu_item);
@ -1068,8 +1067,7 @@ 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_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);

View File

@ -231,8 +231,7 @@ _gtk_tree_data_list_value_to_node (GtkTreeDataList *list,
list->data.v_double = g_value_get_double (value);
break;
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);
break;
case G_TYPE_OBJECT:

View File

@ -375,8 +375,7 @@ gtk_tree_model_filter_finalize (GObject *object)
if (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)
filter->priv->modify_destroy (filter->priv->modify_data);

View File

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

View File

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

View File

@ -375,8 +375,7 @@ theme_parse_detail(GScanner * scanner,
if (token != 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);
@ -622,8 +621,7 @@ theme_image_unref (ThemeImage *data)
data->refcount--;
if (data->refcount == 0)
{
if (data->match_data.detail)
g_free (data->match_data.detail);
g_free (data->match_data.detail);
if (data->background)
theme_pixbuf_destroy (data->background);
if (data->overlay)

View File

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

View File

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

View File

@ -613,8 +613,7 @@ cups_dispatch_watch_finalize (GSource *source)
dispatch->backend = NULL;
}
if (dispatch->data_poll != NULL)
g_free (dispatch->data_poll);
g_free (dispatch->data_poll);
}
static GSourceFuncs _cups_dispatch_watch_funcs = {

View File

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