Commit e4904df8 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Fix lots of silly leaks

2001-04-19  Jody Goldberg <jgoldberg@home.com>

	* src/embeddable-grid.c (embeddable_grid_init_anon) :  fix leak.

	* src/workbook.c (workbook_sheet_rename) : fix error message.
	(workbook_sheets) : constness.
	(workbook_sheet_count) : ditto.
	(workbook_sheet_index_get) : ditto.
parent 02adb706
2001-04-19 Jody Goldberg <jgoldberg@home.com>
* src/embeddable-grid.c (embeddable_grid_init_anon) : fix leak.
* src/workbook.c (workbook_sheet_rename) : fix error message.
(workbook_sheets) : constness.
(workbook_sheet_count) : ditto.
(workbook_sheet_index_get) : ditto.
2001-04-18 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_set_expr) : clear old span when an
......
2001-04-19 Jody Goldberg <jgoldberg@home.com>
* src/embeddable-grid.c (embeddable_grid_init_anon) : fix leak.
* src/workbook.c (workbook_sheet_rename) : fix error message.
(workbook_sheets) : constness.
(workbook_sheet_count) : ditto.
(workbook_sheet_index_get) : ditto.
2001-04-18 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_set_expr) : clear old span when an
......
2001-04-19 Jody Goldberg <jgoldberg@home.com>
* src/embeddable-grid.c (embeddable_grid_init_anon) : fix leak.
* src/workbook.c (workbook_sheet_rename) : fix error message.
(workbook_sheets) : constness.
(workbook_sheet_count) : ditto.
(workbook_sheet_index_get) : ditto.
2001-04-18 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_set_expr) : clear old span when an
......
2001-04-19 Jody Goldberg <jgoldberg@home.com>
* src/embeddable-grid.c (embeddable_grid_init_anon) : fix leak.
* src/workbook.c (workbook_sheet_rename) : fix error message.
(workbook_sheets) : constness.
(workbook_sheet_count) : ditto.
(workbook_sheet_index_get) : ditto.
2001-04-18 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_set_expr) : clear old span when an
......
2001-04-19 Jody Goldberg <jgoldberg@home.com>
* src/embeddable-grid.c (embeddable_grid_init_anon) : fix leak.
* src/workbook.c (workbook_sheet_rename) : fix error message.
(workbook_sheets) : constness.
(workbook_sheet_count) : ditto.
(workbook_sheet_index_get) : ditto.
2001-04-18 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_set_expr) : clear old span when an
......
2001-04-19 Jody Goldberg <jgoldberg@home.com>
* dif.c (dif_file_save) : fix leak. Why do we only save the first
sheet ?
2001-03-17 Jody Goldberg <jgoldberg@home.com>
* Release 0.64
......
......@@ -342,6 +342,7 @@ dif_file_save (FileSaver const *fs, IOContext *io_context,
*/
sheet_list = workbook_sheets (wb);
/* FIXME : Why not a loop ? */
if (sheet_list) {
Sheet *sheet = sheet_list->data;
Range r = sheet_get_extent (sheet);
......@@ -374,9 +375,8 @@ dif_file_save (FileSaver const *fs, IOContext *io_context,
}
}
sheet_list = sheet_list->next;
}
g_list_free (sheet_list);
fputs ("-1,0\nEOD\n", f);
......
2001-04-19 Jody Goldberg <jgoldberg@home.com>
* ms-excel-write.c (write_window2) : sigh, when fixing the sizes I did
not change the offsets. I miss C++ in situations like this.
(ms_excel_check_write) : Free the sheet list.
2001-04-18 Jody Goldberg <jgoldberg@home.com>
* ms-excel-util.c (excel_iconv_win_codepage) : cleanup and remove
......
......@@ -401,17 +401,17 @@ write_window2 (BiffPut *bp, MsBiffVersion ver, ExcelSheet *sheet)
MS_OLE_SET_GUINT16 (data + 0, options);
MS_OLE_SET_GUINT16 (data + 2, 0x0); /* top row */
MS_OLE_SET_GUINT16 (data + 4, 0x0); /* left col */
MS_OLE_SET_GUINT32 (data + 8, 0x0); /* grid color index */
MS_OLE_SET_GUINT32 (data + 6, 0x0); /* grid color index */
} else {
data = ms_biff_put_len_next (bp, BIFF_WINDOW2, 18);
MS_OLE_SET_GUINT16 (data + 0, options);
MS_OLE_SET_GUINT16 (data + 2, 0x0); /* top row */
MS_OLE_SET_GUINT16 (data + 4, 0x0); /* left col */
MS_OLE_SET_GUINT32 (data + 8, 0x0); /* grid color index */
MS_OLE_SET_GUINT32 (data + 6, 0x0); /* grid color index */
MS_OLE_SET_GUINT16 (data + 10, 0x1); /* print preview 100% */
MS_OLE_SET_GUINT16 (data + 12, 0x0); /* FIXME : why 0? */
MS_OLE_SET_GUINT32 (data + 16, 0x0); /* reserved 0 */
MS_OLE_SET_GUINT32 (data + 14, 0x0); /* reserved 0 */
}
ms_biff_put_commit (bp);
}
......@@ -3541,7 +3541,7 @@ ms_excel_check_write (IOContext *context, void **state, WorkbookView *gwb_view,
{
int ret = 0;
ExcelWorkbook *wb = g_new (ExcelWorkbook, 1);
GList *sheets;
GList *sheets, *ptr;
g_return_val_if_fail (wb != NULL, -1);
g_return_val_if_fail (ver >= MS_BIFF_V7, -1);
......@@ -3559,17 +3559,17 @@ ms_excel_check_write (IOContext *context, void **state, WorkbookView *gwb_view,
xf_init (wb);
sheets = workbook_sheets (wb->gnum_wb);
while (sheets) {
ExcelSheet *sheet = new_sheet (wb, sheets->data);
for (ptr = sheets ; ptr != NULL ; ptr = ptr->next) {
ExcelSheet *sheet = new_sheet (wb, ptr->data);
g_ptr_array_add (wb->sheets, sheet);
if ((ret = check_sheet (context, sheet)) != 0)
goto cleanup;
sheets = g_list_next (sheets);
}
ret = pre_pass (context, wb);
cleanup:
g_list_free (sheets);
if (ret != 0) {
free_workbook (wb);
*state = NULL;
......
......@@ -83,6 +83,7 @@ excel_gb_worksheets_enumerate (GBRunEvalContext *ec,
ret = g_slist_prepend (ret, e);
}
g_list_free (sheets);
return g_slist_reverse (ret);
}
......
2001-04-19 Jody Goldberg <jgoldberg@home.com>
* roff.c (write_wb_roff) : fix leak.
* latex.c (latex_file_save) : ditto.
(latex2e_file_save) : ditto.
* html.c (html32_file_save) : Ditto.
(html40_file_save) : Ditto.
2001-03-17 Jody Goldberg <jgoldberg@home.com>
* Release 0.64
......
......@@ -216,7 +216,7 @@ html32_file_save (FileSaver const *fs, IOContext *io_context,
WorkbookView *wb_view, const gchar *file_name)
{
FILE *fp;
GList *sheet_list;
GList *sheets, *ptr;
Cell *cell;
MStyle *style;
int row, col;
......@@ -249,9 +249,9 @@ html32_file_save (FileSaver const *fs, IOContext *io_context,
fprintf (fp, "}\n");
fprintf (fp, "--></STYLE>\n");
fprintf (fp, "</HEAD>\n<BODY>\n");
sheet_list = workbook_sheets (wb);
while (sheet_list) {
Sheet *sheet = sheet_list->data;
sheets = workbook_sheets (wb);
for (ptr = sheets ; ptr != NULL ; ptr = ptr->next) {
Sheet *sheet = ptr->data;
Range r = sheet_get_extent (sheet);
fprintf (fp, "<TABLE border=1>\n");
......@@ -268,8 +268,8 @@ html32_file_save (FileSaver const *fs, IOContext *io_context,
fprintf (fp, "</TR>\n");
}
fprintf (fp, "</TABLE>\n<P>\n\n");
sheet_list = sheet_list->next;
}
g_list_free (sheets);
fprintf (fp, "<BODY>\n</HTML>\n");
fclose (fp);
}
......@@ -284,7 +284,7 @@ html40_file_save (FileSaver const *fs, IOContext *io_context,
WorkbookView *wb_view, const gchar *file_name)
{
FILE *fp;
GList *sheet_list;
GList *sheets, *ptr;
Cell *cell;
MStyle *style;
int row, col;
......@@ -318,9 +318,9 @@ html40_file_save (FileSaver const *fs, IOContext *io_context,
fprintf (fp, "}\n");
fprintf (fp, "--></STYLE>\n");
fprintf (fp, "</HEAD>\n<BODY>\n");
sheet_list = workbook_sheets (wb);
while (sheet_list) {
Sheet *sheet = sheet_list->data;
sheets = workbook_sheets (wb);
for (ptr = sheets ; ptr != NULL ; ptr = ptr->next) {
Sheet *sheet = ptr->data;
Range r = sheet_get_extent (sheet);
fprintf (fp, "<TABLE border=1>\n");
......@@ -337,8 +337,8 @@ html40_file_save (FileSaver const *fs, IOContext *io_context,
fprintf (fp, "</TR>\n");
}
fprintf (fp, "</TABLE>\n<P>\n\n");
sheet_list = sheet_list->next;
}
g_list_free (sheets);
fprintf (fp, "<BODY>\n</HTML>\n");
fclose (fp);
}
......
......@@ -216,7 +216,7 @@ html32_file_save (FileSaver const *fs, IOContext *io_context,
WorkbookView *wb_view, const gchar *file_name)
{
FILE *fp;
GList *sheet_list;
GList *sheets, *ptr;
Cell *cell;
MStyle *style;
int row, col;
......@@ -249,9 +249,9 @@ html32_file_save (FileSaver const *fs, IOContext *io_context,
fprintf (fp, "}\n");
fprintf (fp, "--></STYLE>\n");
fprintf (fp, "</HEAD>\n<BODY>\n");
sheet_list = workbook_sheets (wb);
while (sheet_list) {
Sheet *sheet = sheet_list->data;
sheets = workbook_sheets (wb);
for (ptr = sheets ; ptr != NULL ; ptr = ptr->next) {
Sheet *sheet = ptr->data;
Range r = sheet_get_extent (sheet);
fprintf (fp, "<TABLE border=1>\n");
......@@ -268,8 +268,8 @@ html32_file_save (FileSaver const *fs, IOContext *io_context,
fprintf (fp, "</TR>\n");
}
fprintf (fp, "</TABLE>\n<P>\n\n");
sheet_list = sheet_list->next;
}
g_list_free (sheets);
fprintf (fp, "<BODY>\n</HTML>\n");
fclose (fp);
}
......@@ -284,7 +284,7 @@ html40_file_save (FileSaver const *fs, IOContext *io_context,
WorkbookView *wb_view, const gchar *file_name)
{
FILE *fp;
GList *sheet_list;
GList *sheets, *ptr;
Cell *cell;
MStyle *style;
int row, col;
......@@ -318,9 +318,9 @@ html40_file_save (FileSaver const *fs, IOContext *io_context,
fprintf (fp, "}\n");
fprintf (fp, "--></STYLE>\n");
fprintf (fp, "</HEAD>\n<BODY>\n");
sheet_list = workbook_sheets (wb);
while (sheet_list) {
Sheet *sheet = sheet_list->data;
sheets = workbook_sheets (wb);
for (ptr = sheets ; ptr != NULL ; ptr = ptr->next) {
Sheet *sheet = ptr->data;
Range r = sheet_get_extent (sheet);
fprintf (fp, "<TABLE border=1>\n");
......@@ -337,8 +337,8 @@ html40_file_save (FileSaver const *fs, IOContext *io_context,
fprintf (fp, "</TR>\n");
}
fprintf (fp, "</TABLE>\n<P>\n\n");
sheet_list = sheet_list->next;
}
g_list_free (sheets);
fprintf (fp, "<BODY>\n</HTML>\n");
fclose (fp);
}
......
......@@ -88,7 +88,7 @@ latex_file_save (FileSaver const *fs, IOContext *io_context,
WorkbookView *wb_view, const gchar *file_name)
{
FILE *fp;
GList *sheet_list;
GList *sheets, *ptr;
Cell *cell;
int row, col;
Workbook *wb = wb_view_workbook (wb_view);
......@@ -107,9 +107,9 @@ latex_file_save (FileSaver const *fs, IOContext *io_context,
fprintf (fp, "\\oddsidemargin -0.54cm\n\\textwidth 17cm\n");
fprintf (fp, "\\parskip 1em\n");
fprintf (fp, "\\begin{document}\n\n");
sheet_list = workbook_sheets (wb);
while (sheet_list) {
Sheet *sheet = sheet_list->data;
sheets = workbook_sheets (wb);
for (ptr = sheets ; ptr != NULL ; ptr = ptr->next) {
Sheet *sheet = ptr->data;
Range r = sheet_get_extent (sheet);
latex_fputs (sheet->name_unquoted, fp);
......@@ -171,8 +171,8 @@ latex_file_save (FileSaver const *fs, IOContext *io_context,
fprintf (fp, "\\\\\\hline\n");
}
fprintf (fp, "\\end{tabular}\n\n");
sheet_list = sheet_list->next;
}
g_list_free (sheets);
fprintf (fp, "\\end{document}");
fclose (fp);
}
......@@ -185,7 +185,7 @@ latex2e_file_save (FileSaver const *fs, IOContext *io_context,
WorkbookView *wb_view, const gchar *file_name)
{
FILE *fp;
GList *sheet_list;
GList *sheets, *ptr;
Cell *cell;
int row, col;
unsigned char r,g,b;
......@@ -207,9 +207,9 @@ latex2e_file_save (FileSaver const *fs, IOContext *io_context,
fprintf (fp, "\t\\oddsidemargin -0.54cm\n\t\\textwidth 17cm\n");
fprintf (fp, "\t\\parskip 1em\n");
fprintf (fp, "\\begin{document}\n\n");
sheet_list = workbook_sheets (wb);
while (sheet_list) {
Sheet *sheet = sheet_list->data;
sheets = workbook_sheets (wb);
for (ptr = sheets ; ptr != NULL ; ptr = ptr->next) {
Sheet *sheet = ptr->data;
Range range = sheet_get_extent (sheet);
latex_fputs (sheet->name_unquoted, fp);
......@@ -275,8 +275,8 @@ latex2e_file_save (FileSaver const *fs, IOContext *io_context,
fprintf (fp, "\\\\\\hline\n");
}
fprintf (fp, "\\end{tabular}\n\n");
sheet_list = sheet_list->next;
}
g_list_free (sheets);
fprintf (fp, "\\end{document}");
fclose (fp);
}
......@@ -78,7 +78,7 @@ roff_fprintf (FILE *fp, const Cell *cell)
static void
write_wb_roff (IOContext *io_context, WorkbookView *wb_view, FILE *fp)
{
GList *sheet_list;
GList *sheets, *ptr;
Cell *cell;
int row, col, fontsize, v_size;
Workbook *wb = wb_view_workbook (wb_view);
......@@ -87,9 +87,9 @@ write_wb_roff (IOContext *io_context, WorkbookView *wb_view, FILE *fp)
fprintf (fp, ".\\\" TROFF file\n");
fprintf (fp, ".fo ''%%''\n");
sheet_list = workbook_sheets (wb);
while (sheet_list) {
Sheet *sheet = sheet_list->data;
sheets = workbook_sheets (wb);
for (ptr = sheets ; ptr != NULL ; ptr = ptr->next) {
Sheet *sheet = ptr->data;
Range r = sheet_get_extent (sheet);
fprintf (fp, "%s\n\n", sheet->name_unquoted);
......@@ -174,8 +174,8 @@ write_wb_roff (IOContext *io_context, WorkbookView *wb_view, FILE *fp)
fprintf (fp, ".TH\n");
}
fprintf (fp, ".TE\n\n");
sheet_list = sheet_list->next;
}
g_list_free (sheets);
}
/*
......
2001-04-19 Jody Goldberg <jgoldberg@home.com>
* py-gnumeric.c (py_Workbook_get_sheets_method) : free the list of
sheets.
2001-03-31 Zbigniew Chyla <cyba@gnome.pl>
* py-gnumeric.c (destroy_python_interpreter): Fixed typo.
......
......@@ -1627,6 +1627,7 @@ py_Workbook_get_sheets_method (py_Workbook_object *self, PyObject *args)
g_assert (py_sheet);
(void) PyTuple_SetItem (py_sheets, i, py_sheet);
}
g_list_free (sheets);
return py_sheets;
}
......
......@@ -438,18 +438,22 @@
<submenu name="Outline" _label="_Group and Outline">
<menuitem name="DataOutlineHideDetail" verb=""
pixtype="stock" pixname="Gnumeric_HideDetail"
_label="_Hide Detail"
_tip="Collapse an outline group"/>
<menuitem name="DataOutlineShowDetail" verb=""
pixtype="stock" pixname="Gnumeric_ShowDetail"
_label="_Show Detail"
_tip="Uncollapse an outline group"/>
<menuitem name="DataOutlineAddGroup" verb=""
<menuitem name="DataOutlineGroup" verb=""
pixtype="stock" pixname="Gnumeric_Group"
_label="_Group"
_tip="Add an outline group"/>
<menuitem name="DataOutlineRemoveGroup" verb=""
<menuitem name="DataOutlineUnGroup" verb=""
pixtype="stock" pixname="Gnumeric_Ungroup"
_label="_Ungroup"
_tip="Remove an outline group"/>
......
2001-04-19 Jody Goldberg <jgoldberg@home.com>
* dialog-stf-export-sheet-page.c (stf_export_dialog_sheet_page_init) :
Free the list of sheets.
* dialog-sheet-order.c (populate_sheet_clist) : Ditto.
2001-04-18 Jon K Hellan <hellan@acm.org>
* dialog-define-names.c (name_guru_init): Remove commented out stuff.
......
......@@ -65,6 +65,7 @@ populate_sheet_clist (SheetManager *sm)
if (ptr->data == cur_sheet)
gtk_clist_select_row (clist, row, 0);
g_list_free (sheets);
gtk_clist_thaw (clist);
}
......
......@@ -260,7 +260,7 @@ StfE_SheetPageData_t*
stf_export_dialog_sheet_page_init (GladeXML *gui, Workbook *wb)
{
StfE_SheetPageData_t *data;
GList *sheet_list;
GList *sheets, *ptr;
g_return_val_if_fail (gui != NULL, NULL);
g_return_val_if_fail (wb != NULL, NULL);
......@@ -284,19 +284,17 @@ stf_export_dialog_sheet_page_init (GladeXML *gui, Workbook *wb)
data->sheet_run_avail_index = -1;
data->sheet_run_export_index = -1;
sheet_list = workbook_sheets (wb);
while (sheet_list) {
Sheet *sheet = sheet_list->data;
sheets = workbook_sheets (wb);
for (ptr = sheets ; ptr != NULL ; ptr = ptr->next) {
Sheet *sheet = ptr->data;
char *t[1];
int index;
t[0] = sheet->name_quoted;
index = gtk_clist_append (data->sheet_avail, t);
gtk_clist_set_row_data (data->sheet_avail, index, sheet);
sheet_list = sheet_list->next;
}
g_list_free (sheets);
/* Connect signals */
......
......@@ -95,10 +95,13 @@ embeddable_grid_init (GtkObject *object)
static void
embeddable_grid_init_anon (EmbeddableGrid *eg)
{
eg->workbook = workbook_new_with_sheets (1);
#if 0
/* What the hell is this trying to do ? */
GList *sheets;
eg->workbook = workbook_new_with_sheets (1);
sheets = workbook_sheets (eg->workbook);
#endif
}
EmbeddableGrid *
......
......@@ -66,9 +66,9 @@ Workbook *workbook_new_with_sheets (int sheet_count);
void workbook_unref (Workbook *wb);
/* Sheet support routines */
GList *workbook_sheets (Workbook *wb);
int workbook_sheet_count (Workbook *wb);
int workbook_sheet_index_get (Workbook *wb, Sheet const * sheet);
GList *workbook_sheets (Workbook const *wb);
int workbook_sheet_count (Workbook const *wb);
int workbook_sheet_index_get (Workbook const *wb, Sheet const * sheet);
Sheet *workbook_sheet_by_index (Workbook *wb, int i);
Sheet *workbook_sheet_by_name (Workbook *wb, const char *sheet_name);
void workbook_sheet_attach (Workbook *, Sheet *new_sheet,
......
......@@ -832,8 +832,12 @@ workbook_detach_view (WorkbookView *wbv)
/*****************************************************************************/
/**
* workbook_sheets : Get an ordered list of the sheets in the workbook
* The caller is required to free the list.
*/
GList *
workbook_sheets (Workbook *wb)
workbook_sheets (Workbook const *wb)
{
GList *list = NULL;
......@@ -850,7 +854,7 @@ workbook_sheets (Workbook *wb)
}
int
workbook_sheet_count (Workbook *wb)
workbook_sheet_count (Workbook const *wb)
{
g_return_val_if_fail (IS_WORKBOOK (wb), 0);
......@@ -858,7 +862,7 @@ workbook_sheet_count (Workbook *wb)
}
int
workbook_sheet_index_get (Workbook *wb, Sheet const * sheet)
workbook_sheet_index_get (Workbook const *wb, Sheet const * sheet)
{
int i;
......@@ -1156,7 +1160,7 @@ workbook_sheet_rename (WorkbookControl *wbc,
tmp = (Sheet *) g_hash_table_lookup (wb->sheet_hash_private, new_name);
if (tmp != NULL && tmp != sheet) {
gnumeric_error_invalid (COMMAND_CONTEXT (wbc),
_("There is already a sheet named '%s'"),
_("There is already a sheet named"),
new_name);
return TRUE;
}
......
......@@ -66,9 +66,9 @@ Workbook *workbook_new_with_sheets (int sheet_count);
void workbook_unref (Workbook *wb);
/* Sheet support routines */
GList *workbook_sheets (Workbook *wb);
int workbook_sheet_count (Workbook *wb);
int workbook_sheet_index_get (Workbook *wb, Sheet const * sheet);
GList *workbook_sheets (Workbook const *wb);
int workbook_sheet_count (Workbook const *wb);
int workbook_sheet_index_get (Workbook const *wb, Sheet const * sheet);
Sheet *workbook_sheet_by_index (Workbook *wb, int i);
Sheet *workbook_sheet_by_name (Workbook *wb, const char *sheet_name);
void workbook_sheet_attach (Workbook *, Sheet *new_sheet,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment