OpenAFS Master Repository branch, master, updated. openafs-devel-1_5_76-3524-gc705a81

Gerrit Code Review gerrit@openafs.org
Wed, 27 Feb 2013 06:55:56 -0800 (PST)


The following commit has been merged in the master branch:
commit c705a815a808e7eafd2043fe0ec0881d602342c5
Author: Nickolai Zeldovich <nickolai@csail.mit.edu>
Date:   Wed Feb 27 05:08:40 2013 -0500

    ptserver/testpt.c: remove dead code in ListUsedIds
    
    A part of the current ListUsedIds code is:
    
        range = abs(startId - maxId);
        if (range < 0)
           range = -range;
    
    The only way abs() could return a negative value would be if its
    argument was INT_MIN (-2147483648) to begin with, because -INT_MIN
    cannot be represented in two's complement.  However, calling
    abs(INT_MIN) is undefined behavior in C [see C99 7.20.6.1], and for
    that matter, so would be computing -range (-INT_MIN) in that case,
    so we could still be left with a negative range value.
    
    Luckily, (startId - maxId) can never be INT_MIN.  If startId < 0,
    then maxId <= startId, so in the worst case, when maxId = INT_MIN
    and startId = -1, (startId-maxId)=INT_MAX.  If startId >= 0, then
    maxId >= startId, so in the worst case, when maxId = INT_MAX and
    startId = 0, (startId-maxId)=-INT_MAX=INT_MIN+1.
    
    This patch removes the useless if statement.
    
    Change-Id: Ia754fcf3e59354afb40dbbbb95623e27285a5f82
    Reviewed-on: http://gerrit.openafs.org/9289
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

 src/ptserver/testpt.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

-- 
OpenAFS Master Repository