Commit 97a7a11f authored by Morten Welinder's avatar Morten Welinder

compilation: avoid more NULL-checks before functions that handle NULL fine.

parent fc54b21f
......@@ -5690,7 +5690,7 @@ excel_read_AUTOFILTER (BiffQuery *q, ExcelReadSheet *esheet)
if (op1 == GNM_FILTER_UNUSED) {
cond = gnm_filter_condition_new_single (op0, v0);
if (v1 != NULL) value_release (v1); /* paranoia */
value_release (v1); /* paranoia */
} else {
/* NOTE : Docs are backwards */
cond = gnm_filter_condition_new_double (
......
......@@ -2666,8 +2666,7 @@ xlsx_cell_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
if (NULL == cell) {
xlsx_warning (xin, _("Invalid cell %s"),
cellpos_as_string (&state->pos));
if (NULL != state->val)
value_release (state->val);
value_release (state->val);
if (NULL != state->texpr)
gnm_expr_top_unref (state->texpr);
} else if (NULL != state->texpr) {
......@@ -5168,8 +5167,7 @@ xlsx_file_open (GOFileOpener const *fo, GOIOContext *context,
while (i-- > 0) {
entry = &g_array_index (state.sst, XLSXStr, i);
go_string_unref (entry->str);
if (NULL != entry->markup)
go_format_unref (entry->markup);
go_format_unref (entry->markup);
}
g_array_free (state.sst, TRUE);
}
......
......@@ -96,8 +96,7 @@ val_to_base (GnmFuncEvalInfo *ei,
(value_peek_string (value), NULL,
workbook_date_conv (ei->pos->sheet->workbook));
if (!vstring || !VALUE_IS_FLOAT (vstring)) {
if (vstring)
value_release (vstring);
value_release (vstring);
return value_new_error_VALUE (ei->pos);
}
} else {
......@@ -142,8 +141,7 @@ val_to_base (GnmFuncEvalInfo *ei,
char buf[GNM_MANT_DIG + 10];
char *err;
if (vstring)
value_release (vstring);
value_release (vstring);
if (val < min_value || val > max_value)
return value_new_error_NUM (ei->pos);
......
......@@ -334,7 +334,7 @@ get_linear_lookup_cache (GnmFuncEvalInfo *ei,
(GEqualFunc)gnm_float_equal);
if (!key_copy) key_copy = value_dup (key);
g_hash_table_insert (*cache, key_copy, h);
} else if (key_copy)
} else
value_release (key_copy);
return h;
......@@ -403,7 +403,7 @@ get_bisection_lookup_cache (GnmFuncEvalInfo *ei,
h = g_new0 (LookupBisectionCacheItem, 1);
if (!key_copy) key_copy = value_dup (key);
g_hash_table_insert (*cache, key_copy, h);
} else if (key_copy)
} else
value_release (key_copy);
return h;
......@@ -1124,8 +1124,7 @@ gnumeric_lookup (GnmFuncEvalInfo *ei, GnmValue const * const *args)
} else
result = value_new_error_NA (ei->pos);
if (xlookup)
value_release (xlookup);
value_release (xlookup);
return result;
}
......
......@@ -956,8 +956,7 @@ gnumeric_text (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
res = value_new_error_VALUE (ei->pos);
}
if (match != NULL)
value_release (match);
value_release (match);
return res;
}
......
......@@ -524,10 +524,8 @@ gnumeric_interpolation (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
g_slist_free (missing1);
g_free (vals0);
g_free (vals1);
for (i = 0; i < nb; i++) {
if (values[i])
value_release (values[i]);
}
for (i = 0; i < nb; i++)
value_release (values[i]);
return value_new_error_VALUE (ei->pos);
}
} else
......@@ -560,8 +558,7 @@ gnumeric_interpolation (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
if (n0 != n1 || n0 == 0 || n2 <= 0) {
res = value_new_error_std (ei->pos, GNM_ERROR_VALUE);
for (i = 0; i < nb; i++)
if (values[i])
value_release (values[i]);
value_release (values[i]);
} else {
if (missing0 || missing1) {
GSList *missing ;
......@@ -597,8 +594,7 @@ gnumeric_interpolation (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
if (!go_range_increasing (vals0, n0) || n2==0) {
res = value_new_error_std (ei->pos, GNM_ERROR_VALUE);
for (i = 0; i < nb; i++)
if (values[i])
value_release (values[i]);
value_release (values[i]);
g_free (values);
g_free (vals0);
g_free (vals1);
......@@ -624,8 +620,7 @@ gnumeric_interpolation (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
for( r = 0 ; r < nb; ++r)
res->v_array.vals[0][r] = value_new_error_std (ei->pos, GNM_ERROR_VALUE);
for (i = 0; i < nb; i++)
if (values[i])
value_release (values[i]);
value_release (values[i]);
}
}
g_free (values);
......
......@@ -1260,8 +1260,7 @@ oo_cell_start (GsfXMLIn *xin, xmlChar const **attrs)
state->pos.eval.row >= max_rows) {
if (texpr)
gnm_expr_top_unref (texpr);
if (val)
value_release (val);
value_release (val);
if (style)
gnm_style_unref (style);
return;
......@@ -3174,8 +3173,7 @@ oo_filter_cond (GsfXMLIn *xin, xmlChar const **attrs)
v->v_float.val);
break;
}
if (NULL != v)
value_release (v);
value_release (v);
if (NULL != cond)
gnm_filter_set_condition (state->filter, field_num, cond, FALSE);
}
......
......@@ -630,8 +630,7 @@ pln_parse_sheet (GsfInput *input, PlanPerfectImport *state)
gnm_conventions_default,
NULL);
if (texpr == NULL) {
if (v != NULL)
value_release (v);
value_release (v);
v = value_new_string_nocopy (expr_txt);
} else
g_free (expr_txt);
......
......@@ -58,10 +58,8 @@ gnm_cell_cleanout (GnmCell *cell)
cell->base.texpr = NULL;
}
if (cell->value != NULL) {
value_release (cell->value);
cell->value = NULL;
}
value_release (cell->value);
cell->value = NULL;
gnm_cell_unrender (cell);
......@@ -130,8 +128,7 @@ gnm_cell_assign_value (GnmCell *cell, GnmValue *v)
g_return_if_fail (cell);
g_return_if_fail (v);
if (cell->value != NULL)
value_release (cell->value);
value_release (cell->value);
cell->value = v;
}
......
......@@ -996,10 +996,9 @@ gnm_cell_copy_free (GnmCellCopy *cc)
gnm_expr_top_unref (cc->texpr);
cc->texpr = NULL;
}
if (cc->val) {
value_release (cc->val);
cc->val = NULL;
}
value_release (cc->val);
cc->val = NULL;
CHUNK_FREE (cell_copy_pool, cc);
}
......
......@@ -41,8 +41,7 @@ static void
single_floats_cache_entry_free (SingleFloatsCacheEntry *entry)
{
value_release (entry->value);
if (entry->error)
value_release (entry->error);
value_release (entry->error);
g_free (entry->data);
g_free (entry);
}
......@@ -419,7 +418,7 @@ collect_floats (int argc, GnmExprConstPtr const *argv,
ce->value = key;
ce->flags = keyflags;
ce->n = *n;
ce->error = *error ? value_dup (*error) : NULL;
ce->error = value_dup (*error);
if (cl.data == NULL)
ce->data = NULL;
else if (constp) {
......
......@@ -3955,7 +3955,7 @@ cmd_search_replace_do_cell (CmdSearchReplace *me, GnmEvalPos *ep,
*/
err = val && gnm_expr_char_start_p (cell_res.new_text);
if (val) value_release (val);
value_release (val);
if (texpr) gnm_expr_top_unref (texpr);
if (err) {
......
......@@ -1405,8 +1405,8 @@ ttest_update_sensitivity_cb (G_GNUC_UNUSED GtkWidget *dummy,
input_2_ready = ((state->base.input_entry_2 == NULL) || (input_range_2 != NULL));
output_ready = gnm_dao_is_ready (GNM_DAO (state->base.gdao));
if (input_range != NULL) value_release (input_range);
if (input_range_2 != NULL) value_release (input_range_2);
value_release (input_range);
value_release (input_range_2);
ready = input_1_ready && input_2_ready && output_ready && alpha_ready && mean_diff_ready;
gtk_widget_set_sensitive (state->base.ok_button, ready);
......@@ -1725,8 +1725,8 @@ ftest_update_sensitivity_cb (G_GNUC_UNUSED GtkWidget *dummy,
input_2_ready = ((state->base.input_entry_2 == NULL) || (input_range_2 != NULL));
output_ready = gnm_dao_is_ready (GNM_DAO (state->base.gdao));
if (input_range != NULL) value_release (input_range);
if (input_range_2 != NULL) value_release (input_range_2);
value_release (input_range);
value_release (input_range_2);
ready = input_1_ready && input_2_ready && output_ready && alpha_ready;
gtk_widget_set_sensitive (state->base.ok_button, ready);
......@@ -2155,10 +2155,8 @@ regression_tool_ok_clicked_cb (G_GNUC_UNUSED GtkWidget *button,
GTK_WIDGET (state->base.input_entry), text);
g_free (text);
if (data->base.range_1)
value_release (data->base.range_1);
if (data->base.range_2)
value_release (data->base.range_2);
value_release (data->base.range_1);
value_release (data->base.range_2);
g_free (dao);
g_free (data);
} else
......@@ -3508,8 +3506,7 @@ anova_two_factor_tool_ok_clicked_cb (G_GNUC_UNUSED GtkWidget *button,
g_free (text);
break;
}
if (data->input)
value_release (data->input);
value_release (data->input);
g_free (dao);
g_free (data);
} else
......
......@@ -389,8 +389,7 @@ translate_range (GnmValue *range, SortFlowState *state)
state->header = gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (state->cell_sort_header_check));
if (state->sel != NULL)
value_release (state->sel);
value_release (state->sel);
state->sel = range;
load_model_data(state);
}
......@@ -431,10 +430,8 @@ cb_update_sensitivity (SortFlowState *state)
static void
cb_dialog_destroy (SortFlowState *state)
{
if (state->sel) {
value_release (state->sel);
state->sel = NULL;
}
value_release (state->sel);
state->sel = NULL;
if (state->model != NULL)
g_object_unref (G_OBJECT (state->model));
......
......@@ -270,8 +270,7 @@ cb_dialog_destroy (GoalSeekState *state)
state->old_value = NULL;
}
if (state->old_value != NULL)
value_release (state->old_value);
value_release (state->old_value);
if (state->gui != NULL)
g_object_unref (G_OBJECT (state->gui));
......@@ -403,8 +402,7 @@ cb_dialog_apply_clicked (G_GNUC_UNUSED GtkWidget *button,
state->old_value = NULL;
}
state->old_cell = state->change_cell;
state->old_value = state->change_cell->value ?
value_dup (state->change_cell->value) : NULL;
state->old_value = value_dup (state->change_cell->value);
status = gnumeric_goal_seek (state);
......@@ -613,9 +611,7 @@ dialog_goal_seek_test (Sheet *sheet, const GnmRange *range)
state.set_cell = sheet_cell_fetch (sheet, c + 0, r);
state.change_cell = sheet_cell_fetch (sheet, c + 1, r);
state.old_value = state.change_cell->value
? value_dup (state.change_cell->value)
: NULL;
state.old_value = value_dup (state.change_cell->value);
cell = sheet_cell_fetch (sheet, c + 2, r);
state.target_value = value_get_as_float (cell->value);
......@@ -638,8 +634,7 @@ dialog_goal_seek_test (Sheet *sheet, const GnmRange *range)
value_new_error_VALUE (NULL));
}
if (state.old_value)
value_release (state.old_value);
value_release (state.old_value);
}
/**
......
......@@ -398,7 +398,7 @@ random_tool_update_sensitivity_cb (G_GNUC_UNUSED GtkWidget *dummy,
disc_prob_range = gnm_expr_entry_parse_as_value
(GNM_EXPR_ENTRY (state->par1_expr_entry), state->base.sheet);
ready = ready && disc_prob_range != NULL;
if (disc_prob_range != NULL) value_release (disc_prob_range);
value_release (disc_prob_range);
break;
case UniformIntDistribution:
ready = ready &&
......
......@@ -608,8 +608,7 @@ solver_add_scenario (SolverState *state, SolverResults *res, gchar const *name)
value_peek_string (gnm_solver_param_get_input (param)),
comment, state->sheet, &scenario);
scenario_add (state->sheet, scenario);
if (input_range != NULL)
value_release (input_range);
value_release (input_range);
}
/**
......
......@@ -492,8 +492,7 @@ gnm_expr_free (GnmExpr const *expr)
break;
case GNM_EXPR_OP_ARRAY_CORNER:
if (expr->array_corner.value)
value_release (expr->array_corner.value);
value_release (expr->array_corner.value);
gnm_expr_free (expr->array_corner.expr);
CHUNK_FREE (expression_pool_big, (gpointer)expr);
break;
......@@ -1008,8 +1007,7 @@ bin_array_iter_a (GnmEvalPos const *ep,
}
value_release (a);
if (b != NULL)
value_release (b);
value_release (b);
return iter_info.res;
}
......@@ -1041,8 +1039,7 @@ bin_array_iter_b (GnmEvalPos const *ep,
value_area_get_height (b, ep));
value_area_foreach (b, ep, CELL_ITER_ALL,
(GnmValueIterFunc) cb_implicit_iter_b_to_scalar_a, &iter_info);
if (a != NULL)
value_release (a);
value_release (a);
value_release (b);
return iter_info.res;
......@@ -1114,8 +1111,7 @@ cb_iter_percentage (GnmValueIter const *v_iter, GnmValue *res)
} else
tmp = value_new_error_VALUE (v_iter->ep);
if (conv != NULL)
value_release (conv);
value_release (conv);
}
res->v_array.vals[v_iter->x][v_iter->y] = tmp;
......@@ -1212,8 +1208,7 @@ gnm_expr_eval (GnmExpr const *expr, GnmEvalPos const *pos,
b = gnm_expr_eval (expr->binary.value_b, pos, flags);
if (b != NULL) {
if (VALUE_IS_ERROR (b)) {
if (a != NULL)
value_release (a);
value_release (a);
return b;
}
if (b->type == VALUE_CELLRANGE || b->type == VALUE_ARRAY)
......@@ -1223,10 +1218,8 @@ gnm_expr_eval (GnmExpr const *expr, GnmEvalPos const *pos,
}
res = bin_cmp (GNM_EXPR_GET_OPER (expr), value_compare (a, b, FALSE), pos);
if (a != NULL)
value_release (a);
if (b != NULL)
value_release (b);
value_release (a);
value_release (b);
return res;
case GNM_EXPR_OP_ADD:
......@@ -1372,8 +1365,7 @@ gnm_expr_eval (GnmExpr const *expr, GnmEvalPos const *pos,
b = gnm_expr_eval (expr->binary.value_b, pos, flags);
if (b != NULL) {
if (VALUE_IS_ERROR (b)) {
if (a != NULL)
value_release (a);
value_release (a);
return b;
}
if (b->type == VALUE_CELLRANGE || b->type == VALUE_ARRAY)
......@@ -1468,8 +1460,7 @@ gnm_expr_eval (GnmExpr const *expr, GnmEvalPos const *pos,
a = gnm_expr_eval (expr->array_corner.expr, &range_pos,
flags | GNM_EXPR_EVAL_PERMIT_NON_SCALAR);
if (expr->array_corner.value)
value_release (expr->array_corner.value);
value_release (expr->array_corner.value);
/* Store real result (cast away const)*/
((GnmExpr*)expr)->array_corner.value = a;
......
......@@ -326,8 +326,7 @@ gnumeric_if2 (GnmFuncEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
res = gnumeric_if (ei, (GnmValue const * const *)args);
for (i = 0; i <= 2; i++)
if (args[i])
value_release (args[i]);
value_release (args[i]);
return res;
}
......
......@@ -334,10 +334,8 @@ gnm_go_data_scalar_eval (GnmDependent *dep)
{
GnmGODataScalar *scalar = DEP_TO_SCALAR (dep);
if (scalar->val != NULL) {
value_release (scalar->val);
scalar->val = NULL;
}
value_release (scalar->val);
scalar->val = NULL;
g_free (scalar->val_str);
scalar->val_str = NULL;
go_data_emit_changed (GO_DATA (scalar));
......@@ -349,10 +347,8 @@ gnm_go_data_scalar_finalize (GObject *obj)
GnmGODataScalar *scalar = (GnmGODataScalar *)obj;
dependent_set_expr (&scalar->dep, NULL);
if (scalar->val != NULL) {
value_release (scalar->val);
scalar->val = NULL;
}
value_release (scalar->val);
scalar->val = NULL;
g_free (scalar->val_str);
scalar->val_str = NULL;
......@@ -446,10 +442,8 @@ gnm_go_data_vector_eval (GnmDependent *dep)
{
GnmGODataVector *vec = DEP_TO_VECTOR (dep);
if (vec->val != NULL) {
value_release (vec->val);
vec->val = NULL;
}
value_release (vec->val);
vec->val = NULL;
go_data_emit_changed (GO_DATA (vec));
}
......@@ -459,10 +453,8 @@ gnm_go_data_vector_finalize (GObject *obj)
GnmGODataVector *vec = (GnmGODataVector *)obj;
dependent_set_expr (&vec->dep, NULL);
if (vec->val != NULL) {
value_release (vec->val);
vec->val = NULL;
}
value_release (vec->val);
vec->val = NULL;
g_free (vec->base.values);
vec->base.values = NULL;
......@@ -801,10 +793,8 @@ gnm_go_data_matrix_eval (GnmDependent *dep)
{
GnmGODataMatrix *mat = DEP_TO_MATRIX (dep);
if (mat->val != NULL) {
value_release (mat->val);
mat->val = NULL;
}
value_release (mat->val);
mat->val = NULL;
go_data_emit_changed (GO_DATA (mat));
}
......@@ -814,10 +804,8 @@ gnm_go_data_matrix_finalize (GObject *obj)
GnmGODataMatrix *mat = (GnmGODataMatrix *)obj;
dependent_set_expr (&mat->dep, NULL);
if (mat->val != NULL) {
value_release (mat->val);
mat->val = NULL;
}
value_release (mat->val);
mat->val = NULL;
g_free (mat->base.values);
mat->base.values = NULL;
......
......@@ -355,10 +355,8 @@ preview_grid_dispose (GObject *obj)
gnm_style_unref (pg->defaults.style);
pg->defaults.style = NULL;
}
if (pg->defaults.value != NULL) {
value_release (pg->defaults.value);
pg->defaults.value = NULL;
}
value_release (pg->defaults.value);
pg->defaults.value = NULL;
if (pg->sheet) {
g_object_unref (pg->sheet);
......
......@@ -117,10 +117,8 @@ gnm_filter_condition_free (GnmFilterCondition *cond)
if (cond == NULL)
return;
if (cond->value[0] != NULL)
value_release (cond->value[0]);
if (cond->value[1] != NULL)
value_release (cond->value[1]);
value_release (cond->value[0]);
value_release (cond->value[1]);
g_free (cond);
}
......@@ -163,10 +161,10 @@ filter_expr_init (FilterExpr *fexpr, unsigned i,
static void
filter_expr_release (FilterExpr *fexpr, unsigned i)
{
if (fexpr->val[i] != NULL)
value_release (fexpr->val[i]);
else
if (fexpr->val[i] == NULL)
go_regfree (fexpr->regexp + i);
else
value_release (fexpr->val[i]);
}
static gboolean
......
......@@ -2460,9 +2460,8 @@ sheet_range_set_text (GnmParsePos const *pos, GnmRange const *r, char const *str
sheet_region_queue_recalc (pos->sheet, r);
if (closure.val)
value_release (closure.val);
else
value_release (closure.val);
if (closure.texpr)
gnm_expr_top_unref (closure.texpr);
sheet_flag_status_update_range (pos->sheet, r);
......
......@@ -817,8 +817,7 @@ analysis_tool_anova_two_factor_engine_clean (G_GNUC_UNUSED data_analysis_output_
{
analysis_tools_data_anova_two_factor_t *info = specs;
if (info->input)
value_release (info->input);
value_release (info->input);
info->input = NULL;
return FALSE;
......
......@@ -163,8 +163,7 @@ analysis_tool_chi_squared_clean (gpointer specs)
{
analysis_tools_data_chi_squared_t *info = specs;
if (info->input)
value_release (info->input);
value_release (info->input);
info->input = NULL;
return FALSE;
......
......@@ -667,10 +667,8 @@ analysis_tool_kaplan_meier_engine (data_analysis_output_t *dao, gpointer specs,
- info->base.range_1->v_range.cell.a.row + 3);
return FALSE;
case TOOL_ENGINE_CLEAN_UP:
if (info->range_3) {
value_release (info->range_3);
info->range_3 = NULL;
}
value_release (info->range_3);
info->range_3 = NULL;
g_slist_foreach (info->group_list, analysis_tool_kaplan_meier_clear_gl_cb, NULL);
g_slist_free (info->group_list);
info->group_list = NULL;
......
......@@ -3214,10 +3214,8 @@ analysis_tool_regression_engine_run (data_analysis_output_t *dao,
value_release (val_1);
value_release (val_2);
if (val_1_cp)
value_release (val_1_cp);
if (val_2_cp)
value_release (val_2_cp);
value_release (val_1_cp);
value_release (val_2_cp);
gnm_func_unref (fd_linest);
gnm_func_unref (fd_index);
......
......@@ -124,8 +124,7 @@ tool_random_cor_clean (gpointer specs)
{
tools_data_random_cor_t *info = specs;
if (info->matrix)
value_release (info->matrix);
value_release (info->matrix);
info->matrix = NULL;
return FALSE;
......
......@@ -67,8 +67,7 @@ tool_random_engine_run_discrete_clear_continuity (discrete_random_tool_local_t *
gint i;
for (i = 0; i < data->n; i++)
if (data->values[i])
value_release (data->values[i]);
value_release (data->values[i]);
g_free (data->cumul_p);
g_free (data->values);
g_free (data);
......
......@@ -570,10 +570,8 @@ value_release (GnmValue *value)
int x, y;
for (x = 0; x < v->x; x++) {
for (y = 0; y < v->y; y++) {
if (v->vals[x][y])
value_release (v->vals[x][y]);
}
for (y = 0; y < v->y; y++)
value_release (v->vals[x][y]);
g_free (v->vals[x]);
}
......@@ -1126,8 +1124,7 @@ value_array_set (GnmValue *array, int col, int row, GnmValue *v)
g_return_if_fail (array->v_array.y > row);
g_return_if_fail (array->v_array.x > col);
if (array->v_array.vals[col][row] != NULL)
value_release (array->v_array.vals[col][row]);
value_release (array->v_array.vals[col][row]);
array->v_array.vals[col][row] = v;
}
......
......@@ -138,10 +138,10 @@ wbcg_edit_finish (WBCGtk *wbcg, WBCEditResult result,
GnmValue *value = format_match (txt, fmt,
workbook_date_conv (sheet->workbook));
if (value != NULL)
value_release (value);
else
if (value == NULL)
expr_txt = gnm_expr_char_start_p (txt);
else
value_release (value);
/* NOTE : do not modify gnm_expr_char_start_p to exclude "-"
* it _can_ start an expression, which is required for rangesel
......
......@@ -828,7 +828,7 @@ gee_data_editor_set_format (GogDataEditor *deditor, GOFormat const *fmt)
g_free (txt);
}
if (v) value_release (v);
value_release (v);
}
static void
......
......@@ -62,22 +62,29 @@ my %exceptions =
if ($lineno >= 2 &&
($lines[-2] . $lines[-1]) =~
/^\s*if\s*\(\s*([^ ()]+)\s*(!=\s*NULL\s*)?\)\s*(g_free|g_list_free|g_slist_free|go_list_free_custom|go_slist_free_custom|go_format_unref)\s*\(\s*\1\s*\)\s*;/) {
print STDERR "$0: Checked $3 at $filename:$lineno\n";
/^\s*if\s*\(\s*(NULL\s*!=\s*)?([^ ()]+)\s*(!=\s*NULL\s*)?\)\s*(g_free|g_list_free|g_slist_free|go_list_free_custom|go_slist_free_custom|go_format_unref|value_release)\s*\(\s*\2\s*\)\s*;/) {
print STDERR "$0: Checked $4 at $filename:$lineno\n";
next LINE;
}
if ($lineno >= 4 &&
($lines[-4] . $lines[-3] . $lines[-2] . $lines[-1] ) =~
/^\s*if\s*\(\s*([^ ()]+)\s*(!=\s*NULL\s*)?\)\s*{\s*(g_free|g_list_free|g_slist_free|go_list_free_custom|go_slist_free_custom|go_format_unref)\s*\(\s*\1\s*\)\s*;\s*\1\s*=\s*(0|NULL)\s*;\s*}/) {
/^\s*if\s*\(\s*(NULL\s*!=\s*)?([^ ()]+)\s*(!=\s*NULL\s*)?\)\s*{\s*(g_free|g_list_free|g_slist_free|go_list_free_custom|go_slist_free_custom|go_format_unref|value_release)\s*\(\s*\2\s*\)\s*;\s*\2\s*=\s*(0|NULL)\s*;\s*}/) {
print STDERR "$0: Checked $4 at $filename:$lineno\n";
next LINE;
}
if ($lineno >= 3 &&
($lines[-3] . $lines[-2] . $lines[-1]) =~
/^[^\n]*([^ ()]+)(\s*!=\s*NULL)?\s*\?\s*(g_strdup|value_dup)\s*\(\s*\1\s*\)\s*:\s*NULL/) {
print STDERR "$0: Checked $3 at $filename:$lineno\n";
next LINE;
}
if ($lineno >= 3 &&
($lines[-3] . $lines[-2] . $lines[-1]) =~
/^[^\n]*([^ ()]+)\s*\?\s*g_strdup\s*\(\s*\1\s*\)\s*:\s*NULL/) {