Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752650Ab0BVQoS (ORCPT ); Mon, 22 Feb 2010 11:44:18 -0500 Received: from mail.vyatta.com ([76.74.103.46]:48821 "EHLO mail.vyatta.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751746Ab0BVQoP (ORCPT ); Mon, 22 Feb 2010 11:44:15 -0500 Date: Mon, 22 Feb 2010 08:43:39 -0800 From: Stephen Hemminger To: Cong Wang Cc: Andrew Morton , "Luis R. Rodriguez" , Sam Ravnborg , Vegard Nossum , Uwe =?UTF-8?B?S2xlaW5lLUvDg8K2bmln?= , "Robert P. J. Day" , Arnd Bergmann , Arjan van de Ven , Hui Zhu , Ozan =?UTF-8?B?w4NhZ2xheWFu?= , Matthew Wilcox , Steven Rostedt , Li Hong , Ingo Molnar , Ralf Baechle , Matt Fleming , linux-kernel@vger.kernel.org Subject: Re: [PATCH] scripts: improve checkstack Message-ID: <20100222084339.1367cfe6@nehalam> In-Reply-To: <4B7F90AA.8050306@redhat.com> References: <20100219175217.385580142@vyatta.com> <20100219175429.611463369@vyatta.com> <4B7F5128.70501@redhat.com> <20100219222554.17d4bae6@nehalam> <4B7F90AA.8050306@redhat.com> Organization: Vyatta X-Mailer: Claws Mail 3.7.2 (GTK+ 2.18.3; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1244 Lines: 35 On Sat, 20 Feb 2010 15:35:06 +0800 Cong Wang wrote: > Stephen Hemminger wrote: > > Turn on strict checking, and get rid of annoying use of prototype. > > Fix syntax error in declaration > > > > Use efficient sort algorithm by using schwartzian transform. > > http://en.wikipedia.org/wiki/Schwartzian_transform > > > Yeah, the idea is good, this can also make it more perlish. ;) > > But... > > > > -print sort bysize @stack; > > +# Use Schwartzian transform to sort by last field (size) > > +print map { $_->[0] } > > + sort { $b->[1] <=> $a->[1] } > > + map { [$_, /:\t*(\d+)$/] } @stack; > > This regex here is not strictly the same as before. > > Can we just keep the original regex? If not, what's wrong? The original one had extra cruft: 1. The expression is anchored on right, so leading .* is meaningless 2. Putting tab directly makes it invisible when reading source (use \t) 3. Want to match on number, not just anything (that is why the \d) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/