]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Negate codes using a clear, standard method
authorSimon Wilkinson <sxw@your-file-system.com>
Wed, 4 Jan 2012 21:44:30 +0000 (21:44 +0000)
committerDerrick Brashear <shadow@dementix.org>
Thu, 5 Jan 2012 02:10:50 +0000 (18:10 -0800)
The bulk of our code uses 'code = -code' to negate an error code.
Use this, rather than 'code *= -1', as the latter form makes my
head hurt.

Change-Id: I578fbd7c123c37d89ceb1a6373409feb8b619d86
Reviewed-on: http://gerrit.openafs.org/6511
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/afs/AIX/osi_file.c
src/afs/DARWIN/osi_file.c
src/afs/FBSD/osi_file.c
src/afs/HPUX/osi_file.c
src/afs/IRIX/osi_file.c
src/afs/LINUX/osi_file.c
src/afs/LINUX24/osi_file.c
src/afs/NBSD/osi_file.c
src/afs/OBSD/osi_file.c
src/afs/SOLARIS/osi_file.c

index 7ecaaf2376f14a20b0ae6753d739608ed25e363b..67841403e39ef8622a94f80426a01c7fc7c41c62 100644 (file)
@@ -199,7 +199,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
        }
        setuerror(code);
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     return code;
@@ -244,7 +244,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
                ("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
        setuerror(code);
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     if (afile->proc) {
index bc271f02fca67fe55f41377d5b2fdf7e73b9c00b..14be5857928914818a085ec8695307bc95b6676e 100644 (file)
@@ -347,7 +347,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
        afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
                   ICL_TYPE_INT32, code);
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     return code;
@@ -390,7 +390,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
        afile->offset += code;
     } else {
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     if (afile->proc) {
index 7c695d60ee73a6b0cb1c69e951f5c0b0698d3c03..32debc327462008eef3264cd7d9939034fe5fc60 100644 (file)
@@ -188,7 +188,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
        afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
                   ICL_TYPE_INT32, code);
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     return code;
@@ -219,7 +219,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
        afile->offset += code;
     } else {
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     if (afile->proc) {
index 59c2594af7c5b1b157095a4013022b4a95bda142..587c149de08d5939b9094678c56eeb2c52a46e71 100644 (file)
@@ -178,7 +178,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
        }
        setuerror(code);
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     return code;
@@ -211,7 +211,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
                ("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
        setuerror(code);
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     if (afile->proc) {
index 86984937d254910c3d20cd1ee3a30a3d0d571e80..02ea9b6769dd0da8dc4276e526d497bf2d80fb9d 100644 (file)
@@ -161,7 +161,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
        afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
                   ICL_TYPE_INT32, code);
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     return code;
@@ -194,7 +194,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
            afs_warnuser
                ("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     if (afile->proc) {
index 35d2aa59ce9de9f4cf78ee02cd2b72ff2b83e854..2e57fbb3a95d166b8654fcc0a41ea7d17e234ab9 100644 (file)
@@ -231,7 +231,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
        afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, auio.uio_resid,
                   ICL_TYPE_INT32, code);
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     return code;
@@ -269,7 +269,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
            afs_warnuser
                ("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
 
index 35bd031d00bd96afbb23ad0cd1dd5e37fc96759c..fc90208cb95684a8629eb3a202d533436b1e1106 100644 (file)
@@ -216,7 +216,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
        afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, auio.uio_resid,
                   ICL_TYPE_INT32, code);
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     return code;
@@ -254,7 +254,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
            afs_warnuser
                ("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
 
index c77ac2c27600594ab0f96dce1b20d6dfa70cdf19..6716ca0ab2f35a8ece237068f92a9a8dcdf583b8 100644 (file)
@@ -176,7 +176,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
        afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
                   ICL_TYPE_INT32, code);
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     return code;
@@ -209,7 +209,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
            afile->size = afile->offset;
     } else {
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
 
index 72a43ef9fa335e1496ebe22c2f1cb8daebb8109c..4b79cb358c02f9f7c7867109e06944b62137a673 100644 (file)
@@ -164,7 +164,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
        afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32,
                   (unsigned int) resid, ICL_TYPE_INT32, code);
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     return code;
@@ -199,7 +199,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
            afile->size = afile->offset;
     } else {
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
 
index b497b631cb44e5d575a31f809bc7470ce2c829fb..35669838f2a222de5962221a6e64b2877a7ab86c 100644 (file)
@@ -382,7 +382,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
        afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
                   ICL_TYPE_INT32, code);
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     return code;
@@ -412,7 +412,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
        afile->offset += code;
     } else {
        if (code > 0) {
-           code *= -1;
+           code = -code;
        }
     }
     if (afile->proc) {