Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
gnumeric
Commits
02cbd16d
Commit
02cbd16d
authored
May 03, 1999
by
Morten Welinder
Browse files
Plug a few leaks.
parent
e870ac3f
Changes
14
Hide whitespace changes
Inline
Side-by-side
ChangeLog-1999-07-09
View file @
02cbd16d
1999-05-03 Morten Welinder <terra@diku.dk>
* src/parser.y (v_new): Fix type.
(alloc_register): Ditto.
(dump_tree): Fix reference to variable cell.
* src/file.c (file_format_unregister_save): Fix leak.
(file_format_unregister_open): Fix leak.
* src/parser.y (forget): Fix leak.
* src/eval.c (add_tree_deps): Use OPER_ANY_BINARY.
(add_value_deps): Delete unused variable.
(dependency_remove_cell): Fix leak.
* src/sheet.c (sheet_destroy_styles): Leak fix. Late night
coding? :-)
(sheet_shift_row): Ditto.
* src/parser.y (alloc_clean): Ditto.
(alloc_list_free): Ditto.
* src/main.c (gnumeric_main): Get rid of memory leak debug code
(handled by other means now).
* src/cell.c (cell_set_value): Remove "const".
(cell_set_value_simple): Ditto.
1999-05-03 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-database.c: New file added for database
...
...
ChangeLog-2000-02-23
View file @
02cbd16d
1999-05-03 Morten Welinder <terra@diku.dk>
* src/parser.y (v_new): Fix type.
(alloc_register): Ditto.
(dump_tree): Fix reference to variable cell.
* src/file.c (file_format_unregister_save): Fix leak.
(file_format_unregister_open): Fix leak.
* src/parser.y (forget): Fix leak.
* src/eval.c (add_tree_deps): Use OPER_ANY_BINARY.
(add_value_deps): Delete unused variable.
(dependency_remove_cell): Fix leak.
* src/sheet.c (sheet_destroy_styles): Leak fix. Late night
coding? :-)
(sheet_shift_row): Ditto.
* src/parser.y (alloc_clean): Ditto.
(alloc_list_free): Ditto.
* src/main.c (gnumeric_main): Get rid of memory leak debug code
(handled by other means now).
* src/cell.c (cell_set_value): Remove "const".
(cell_set_value_simple): Ditto.
1999-05-03 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-database.c: New file added for database
...
...
OChangeLog-1999-07-09
View file @
02cbd16d
1999-05-03 Morten Welinder <terra@diku.dk>
* src/parser.y (v_new): Fix type.
(alloc_register): Ditto.
(dump_tree): Fix reference to variable cell.
* src/file.c (file_format_unregister_save): Fix leak.
(file_format_unregister_open): Fix leak.
* src/parser.y (forget): Fix leak.
* src/eval.c (add_tree_deps): Use OPER_ANY_BINARY.
(add_value_deps): Delete unused variable.
(dependency_remove_cell): Fix leak.
* src/sheet.c (sheet_destroy_styles): Leak fix. Late night
coding? :-)
(sheet_shift_row): Ditto.
* src/parser.y (alloc_clean): Ditto.
(alloc_list_free): Ditto.
* src/main.c (gnumeric_main): Get rid of memory leak debug code
(handled by other means now).
* src/cell.c (cell_set_value): Remove "const".
(cell_set_value_simple): Ditto.
1999-05-03 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-database.c: New file added for database
...
...
OChangeLog-2000-02-23
View file @
02cbd16d
1999-05-03 Morten Welinder <terra@diku.dk>
* src/parser.y (v_new): Fix type.
(alloc_register): Ditto.
(dump_tree): Fix reference to variable cell.
* src/file.c (file_format_unregister_save): Fix leak.
(file_format_unregister_open): Fix leak.
* src/parser.y (forget): Fix leak.
* src/eval.c (add_tree_deps): Use OPER_ANY_BINARY.
(add_value_deps): Delete unused variable.
(dependency_remove_cell): Fix leak.
* src/sheet.c (sheet_destroy_styles): Leak fix. Late night
coding? :-)
(sheet_shift_row): Ditto.
* src/parser.y (alloc_clean): Ditto.
(alloc_list_free): Ditto.
* src/main.c (gnumeric_main): Get rid of memory leak debug code
(handled by other means now).
* src/cell.c (cell_set_value): Remove "const".
(cell_set_value_simple): Ditto.
1999-05-03 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-database.c: New file added for database
...
...
src/Makefile.am
View file @
02cbd16d
...
...
@@ -72,6 +72,7 @@ GNUMERIC_BASE_SOURCES = \
formats.c
\
func.c
\
func.h
\
fn-database.c
\
fn-date.c
\
fn-eng.c
\
fn-financial.c
\
...
...
src/cell.c
View file @
02cbd16d
...
...
@@ -551,7 +551,7 @@ cell_render_value (Cell *cell)
* yourself.
*/
void
cell_set_value_simple
(
Cell
*
cell
,
const
Value
*
v
)
cell_set_value_simple
(
Cell
*
cell
,
Value
*
v
)
{
struct
lconv
*
lconv
;
...
...
@@ -584,7 +584,7 @@ cell_set_value_simple (Cell *cell, const Value *v)
* Changes the value of a cell
*/
void
cell_set_value
(
Cell
*
cell
,
const
Value
*
v
)
cell_set_value
(
Cell
*
cell
,
Value
*
v
)
{
g_return_if_fail
(
cell
);
g_return_if_fail
(
v
);
...
...
src/cell.h
View file @
02cbd16d
...
...
@@ -116,8 +116,8 @@ char *value_format (Value *value, StyleFormat *format, cha
void
cell_set_text
(
Cell
*
cell
,
const
char
*
text
);
void
cell_set_text_simple
(
Cell
*
cell
,
const
char
*
text
);
void
cell_set_value
(
Cell
*
cell
,
const
Value
*
v
);
void
cell_set_value_simple
(
Cell
*
cell
,
const
Value
*
v
);
void
cell_set_value
(
Cell
*
cell
,
Value
*
v
);
void
cell_set_value_simple
(
Cell
*
cell
,
Value
*
v
);
void
cell_content_changed
(
Cell
*
cell
);
void
cell_set_formula
(
Cell
*
cell
,
const
char
*
text
);
void
cell_set_formula_tree
(
Cell
*
cell
,
ExprTree
*
formula
);
...
...
src/dependent.c
View file @
02cbd16d
...
...
@@ -145,8 +145,6 @@ add_cell_range_deps (Cell *cell, const CellRef *a, const CellRef *b)
static
void
add_value_deps
(
Cell
*
cell
,
const
Value
*
value
)
{
GList
*
l
;
switch
(
value
->
type
){
case
VALUE_STRING
:
case
VALUE_INTEGER
:
...
...
@@ -184,22 +182,15 @@ add_tree_deps (Cell *cell, ExprTree *tree)
GList
*
l
;
switch
(
tree
->
oper
){
case
OPER_EQUAL
:
case
OPER_NOT_EQUAL
:
case
OPER_GT
:
case
OPER_GTE
:
case
OPER_LT
:
case
OPER_LTE
:
case
OPER_ADD
:
case
OPER_SUB
:
case
OPER_MULT
:
case
OPER_DIV
:
case
OPER_EXP
:
case
OPER_CONCAT
:
case
OPER_ANY_BINARY
:
add_tree_deps
(
cell
,
tree
->
u
.
binary
.
value_a
);
add_tree_deps
(
cell
,
tree
->
u
.
binary
.
value_b
);
return
;
case
OPER_ANY_UNARY
:
add_tree_deps
(
cell
,
tree
->
u
.
value
);
return
;
case
OPER_VAR
:
add_cell_range_deps
(
cell
,
...
...
@@ -216,10 +207,6 @@ add_tree_deps (Cell *cell, ExprTree *tree)
add_tree_deps
(
cell
,
l
->
data
);
return
;
case
OPER_NEG
:
add_tree_deps
(
cell
,
tree
->
u
.
value
);
return
;
}
/* switch */
}
...
...
@@ -233,7 +220,7 @@ cell_add_dependencies (Cell *cell)
{
g_return_if_fail
(
cell
!=
NULL
);
g_return_if_fail
(
cell
->
parsed_node
!=
NULL
);
if
(
!
dependency_hash
)
dependency_hash_init
();
...
...
@@ -259,7 +246,8 @@ dependency_remove_cell (gpointer key, gpointer value, gpointer the_cell)
return
;
range
->
cell_list
=
g_list_remove_link
(
range
->
cell_list
,
list
);
g_list_free_1
(
list
);
range
->
ref_count
--
;
if
(
range
->
ref_count
==
0
)
...
...
src/eval.c
View file @
02cbd16d
...
...
@@ -145,8 +145,6 @@ add_cell_range_deps (Cell *cell, const CellRef *a, const CellRef *b)
static
void
add_value_deps
(
Cell
*
cell
,
const
Value
*
value
)
{
GList
*
l
;
switch
(
value
->
type
){
case
VALUE_STRING
:
case
VALUE_INTEGER
:
...
...
@@ -184,22 +182,15 @@ add_tree_deps (Cell *cell, ExprTree *tree)
GList
*
l
;
switch
(
tree
->
oper
){
case
OPER_EQUAL
:
case
OPER_NOT_EQUAL
:
case
OPER_GT
:
case
OPER_GTE
:
case
OPER_LT
:
case
OPER_LTE
:
case
OPER_ADD
:
case
OPER_SUB
:
case
OPER_MULT
:
case
OPER_DIV
:
case
OPER_EXP
:
case
OPER_CONCAT
:
case
OPER_ANY_BINARY
:
add_tree_deps
(
cell
,
tree
->
u
.
binary
.
value_a
);
add_tree_deps
(
cell
,
tree
->
u
.
binary
.
value_b
);
return
;
case
OPER_ANY_UNARY
:
add_tree_deps
(
cell
,
tree
->
u
.
value
);
return
;
case
OPER_VAR
:
add_cell_range_deps
(
cell
,
...
...
@@ -216,10 +207,6 @@ add_tree_deps (Cell *cell, ExprTree *tree)
add_tree_deps
(
cell
,
l
->
data
);
return
;
case
OPER_NEG
:
add_tree_deps
(
cell
,
tree
->
u
.
value
);
return
;
}
/* switch */
}
...
...
@@ -233,7 +220,7 @@ cell_add_dependencies (Cell *cell)
{
g_return_if_fail
(
cell
!=
NULL
);
g_return_if_fail
(
cell
->
parsed_node
!=
NULL
);
if
(
!
dependency_hash
)
dependency_hash_init
();
...
...
@@ -259,7 +246,8 @@ dependency_remove_cell (gpointer key, gpointer value, gpointer the_cell)
return
;
range
->
cell_list
=
g_list_remove_link
(
range
->
cell_list
,
list
);
g_list_free_1
(
list
);
range
->
ref_count
--
;
if
(
range
->
ref_count
==
0
)
...
...
src/file.c
View file @
02cbd16d
...
...
@@ -69,6 +69,7 @@ file_format_unregister_open (FileFormatProbe probe, FileFormatOpen open)
if
(
fo
->
probe
==
probe
&&
fo
->
open
==
open
){
gnumeric_file_openers
=
g_list_remove_link
(
gnumeric_file_openers
,
l
);
g_list_free_1
(
l
);
return
;
}
}
...
...
@@ -115,6 +116,7 @@ file_format_unregister_save (FileFormatSave save)
current_saver
=
NULL
;
gnumeric_file_savers
=
g_list_remove_link
(
gnumeric_file_savers
,
l
);
g_list_free_1
(
l
);
return
;
}
}
...
...
src/libgnumeric.c
View file @
02cbd16d
...
...
@@ -42,51 +42,6 @@ const struct poptOption gnumeric_popt_options [] = {
{
NULL
,
'\0'
,
0
,
NULL
,
0
}
};
#define GLIB_MEMORY_HANDLING_IS_BROKEN
#ifdef GLIB_MEMORY_HANDLING_IS_BROKEN
static
void
expose_memory_leaks
(
void
)
{
fprintf
(
stderr
,
"Clearing GList nodes...
\n
"
);
{
GList
*
l
=
NULL
;
int
i
;
for
(
i
=
0
;
i
<
100000
;
i
++
)
g_list_prepend
(
l
,
0
);
g_list_free
(
l
);
}
fprintf
(
stderr
,
"Clearing GSList nodes...
\n
"
);
{
GSList
*
l
=
NULL
;
int
i
;
for
(
i
=
0
;
i
<
100000
;
i
++
)
g_slist_prepend
(
l
,
0
);
g_slist_free
(
l
);
}
fprintf
(
stderr
,
"Clearing GHashTable nodes...
\n
"
);
{
GHashTable
*
hash
;
int
i
;
const
int
count
=
100000
;
int
*
keys
;
keys
=
g_new
(
int
,
count
);
hash
=
g_hash_table_new
(
g_int_hash
,
g_int_equal
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
keys
[
i
]
=
i
;
g_hash_table_insert
(
hash
,
keys
+
i
,
0
);
}
g_hash_table_destroy
(
hash
);
g_free
(
keys
);
}
}
#endif
static
void
gnumeric_main
(
void
*
closure
,
int
argc
,
char
*
argv
[])
{
...
...
@@ -144,10 +99,6 @@ gnumeric_main (void *closure, int argc, char *argv [])
format_color_shutdown
();
gnome_config_drop_all
();
#ifdef GLIB_MEMORY_HANDLING_IS_BROKEN
expose_memory_leaks
();
#endif
}
#ifdef HAVE_GUILE
...
...
src/main.c
View file @
02cbd16d
...
...
@@ -42,51 +42,6 @@ const struct poptOption gnumeric_popt_options [] = {
{
NULL
,
'\0'
,
0
,
NULL
,
0
}
};
#define GLIB_MEMORY_HANDLING_IS_BROKEN
#ifdef GLIB_MEMORY_HANDLING_IS_BROKEN
static
void
expose_memory_leaks
(
void
)
{
fprintf
(
stderr
,
"Clearing GList nodes...
\n
"
);
{
GList
*
l
=
NULL
;
int
i
;
for
(
i
=
0
;
i
<
100000
;
i
++
)
g_list_prepend
(
l
,
0
);
g_list_free
(
l
);
}
fprintf
(
stderr
,
"Clearing GSList nodes...
\n
"
);
{
GSList
*
l
=
NULL
;
int
i
;
for
(
i
=
0
;
i
<
100000
;
i
++
)
g_slist_prepend
(
l
,
0
);
g_slist_free
(
l
);
}
fprintf
(
stderr
,
"Clearing GHashTable nodes...
\n
"
);
{
GHashTable
*
hash
;
int
i
;
const
int
count
=
100000
;
int
*
keys
;
keys
=
g_new
(
int
,
count
);
hash
=
g_hash_table_new
(
g_int_hash
,
g_int_equal
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
keys
[
i
]
=
i
;
g_hash_table_insert
(
hash
,
keys
+
i
,
0
);
}
g_hash_table_destroy
(
hash
);
g_free
(
keys
);
}
}
#endif
static
void
gnumeric_main
(
void
*
closure
,
int
argc
,
char
*
argv
[])
{
...
...
@@ -144,10 +99,6 @@ gnumeric_main (void *closure, int argc, char *argv [])
format_color_shutdown
();
gnome_config_drop_all
();
#ifdef GLIB_MEMORY_HANDLING_IS_BROKEN
expose_memory_leaks
();
#endif
}
#ifdef HAVE_GUILE
...
...
src/parser.y
View file @
02cbd16d
...
...
@@ -26,7 +26,7 @@ static void alloc_glist (GList *l);
static void forget_glist (GList *list);
static void forget_tree (ExprTree *tree);
static void alloc_list_free (void);
static
void
*v_new (void);
static
Value
*v_new (void);
#define ERROR -1
...
...
@@ -518,7 +518,7 @@ yyerror (char *s)
}
static void
alloc_register (
void
*a_info)
alloc_register (
AllocRec
*a_info)
{
alloc_list = g_list_prepend (alloc_list, a_info);
}
...
...
@@ -537,7 +537,7 @@ void *
alloc_buffer (int size)
{
AllocRec *a_info = g_new (AllocRec, 1);
char
*res = g_malloc (size);
void
*res = g_malloc (size);
a_info->type = ALLOC_BUFFER;
a_info->data = res;
...
...
@@ -546,11 +546,11 @@ alloc_buffer (int size)
return res;
}
static
void
*
static
Value
*
v_new (void)
{
AllocRec *a_info = g_new (AllocRec, 1);
char
*res = g_
malloc (sizeof
(Value
)
);
Value
*res = g_
new
(Value
, 1
);
a_info->type = ALLOC_VALUE;
a_info->data = res;
...
...
@@ -587,7 +587,7 @@ alloc_clean (void)
g_free (rec);
}
g_list_free (
l
);
g_list_free (
alloc_list
);
alloc_list = NULL;
}
...
...
@@ -599,7 +599,7 @@ alloc_list_free (void)
for (; l; l = l->next)
g_free (l->data);
g_list_free (
l
);
g_list_free (
alloc_list
);
alloc_list = NULL;
}
...
...
@@ -623,6 +623,7 @@ forget (AllocType type, void *data)
if (a_info->type == type && a_info->data == data){
alloc_list = g_list_remove_link (alloc_list, l);
g_list_free_1 (l);
return;
}
}
...
...
@@ -690,7 +691,7 @@ dump_tree (ExprTree *tree)
switch (tree->oper){
case OPER_VAR:
cr = &tree->u.
constant->v.cell
;
cr = &tree->u.
ref
;
printf ("Cell: %s%c%s%d\n",
cr->col_relative ? "" : "$",
cr->col + 'A',
...
...
src/sheet.c
View file @
02cbd16d
...
...
@@ -2207,7 +2207,8 @@ sheet_destroy_styles (Sheet *sheet)
style_destroy
(
sr
->
style
);
g_free
(
sr
);
}
g_list_free
(
l
);
g_list_free
(
sheet
->
style_list
);
sheet
->
style_list
=
NULL
;
}
static
void
...
...
@@ -2771,7 +2772,7 @@ colrow_closest_above (GList *l, int pos)
void
sheet_shift_row
(
Sheet
*
sheet
,
int
col
,
int
row
,
int
count
)
{
GList
*
cur_col
,
*
deps
,
*
l
,
*
cell_list
;
GList
*
cur_col
,
*
deps
,
*
l
,
*
l2
,
*
cell_list
;
int
col_count
,
new_column
;
g_return_if_fail
(
sheet
!=
NULL
);
...
...
@@ -2830,7 +2831,7 @@ sheet_shift_row (Sheet *sheet, int col, int row, int count)
/* Now relocate the cells */
l
=
g_list_nth
(
cell_list
,
g_list_length
(
cell_list
)
-
1
);
l
=
l2
=
g_list_nth
(
cell_list
,
g_list_length
(
cell_list
)
-
1
);
for
(;
l
;
l
=
l
->
prev
){
Cell
*
cell
=
l
->
data
;
...
...
@@ -2848,7 +2849,7 @@ sheet_shift_row (Sheet *sheet, int col, int row, int count)
sheet_cell_add
(
sheet
,
cell
,
new_column
,
row
);
cell_relocate
(
cell
,
count
,
0
);
}
g_list_free
(
l
);
g_list_free
(
l
2
);
/* Check the dependencies and recompute them */
deps
=
region_get_dependencies
(
sheet
,
col
,
row
,
SHEET_MAX_COLS
-
1
,
row
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment