Re: [PATCH v2 7/8] libsmartcols/src/table_print.c: sort the list before printing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 11, 2014 at 02:20:37PM +0600, Shakur Shams Mullick wrote:
> +int comparison_func(struct list_head *a, struct list_head *b, void *data)
> +{
> +	struct libscols_column *cl;
> +	struct libscols_line *ra, *rb;
> +	struct libscols_cell *ca, *cb;
> +	
> +	cl = (struct libscols_column *)(data);
> +	
> +	ra = list_entry(a, struct libscols_line, ln_lines);
> +	rb = list_entry(b, struct libscols_line, ln_lines);
> +	
> +	ca = scols_line_get_cell(ra, cl->seqnum);
> +	cb = scols_line_get_cell(rb, cl->seqnum);
> +
> +	return cl->compar(ca, cb, NULL);
                             ^^^^^

 I guess that we need something like cl->compare_data.


> +		cl = scols_table_get_key_column(tb);

 Do we really need table->cl_key? Maybe it would be better to add

   scols_sort_table(tb, cl)

 and keep control of the sort column in the applications. It will 
 also allow to sort table by more columns.

    Karel


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux