add new function

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@647 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-03-15 19:31:02 +00:00
parent b4a29a9aca
commit c1479157b3
2 changed files with 42 additions and 0 deletions

View File

@ -235,4 +235,43 @@ xaccTableResizeUserData (Table * table, int new_virt_rows, int new_virt_cols)
} }
} }
/* ==================================================== */
void
xaccAddCursor (Table *table, CellBlock *curs)
{
CellBlock **old_arr;
size_t ncurs = 0;
/* count the old number of entries */
if (table->cursors) {
CellBlock *tmp = table->cursors[0];
while (tmp) {
ncurs ++;
tmp = table->cursors[ncurs];
}
}
old_arr = table->cursors;
/* malloc the list of new handlers */
table->cursors = (CellBlock **) malloc ((ncurs+2) * sizeof (CellBlock *));
/* copy the old array to the new array */
ncurs = 0;
if (old_arr) {
CellBlock *tmp = old_arr[0];
while (tmp) {
table->cursors[ncurs] = tmp;
ncurs ++;
tmp = old_arr[ncurs];
}
}
/* append the new cursor to the list */
table->cursors[ncurs] = curs;
table->cursors[ncurs+1] = NULL;
free (old_arr);
}
/* ================== end of file ======================= */ /* ================== end of file ======================= */

View File

@ -47,6 +47,9 @@ xaccTableResizeStringArr (Table * table, int num_phys_rows, int num_phys_cols);
extern void extern void
xaccTableResizeUserData (Table * table, int new_virt_rows, int new_virt_cols); xaccTableResizeUserData (Table * table, int new_virt_rows, int new_virt_cols);
extern void
xaccAddCursor (Table *table, CellBlock *curs);
#endif /* __XACC_TABLE_ALLGUI_H__ */ #endif /* __XACC_TABLE_ALLGUI_H__ */
/* ================== end of file ======================= */ /* ================== end of file ======================= */