← Commit list

f893250a3

Rob Landley
Rob Landley
2006-05-09
SOURCE BUG Duration: 66s

Subject

Replace isnan() and isinf() with inline tests so uClibc doesn't want us to link sort against libm. This adds 22 bytes for glibc but is a win for uClibc, and since glibc is bigger than all of busybox it seems kind of silly to worry about it.

SOURCE BUG

This commit was genuinely broken at the time (not related to our build system): scripts/config/mkconfigs.c (2005-08-01 - 2006-10-05 arasi) uretilen bbconfigopts.h icine .config satirlarini kacissiz, ham newline'larla gömüyordu - gecerli C degildi, busybox'un kendi bb_mkdep araci bile parse edemiyordu (7d219aab7 ile duzeltildi, mkconfigs shell scripte cevrildi)

→ Bu hatanin tam hikayesini ve duzeltme diffini gor

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

coreutils/sort.c+8 -6
@@ -176,12 +176,14 @@ static int compare_keys(const void *xarg, const void *yarg)
/* not numbers < NaN < -infinity < numbers < +infinity) */
if(x==xx) retval=(y==yy ? 0 : -1);
else if(y==yy) retval=1;
- else if(isnan(dx)) retval=isnan(dy) ? 0 : -1;
- else if(isnan(dy)) retval=1;
- else if(isinf(dx)) {
- if(dx<0) retval=((isinf(dy) && dy<0) ? 0 : -1);
- else retval=((isinf(dy) && dy>0) ? 0 : 1);
- } else if(isinf(dy)) retval=dy<0 ? 1 : -1;
+ /* Check for isnan */
+ else if(dx != dx) retval = (dy != dy) ? 0 : -1;
+ else if(dy != dy) retval = 1;
+ /* Check for infinity. Could underflow, but it avoids libm. */
+ else if(1.0/dx == 0.0) {
+ if(dx<0) retval=((1.0/dy == 0.0 && dy<0) ? 0 : -1);
+ else retval=((1.0/dy == 0.0 && dy>0) ? 0 : 1);
+ } else if(1.0/dy == 0.0) retval=dy<0 ? 1 : -1;
else retval=dx>dy ? 1 : (dx<dy ? -1 : 0);
break;
}