Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make: merge duplicate code for sorting strings ...



details:   https://anonhg.NetBSD.org/src/rev/b49d13611141
branches:  trunk
changeset: 1022634:b49d13611141
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jul 30 22:19:51 2021 +0000

description:
make: merge duplicate code for sorting strings and numbers

No functional change.

diffstat:

 usr.bin/make/var.c |  12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (40 lines):

diff -r 8af6ff98b2ac -r b49d13611141 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Fri Jul 30 22:16:09 2021 +0000
+++ b/usr.bin/make/var.c        Fri Jul 30 22:19:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.940 2021/07/30 22:16:09 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.941 2021/07/30 22:19:51 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.940 2021/07/30 22:16:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.941 2021/07/30 22:19:51 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -3315,11 +3315,7 @@
 static int
 num_cmp_desc(const void *sa, const void *sb)
 {
-       NUM_TYPE a, b;
-
-       a = num_val(*(const char *const *)sa);
-       b = num_val(*(const char *const *)sb);
-       return (a > b) ? -1 : (b > a) ? 1 : 0;
+       return num_cmp_asc(sb, sa);
 }
 
 static int
@@ -3331,7 +3327,7 @@
 static int
 str_cmp_desc(const void *a, const void *b)
 {
-       return strcmp(*(const char *const *)b, *(const char *const *)a);
+       return str_cmp_asc(b, a);
 }
 
 static void



Home | Main Index | Thread Index | Old Index