From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 25 23:01:14 2010 Received: (at submit) by debbugs.gnu.org; 26 Jul 2010 03:01:15 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdDwI-000619-Eo for submit@debbugs.gnu.org; Sun, 25 Jul 2010 23:01:14 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdDwG-000613-0b for submit@debbugs.gnu.org; Sun, 25 Jul 2010 23:01:12 -0400 Received: from lists.gnu.org ([199.232.76.165]:48590) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OdDwJ-0005JH-Uo for submit@debbugs.gnu.org; Sun, 25 Jul 2010 23:01:16 -0400 Received: from [140.186.70.92] (port=55978 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdDwI-00069H-Cq for bug-coreutils@gnu.org; Sun, 25 Jul 2010 23:01:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdDwH-0000aC-61 for bug-coreutils@gnu.org; Sun, 25 Jul 2010 23:01:14 -0400 Received: from kiwi.cs.ucla.edu ([131.179.128.19]:38677) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdDwG-0000Zy-RH for bug-coreutils@gnu.org; Sun, 25 Jul 2010 23:01:13 -0400 Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id o6Q319St023713 for ; Sun, 25 Jul 2010 20:01:10 -0700 (PDT) Message-ID: <4C4CFA75.8020403@cs.ucla.edu> Date: Sun, 25 Jul 2010 20:01:09 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100527 Thunderbird/3.0.5 MIME-Version: 1.0 To: Bug Coreutils Subject: [PATCH] sort: omit unnecessary casts Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.1 (-----) These casts aren't needed. Perhaps the qsort and nl_langinfo casts were needed in the distant past, but surely not any more (as similar casts are not present in other uses of these functions). * src/sort.c (inittables, general_numcompare, compare_nodes): (queue_init, queue_pop): Omit casts that are not needed, typically because they are between void * and some other pointer type. --- src/sort.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/sort.c b/src/sort.c index c7c8b46..ca1d95c 100644 --- a/src/sort.c +++ b/src/sort.c @@ -1236,7 +1236,7 @@ inittables (void) size_t j, k; char *name; - s = (char *) nl_langinfo (ABMON_1 + i); + s = nl_langinfo (ABMON_1 + i); s_len = strlen (s); monthtab[i].name = name = xmalloc (s_len + 1); monthtab[i].val = i + 1; @@ -1246,8 +1246,7 @@ inittables (void) name[k++] = fold_toupper[to_uchar (s[j])]; name[k] = '\0'; } - qsort ((void *) monthtab, MONTHS_PER_YEAR, - sizeof *monthtab, struct_month_cmp); + qsort (monthtab, MONTHS_PER_YEAR, sizeof *monthtab, struct_month_cmp); } #endif } @@ -1961,7 +1960,7 @@ general_numcompare (char const *sa, char const *sb, char const **ea) : a == b ? 0 : b == b ? -1 : a == a ? 1 - : memcmp ((char *) &a, (char *) &b, sizeof a)); + : memcmp (&a, &b, sizeof a)); } /* Return an integer in 1..12 of the month name MONTH with length LEN. @@ -3107,8 +3106,8 @@ sequential_sort (struct line *restrict lines, size_t nlines, static int compare_nodes (void const *a, void const *b) { - struct merge_node const *nodea = (struct merge_node const *) a; - struct merge_node const *nodeb = (struct merge_node const *) b; + struct merge_node const *nodea = a; + struct merge_node const *nodeb = b; if (nodea->level == nodeb->level) return (nodea->nlo + nodea->nhi) < (nodeb->nlo + nodeb->nhi); return nodea->level < nodeb->level; @@ -3151,7 +3150,7 @@ queue_destroy (struct merge_node_queue *restrict queue) static inline void queue_init (struct merge_node_queue *restrict queue, size_t reserve) { - queue->priority_queue = (struct heap *) heap_alloc (compare_nodes, reserve); + queue->priority_queue = heap_alloc (compare_nodes, reserve); pthread_mutex_init (&queue->mutex, NULL); pthread_cond_init (&queue->cond, NULL); } @@ -3181,7 +3180,7 @@ queue_pop (struct merge_node_queue *restrict queue) { pthread_mutex_lock (&queue->mutex); if (queue->priority_queue->count) - node = (struct merge_node *) heap_remove_top (queue->priority_queue); + node = heap_remove_top (queue->priority_queue); else { /* Go into conditional wait if no NODE is immediately available. */ -- 1.7.1 From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 26 05:37:24 2010 Received: (at 6727-done) by debbugs.gnu.org; 26 Jul 2010 09:37:24 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdK7g-0000UN-Hj for submit@debbugs.gnu.org; Mon, 26 Jul 2010 05:37:24 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OdK7f-0000UE-4B for 6727-done@debbugs.gnu.org; Mon, 26 Jul 2010 05:37:23 -0400 Received: (qmail 12196 invoked from network); 26 Jul 2010 09:37:27 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 26 Jul 2010 09:37:27 -0000 Message-ID: <4C4D5727.2030303@draigBrady.com> Date: Mon, 26 Jul 2010 10:36:39 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: Paul Eggert Subject: Re: bug#6727: [PATCH] sort: omit unnecessary casts References: <4C4CFA75.8020403@cs.ucla.edu> In-Reply-To: <4C4CFA75.8020403@cs.ucla.edu> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 6727-done Cc: 6727-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On 26/07/10 04:01, Paul Eggert wrote: > * src/sort.c (inittables, general_numcompare, compare_nodes): > (queue_init, queue_pop): Omit casts that are not needed, typically > because they are between void * and some other pointer type. Looks good. Closing... From unknown Mon Jun 23 23:51:31 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 23 Aug 2010 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator