Tim Foster wrote:

> I've updated the webrev at
> http://cr.opensolaris.org/~timf/1797-contents

Rather than buffering up all the contents lines to find whether there were
any, and then emitting them, you should probably just print the header in
the loop, and only once:

    printed_headers = False
    for line in sorted(lines, key=key_extract):
        text = create_output_format(...).rstrip()
        if not text:
            continue
        if not printed_headers and display_headers:
            print_headers()
            printed_headers = True
        msg(text)

    return printed_headers

It won't be noticeably slower, and should use a good bit less memory.

You could probably also use a testcase for 1797.

Danek
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to