[hackers] [sbase] Use PRIO_{MIN,MAX} instead of NZERO || sin

From: <git_AT_suckless.org>
Date: Mon, 17 Nov 2014 16:02:55 +0100

commit 166bc3052e1e0813f6ff094f6429e3368f98f7bf
Author: sin <sin_AT_2f30.org>
Date: Mon Nov 17 15:01:43 2014 +0000

    Use PRIO_{MIN,MAX} instead of NZERO
    
    Some systems do not define NZERO. NZERO seems to be an XSI extension
    and PRIO_{MIN,MAX} is not specified by POSIX but most relevant systems
    define it.

diff --git a/nice.c b/nice.c
index c4de430..8a48bf1 100644
--- a/nice.c
+++ b/nice.c
_AT_@ -37,7 +37,7 @@ main(int argc, char *argv[])
         val += getpriority(PRIO_PROCESS, 0);
         if (errno != 0)
                 weprintf("getpriority:");
- val = MAX(-NZERO, MIN(val, NZERO - 1));
+ val = MAX(PRIO_MIN, MIN(val, PRIO_MAX));
         if (setpriority(PRIO_PROCESS, 0, val) != 0)
                 weprintf("setpriority:");
 
diff --git a/renice.c b/renice.c
index 78ba233..feba155 100644
--- a/renice.c
+++ b/renice.c
_AT_@ -105,7 +105,7 @@ renice(int which, int who, long adj)
                 return 0;
         }
 
- adj = MAX(-NZERO, MIN(adj, NZERO - 1));
+ adj = MAX(PRIO_MIN, MIN(adj, PRIO_MAX));
         if (setpriority(which, who, (int)adj) == -1) {
                 fprintf(stderr, "can't set %d nice level: %s\n",
                         who, strerror(errno));
Received on Mon Nov 17 2014 - 16:02:55 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 17 2014 - 16:12:09 CET