[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] seq: speed up the common case by 25x
From: |
Jim Meyering |
Subject: |
Re: [PATCH] seq: speed up the common case by 25x |
Date: |
Fri, 01 Apr 2011 11:44:00 +0200 |
Jim Meyering wrote:
> Jim Meyering wrote:
>> +static int
>> +print_long_range (int first, int last)
>> +{
>> + (void) first;
>> + int ret;
>> + char *cmd;
>> + ret = asprintf (&cmd, "yes | head -n%d | cat -n | tr -cd '[0-9\\n]'",
>> last);
>> + if (ret != -1)
>> + ret = system (cmd);
>> + free (cmd);
>> + return ret;
>> +}
Also, please combine the declaration and setting of "ret":
int ret = asprintf (&cmd, "yes | head -n%d | cat -n | tr -cd '[0-9\\n]'",
last);