[pacman-dev] [PATCH 2/2] cache terminal size, add SIGWINCH handler to reset
Allan McRae
allan at archlinux.org
Sat Jun 28 21:04:45 EDT 2014
On 28/06/14 12:44, Andrew Gregory wrote:
> On 06/24/14 at 04:32pm, Dave Reisner wrote:
>> Refactoring getcols, yet again. We do the following:
>>
>> 1) Introduce a static global in src/pacman/util.c
>> 2) getcols always prefers this cached value, but will derive it from
>> the COLUMNS environment var, the characteristics of stdout, or a sane
>> default (in that order).
>> 3) Introduce a SIGWINCH signal handler to reset the cached value,
>> meaning we only call ioctl when we don't know the value.
>>
>> On my machine, pacman -Syy goes from ~4300 ioctl calls to 3.
>> ---
>> src/pacman/callback.c | 6 +++---
>> src/pacman/package.c | 4 ++--
>> src/pacman/pacman.c | 5 ++++-
>> src/pacman/util.c | 59 +++++++++++++++++++++++++++++++++++++--------------
>> src/pacman/util.h | 3 ++-
>> 5 files changed, 54 insertions(+), 23 deletions(-)
>
> A few small nitpicks.
>
Made those changes as I pulled.
A
More information about the pacman-dev
mailing list