]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
sort: minor performance tweak with num_processors
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 23 Dec 2010 07:29:57 +0000 (23:29 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 23 Dec 2010 07:30:35 +0000 (23:30 -0800)
* src/sort.c (main): Don't invoke num_processors twice.

src/sort.c

index f193e04a08c1bae3a22a23f1e1334118ca4f24cc..96e06960d2183177d017a68159fa17ec7d5d37cd 100644 (file)
@@ -4601,8 +4601,8 @@ main (int argc, char **argv)
     {
       if (!nthreads)
         {
-          nthreads = MIN (DEFAULT_MAX_THREADS,
-                          num_processors (NPROC_CURRENT_OVERRIDABLE));
+          unsigned long int np = num_processors (NPROC_CURRENT_OVERRIDABLE);
+          nthreads = MIN (np, DEFAULT_MAX_THREADS);
         }
 
       /* Avoid integer overflow later.  */