[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sort.c minor cleanup in volatile setjmp code
From: |
Paul Eggert |
Subject: |
sort.c minor cleanup in volatile setjmp code |
Date: |
Wed, 01 Dec 2004 16:35:41 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
I installed this patch. It doesn't fix any bugs, but it does remove a
confusing and unnecessary "volatile" and I suppose it improves
performance by a few nanoseconds.
2004-12-01 Paul Eggert <address@hidden>
* src/ls.c (sort_files): Minor cleanup. Remove an unnecessary
'volatile' on a local variable. Rewrite to avoid unnecessary
double-assignment to 'func' in the usual case where strcoll does
not fail.
Index: src/ls.c
===================================================================
RCS file: /fetish/cu/src/ls.c,v
retrieving revision 1.368
retrieving revision 1.369
diff -p -u -b -w -r1.368 -r1.369
--- src/ls.c 19 Nov 2004 21:41:00 -0000 1.368
+++ src/ls.c 2 Dec 2004 00:31:43 -0000 1.369
@@ -2871,10 +2871,15 @@ static int rev_str_extension (V a, V b)
static void
sort_files (void)
{
- /* `func' must be `volatile', so it can't be
- clobbered by a `longjmp' into this function. */
- int (* volatile func) (V, V);
+ int (*func) (V, V);
+ /* Try strcoll. If it fails, fall back on strcmp. We can't safely
+ ignore strcoll failures, as a failing strcoll might be a
+ comparison function that is not a total order, and if we ignored
+ the failure this might cause qsort to dump core. */
+
+ if (! setjmp (failed_strcoll))
+ {
switch (sort_type)
{
case sort_none:
@@ -2910,13 +2915,8 @@ sort_files (void)
default:
abort ();
}
-
- /* Try strcoll. If it fails, fall back on strcmp. We can't safely
- ignore strcoll failures, as a failing strcoll might be a
- comparison function that is not a total order, and if we ignored
- the failure this might cause qsort to dump core. */
-
- if (setjmp (failed_strcoll))
+ }
+ else
{
switch (sort_type)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- sort.c minor cleanup in volatile setjmp code,
Paul Eggert <=