summaryrefslogtreecommitdiff
path: root/src/sort.c
diff options
context:
space:
mode:
authorPaul R. Eggert <eggert@cs.ucla.edu>2010-07-25 19:58:32 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2010-07-25 19:59:11 -0700
commit001700f4a0c55125a5f01340017dd25bfa2b1c25 (patch)
tree842ab0c4fe155356028e6dd59efda86dbae3c331 /src/sort.c
parent48faad374819668b483683d2c444f6b2e93a008e (diff)
downloadcoreutils-001700f4a0c55125a5f01340017dd25bfa2b1c25.tar.xz
sort: omit unnecessary casts
* 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.
Diffstat (limited to 'src/sort.c')
-rw-r--r--src/sort.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/sort.c b/src/sort.c
index c7c8b463b..ca1d95cdc 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. */