/** * scols_unref_column: * @cl: a pointer to a struct libscols_column instance * * Decreases the refcount of @cl. */ void scols_unref_column(struct libscols_column *cl) { if (cl && --cl->refcount <= 0) { list_del(&cl->cl_columns); scols_reset_cell(&cl->header); free(cl->color); free(cl); } }
/** * scols_unref_column: * @cl: a pointer to a struct libscols_column instance * * Decreases the refcount of @cl. When the count falls to zero, the instance * is automatically deallocated. */ void scols_unref_column(struct libscols_column *cl) { if (cl && --cl->refcount <= 0) { DBG(COL, ul_debugobj(cl, "dealloc")); list_del(&cl->cl_columns); scols_reset_cell(&cl->header); free(cl->color); free(cl); } }
/** * scols_line_free_cells: * @ln: a pointer to a struct libscols_line instance * * Frees the allocated cells referenced to by @ln. */ void scols_line_free_cells(struct libscols_line *ln) { size_t i; if (!ln || !ln->cells) return; for (i = 0; i < ln->ncells; i++) scols_reset_cell(&ln->cells[i]); free(ln->cells); ln->ncells = 0; ln->cells = NULL; }
/** * scols_unref_table: * @tb: a pointer to a struct libscols_table instance * * Decreases the refcount of @tb. When the count falls to zero, the instance * is automatically deallocated. */ void scols_unref_table(struct libscols_table *tb) { if (tb && (--tb->refcount <= 0)) { DBG(TAB, ul_debugobj(tb, "dealloc")); scols_table_remove_lines(tb); scols_table_remove_columns(tb); scols_unref_symbols(tb->symbols); scols_reset_cell(&tb->title); free(tb->linesep); free(tb->colsep); free(tb->name); free(tb); } }
/** * scols_line_free_cells: * @ln: a pointer to a struct libscols_line instance * * Frees the allocated cells referenced to by @ln. */ void scols_line_free_cells(struct libscols_line *ln) { size_t i; if (!ln || !ln->cells) return; DBG(LINE, ul_debugobj(ln, "free cells")); for (i = 0; i < ln->ncells; i++) scols_reset_cell(&ln->cells[i]); free(ln->cells); ln->ncells = 0; ln->cells = NULL; }