From patchwork Thu Oct 29 21:59:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 56528 X-Patchwork-Delegate: kyle@mcmartin.ca Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9TLx5Hm013601 for ; Thu, 29 Oct 2009 21:59:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755376AbZJ2V7A (ORCPT ); Thu, 29 Oct 2009 17:59:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755633AbZJ2V7A (ORCPT ); Thu, 29 Oct 2009 17:59:00 -0400 Received: from mail.gmx.net ([213.165.64.20]:49467 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753030AbZJ2V67 (ORCPT ); Thu, 29 Oct 2009 17:58:59 -0400 Received: (qmail invoked by alias); 29 Oct 2009 21:59:03 -0000 Received: from p4FDB2849.dip0.t-ipconnect.de (EHLO p100.box) [79.219.40.73] by mail.gmx.net (mp008) with SMTP; 29 Oct 2009 22:59:03 +0100 X-Authenticated: #1045983 X-Provags-ID: V01U2FsdGVkX19pCek7cjdp5RWMtSSgtrYEkMT7tge/feRztMl9R1 akHYrwyS5jjxJ7 Date: Thu, 29 Oct 2009 22:59:01 +0100 From: Helge Deller To: linux-parisc@vger.kernel.org, Kyle McMartin , Randolph Chung Subject: [PATCH] parisc: use sort() instead of home-made implementation Message-ID: <20091029215901.GA30311@p100.box> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.57 Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c index 69dad5a..e5a4390 100644 --- a/arch/parisc/kernel/unwind.c +++ b/arch/parisc/kernel/unwind.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -115,24 +116,21 @@ unwind_table_init(struct unwind_table *table, const char *name, } } +static int cmp_unwind_table_entry(const void *a, const void *b) +{ + return ((const struct unwind_table_entry *)a)->region_start + - ((const struct unwind_table_entry *)b)->region_start; +} + static void unwind_table_sort(struct unwind_table_entry *start, struct unwind_table_entry *finish) { - struct unwind_table_entry el, *p, *q; - - for (p = start + 1; p < finish; ++p) { - if (p[0].region_start < p[-1].region_start) { - el = *p; - q = p; - do { - q[0] = q[-1]; - --q; - } while (q > start && - el.region_start < q[-1].region_start); - *q = el; - } - } + int len; + + len = (finish - start) / sizeof(struct unwind_table_entry); + sort(start, len, sizeof(struct unwind_table_entry), + cmp_unwind_table_entry, NULL); } struct unwind_table *