static void TextRowList_Destroy( TextRowList list ) { int row; for( row=0; row<list->length; ++row ) { TextRow_Destroy( list->rows[row] ); list->rows[row] = NULL; } list->length = 0; if( list->rows ) { free( list->rows ); } list->rows = NULL; }
/** 从文本行列表中删除指定文本行 */ static int TextRowList_RemoveRow( TextRowList *p_rowlist, int row ) { if( row < 0 || row >= p_rowlist->rows ) { return -1; } for( ; row < p_rowlist->rows-1; ++row ) { p_rowlist->rowdata[row] = p_rowlist->rowdata[row+1]; } TextRow_Destroy( p_rowlist->rowdata[row] ); p_rowlist->rowdata[row] = NULL; --p_rowlist->rows; return 0; }
static void TextRowList_Destroy( TextRowList *list ) { int row; for( row=0; row<list->rows; ++row ) { TextRow_Destroy( list->rowdata[row] ); list->rowdata[row] = NULL; } list->max_rows = 0; list->rows = 0; if( list->rowdata ) { free( list->rowdata ); } list->rowdata = NULL; }
/** 从文本行列表中删除指定文本行 */ static int TextRowList_RemoveRow( TextRowList rowlist, int i_row ) { if( i_row < 0 || i_row >= rowlist->length ) { return -1; } TextRow_Destroy( rowlist->rows[i_row] ); free( rowlist->rows[i_row] ); for( ; i_row < rowlist->length - 1; ++i_row ) { rowlist->rows[i_row] = rowlist->rows[i_row + 1]; } rowlist->rows[i_row] = NULL; --rowlist->length; return 0; }