diff --git a/www/minimo/Makefile b/www/minimo/Makefile index f2e5503b887..9b726855d0e 100644 --- a/www/minimo/Makefile +++ b/www/minimo/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.17 2006/03/27 04:23:29 pvalchev Exp $ +# $OpenBSD: Makefile,v 1.18 2006/04/24 20:03:00 kurt Exp $ ONLY_FOR_ARCHS= alpha amd64 i386 powerpc sparc64 arm SHARED_ONLY= Yes COMMENT= "mini mozilla" DISTNAME= minimo-20050802 -PKGNAME= ${DISTNAME}p6 +PKGNAME= ${DISTNAME}p7 SO_VERSION= 2.0 # NOTE: Must bump minor version if any shlib's are removed from the # components dir to avoid pkg_add -r issues. diff --git a/www/minimo/patches/patch-nsprpub_pr_src_misc_prdtoa_c b/www/minimo/patches/patch-nsprpub_pr_src_misc_prdtoa_c index 08326cea7c9..841d1b64ec4 100644 --- a/www/minimo/patches/patch-nsprpub_pr_src_misc_prdtoa_c +++ b/www/minimo/patches/patch-nsprpub_pr_src_misc_prdtoa_c @@ -1,6 +1,6 @@ -$OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev Exp $ ---- nsprpub/pr/src/misc/prdtoa.c.orig Tue Apr 27 18:34:07 2004 -+++ nsprpub/pr/src/misc/prdtoa.c Sat Feb 4 18:47:53 2006 +$OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.3 2006/04/24 20:03:00 kurt Exp $ +--- nsprpub/pr/src/misc/prdtoa.c.orig Tue Apr 27 20:34:07 2004 ++++ nsprpub/pr/src/misc/prdtoa.c Wed Apr 19 17:24:23 2006 @@ -1,82 +1,8 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** @@ -166,7 +166,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev * #define KR_headers for old-style C function headers. * #define Bad_float_h if your system lacks a float.h or if it does not * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, -@@ -175,89 +87,82 @@ void _PR_CleanupDtoa(void) +@@ -175,89 +87,85 @@ void _PR_CleanupDtoa(void) * if memory is available and otherwise does something you deem * appropriate. If MALLOC is undefined, malloc will be invoked * directly -- and assumed always to succeed. @@ -238,7 +238,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev -#ifndef Long -#define Long long +#if defined(LIBC_SCCS) && !defined(lint) -+static char *rcsid = "$OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev Exp $"; ++static char *rcsid = "$OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.3 2006/04/24 20:03:00 kurt Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include "primpl.h" @@ -247,12 +247,13 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev +#define ACQUIRE_DTOA_LOCK(n) PR_Lock(dtoa_lock[n]) +#define FREE_DTOA_LOCK(n) PR_Unlock(dtoa_lock[n]) + -+static PRLock *dtoa_lock[2]; ++static PRLock *dtoa_lock[3]; + +void _PR_InitDtoa(void) +{ + dtoa_lock[0] = PR_NewLock(); + dtoa_lock[1] = PR_NewLock(); ++ dtoa_lock[2] = PR_NewLock(); +} + +void _PR_CleanupDtoa(void) @@ -261,6 +262,8 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev + dtoa_lock[0] = NULL; + PR_DestroyLock(dtoa_lock[1]); + dtoa_lock[1] = NULL; ++ PR_DestroyLock(dtoa_lock[2]); ++ dtoa_lock[2] = NULL; + + /* FIXME: deal with freelist and p5s. */ +} @@ -318,7 +321,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #ifdef MALLOC #ifdef KR_headers -@@ -269,42 +174,32 @@ extern void *MALLOC(size_t); +@@ -269,42 +177,32 @@ extern void *MALLOC(size_t); #define MALLOC malloc #endif @@ -373,7 +376,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #define DBL_MAX 7.2370055773322621e+75 #endif -@@ -313,27 +208,16 @@ static double private_mem[PRIVATE_mem], +@@ -313,27 +211,16 @@ static double private_mem[PRIVATE_mem], #define DBL_MAX_10_EXP 38 #define DBL_MAX_EXP 127 #define FLT_RADIX 2 @@ -403,7 +406,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #ifndef __MATH_H__ #include "math.h" #endif -@@ -350,37 +234,43 @@ extern "C" { +@@ -350,37 +237,43 @@ extern "C" { #endif #endif @@ -464,7 +467,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \ ((unsigned short *)a)[0] = (unsigned short)c, a++) #else -@@ -394,7 +284,7 @@ typedef union { double d; ULong L[2]; } +@@ -394,7 +287,7 @@ typedef union { double d; ULong L[2]; } /* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */ /* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */ @@ -473,7 +476,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #define Exp_shift 20 #define Exp_shift1 20 #define Exp_msk1 0x100000 -@@ -402,6 +292,7 @@ typedef union { double d; ULong L[2]; } +@@ -402,6 +295,7 @@ typedef union { double d; ULong L[2]; } #define Exp_mask 0x7ff00000 #define P 53 #define Bias 1023 @@ -481,7 +484,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #define Emin (-1022) #define Exp_1 0x3ff00000 #define Exp_11 0x3ff00000 -@@ -419,38 +310,11 @@ typedef union { double d; ULong L[2]; } +@@ -419,38 +313,11 @@ typedef union { double d; ULong L[2]; } #define Tiny1 1 #define Quick_max 14 #define Int_max 14 @@ -521,7 +524,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #define Exp_shift 24 #define Exp_shift1 24 #define Exp_msk1 0x1000000 -@@ -475,8 +339,6 @@ typedef union { double d; ULong L[2]; } +@@ -475,8 +342,6 @@ typedef union { double d; ULong L[2]; } #define Quick_max 14 #define Int_max 15 #else /* VAX */ @@ -530,7 +533,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #define Exp_shift 23 #define Exp_shift1 7 #define Exp_msk1 0x80 -@@ -500,8 +362,8 @@ typedef union { double d; ULong L[2]; } +@@ -500,8 +365,8 @@ typedef union { double d; ULong L[2]; } #define Tiny1 0 #define Quick_max 15 #define Int_max 15 @@ -541,7 +544,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #ifndef IEEE_Arith #define ROUND_BIASED -@@ -523,42 +385,25 @@ extern double rnd_prod(double, double), +@@ -523,42 +388,25 @@ extern double rnd_prod(double, double), #define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1)) #define Big1 0xffffffff @@ -593,7 +596,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev struct Bigint { struct Bigint *next; -@@ -580,32 +425,16 @@ Balloc +@@ -580,28 +428,14 @@ Balloc { int x; Bigint *rv; @@ -601,7 +604,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev - unsigned int len; -#endif -- ACQUIRE_DTOA_LOCK(0); + ACQUIRE_DTOA_LOCK(0); - if (rv = freelist[k]) { + if ((rv = freelist[k])) { freelist[k] = rv->next; @@ -624,22 +627,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev rv->k = k; rv->maxwds = x; } -- FREE_DTOA_LOCK(0); - rv->sign = rv->wds = 0; - return rv; - } -@@ -619,10 +448,8 @@ Bfree - #endif - { - if (v) { -- ACQUIRE_DTOA_LOCK(0); - v->next = freelist[v->k]; - freelist[v->k] = v; -- FREE_DTOA_LOCK(0); - } - } - -@@ -638,49 +465,37 @@ multadd +@@ -638,49 +472,37 @@ multadd #endif { int i, wds; @@ -696,7 +684,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev b->wds = wds; } return b; -@@ -799,7 +614,7 @@ lo0bits +@@ -799,7 +621,7 @@ lo0bits if (!(x & 1)) { k++; x >>= 1; @@ -705,7 +693,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev return 32; } *y = x; -@@ -832,16 +647,11 @@ mult +@@ -832,16 +654,11 @@ mult { Bigint *c; int k, wa, wb, wc; @@ -723,7 +711,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev if (a->wds < b->wds) { c = a; -@@ -862,25 +672,9 @@ mult +@@ -862,25 +679,9 @@ mult xb = b->x; xbe = xb + wb; xc0 = c->x; @@ -750,7 +738,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev x = xa; xc = xc0; carry = 0; -@@ -894,7 +688,7 @@ mult +@@ -894,7 +695,7 @@ mult while(x < xae); *xc = carry; } @@ -759,7 +747,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev x = xa; xc = xc0; carry = 0; -@@ -926,7 +720,6 @@ mult +@@ -926,7 +727,6 @@ mult } } #endif @@ -767,7 +755,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ; c->wds = wc; return c; -@@ -946,24 +739,15 @@ pow5mult +@@ -946,24 +746,19 @@ pow5mult int i; static int p05[3] = { 5, 25, 125 }; @@ -780,38 +768,38 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev if (!(p5 = p5s)) { /* first time */ -#ifdef MULTIPLE_THREADS -- ACQUIRE_DTOA_LOCK(1); -- if (!(p5 = p5s)) { -- p5 = p5s = i2b(625); -- p5->next = 0; -- } -- FREE_DTOA_LOCK(1); + ACQUIRE_DTOA_LOCK(1); + if (!(p5 = p5s)) { + p5 = p5s = i2b(625); + p5->next = 0; + } + FREE_DTOA_LOCK(1); -#else - p5 = p5s = i2b(625); - p5->next = 0; +- p5 = p5s = i2b(625); +- p5->next = 0; -#endif } for(;;) { if (k & 1) { -@@ -974,17 +758,8 @@ pow5mult +@@ -974,17 +769,12 @@ pow5mult if (!(k >>= 1)) break; if (!(p51 = p5->next)) { -#ifdef MULTIPLE_THREADS -- ACQUIRE_DTOA_LOCK(1); -- if (!(p51 = p5->next)) { -- p51 = p5->next = mult(p5,p5); -- p51->next = 0; -- } -- FREE_DTOA_LOCK(1); + ACQUIRE_DTOA_LOCK(1); + if (!(p51 = p5->next)) { + p51 = p5->next = mult(p5,p5); + p51->next = 0; + } + FREE_DTOA_LOCK(1); -#else - p51 = p5->next = mult(p5,p5); - p51->next = 0; +- p51 = p5->next = mult(p5,p5); +- p51->next = 0; -#endif } p5 = p51; } -@@ -1027,7 +802,7 @@ lshift +@@ -1027,7 +817,7 @@ lshift z = *x++ >> k1; } while(x < xe); @@ -820,7 +808,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev ++n1; } #else -@@ -1095,15 +870,11 @@ diff +@@ -1095,15 +885,11 @@ diff { Bigint *c; int i, wa, wb; @@ -838,7 +826,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev i = cmp(a,b); if (!i) { -@@ -1130,49 +901,41 @@ diff +@@ -1130,49 +916,41 @@ diff xbe = xb + wb; xc = c->x; borrow = 0; @@ -906,7 +894,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev while(!*--xc) wa--; c->wds = wa; -@@ -1182,26 +945,25 @@ diff +@@ -1182,26 +960,25 @@ diff static double ulp #ifdef KR_headers @@ -938,7 +926,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #ifndef Sudden_Underflow } else { -@@ -1217,8 +979,7 @@ ulp +@@ -1217,8 +994,7 @@ ulp } } #endif @@ -948,7 +936,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev } static double -@@ -1231,7 +992,7 @@ b2d +@@ -1231,7 +1007,7 @@ b2d { ULong *xa, *xa0, w, y, z; int k; @@ -957,7 +945,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #ifdef VAX ULong d0, d1; #else -@@ -1288,25 +1049,27 @@ b2d +@@ -1288,25 +1064,27 @@ b2d #undef d0 #undef d1 #endif @@ -992,7 +980,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev d0 = word0(d) >> 16 | word0(d) << 16; d1 = word1(d) >> 16 | word1(d) << 16; #else -@@ -1340,10 +1103,7 @@ d2b +@@ -1340,10 +1118,7 @@ d2b } else x[0] = y; @@ -1004,7 +992,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev } else { #ifdef DEBUG -@@ -1352,10 +1112,7 @@ d2b +@@ -1352,10 +1127,7 @@ d2b #endif k = lo0bits(&z); x[0] = z; @@ -1016,7 +1004,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev k += 32; } #else -@@ -1437,11 +1194,11 @@ ratio +@@ -1437,11 +1209,11 @@ ratio (Bigint *a, Bigint *b) #endif { @@ -1031,7 +1019,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #ifdef Pack_32 k = ka - kb + 32*(a->wds - b->wds); #else -@@ -1451,13 +1208,13 @@ ratio +@@ -1451,13 +1223,13 @@ ratio if (k > 0) { word0(da) += (k >> 2)*Exp_msk1; if (k &= 3) @@ -1047,7 +1035,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev } #else if (k > 0) -@@ -1467,10 +1224,10 @@ ratio +@@ -1467,10 +1239,10 @@ ratio word0(db) += k*Exp_msk1; } #endif @@ -1060,7 +1048,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev tens[] = { 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, -@@ -1480,124 +1237,23 @@ tens[] = { +@@ -1480,124 +1252,23 @@ tens[] = { #endif }; @@ -1190,7 +1178,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev PR_strtod #ifdef KR_headers (s00, se) CONST char *s00; char **se; -@@ -1605,51 +1261,40 @@ PR_strtod +@@ -1605,51 +1276,40 @@ PR_strtod (CONST char *s00, char **se) #endif { @@ -1267,7 +1255,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev if (*s == '0') { nz0 = 1; while(*++s == '0') ; -@@ -1664,26 +1309,7 @@ PR_strtod +@@ -1664,26 +1324,7 @@ PR_strtod else if (nd < 16) z = 10*z + c - '0'; nd0 = nd; @@ -1295,7 +1283,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev c = *++s; if (!nd) { for(; c == '0'; c = *++s) -@@ -1718,7 +1344,8 @@ PR_strtod +@@ -1718,7 +1359,8 @@ PR_strtod e = 0; if (c == 'e' || c == 'E') { if (!nd && !nz && !nz0) { @@ -1305,7 +1293,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev } s00 = s; esign = 0; -@@ -1753,38 +1380,8 @@ PR_strtod +@@ -1753,38 +1395,8 @@ PR_strtod s = s00; } if (!nd) { @@ -1345,7 +1333,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev goto ret; } e1 = e -= nf; -@@ -1797,21 +1394,14 @@ PR_strtod +@@ -1797,21 +1409,14 @@ PR_strtod if (!nd0) nd0 = nd; k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1; @@ -1371,7 +1359,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev ) { if (!e) goto ret; -@@ -1820,14 +1410,8 @@ PR_strtod +@@ -1820,14 +1425,8 @@ PR_strtod #ifdef VAX goto vax_ovfl_check; #else @@ -1388,7 +1376,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev goto ret; #endif } -@@ -1836,184 +1420,115 @@ PR_strtod +@@ -1836,184 +1435,115 @@ PR_strtod /* A fancier test would sometimes let us do * this for larger i values. */ @@ -1619,7 +1607,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev } } -@@ -2026,7 +1541,7 @@ PR_strtod +@@ -2026,7 +1556,7 @@ PR_strtod for(;;) { bd = Balloc(bd0->k); Bcopy(bd, bd0); @@ -1628,7 +1616,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev bs = i2b(1); if (e >= 0) { -@@ -2042,38 +1557,21 @@ PR_strtod +@@ -2042,38 +1572,21 @@ PR_strtod else bd2 -= bbe; bs2 = bb2; @@ -1671,7 +1659,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev i = bb2 < bd2 ? bb2 : bd2; if (i > bs2) i = bs2; -@@ -2100,123 +1598,12 @@ PR_strtod +@@ -2100,123 +1613,12 @@ PR_strtod dsign = delta->sign; delta->sign = 0; i = cmp(delta, bs); @@ -1796,7 +1784,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev delta = lshift(delta,Log2P); if (cmp(delta, bs) > 0) goto drop_down; -@@ -2226,12 +1613,7 @@ PR_strtod +@@ -2226,12 +1628,7 @@ PR_strtod /* exactly half-way between */ if (dsign) { if ((word0(rv) & Bndry_mask1) == Bndry_mask1 @@ -1810,7 +1798,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev /*boundary case -- increment exponent*/ word0(rv) = (word0(rv) & Exp_mask) + Exp_msk1 -@@ -2240,44 +1622,24 @@ PR_strtod +@@ -2240,44 +1637,24 @@ PR_strtod #endif ; word1(rv) = 0; @@ -1859,7 +1847,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev word0(rv) = L | Bndry_mask1; word1(rv) = 0xffffffff; #ifdef IBM -@@ -2291,19 +1653,16 @@ PR_strtod +@@ -2291,19 +1668,16 @@ PR_strtod break; #endif if (dsign) @@ -1882,7 +1870,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev break; } if ((aadj = ratio(delta, bs)) <= 2.) { -@@ -2332,7 +1691,7 @@ PR_strtod +@@ -2332,7 +1706,7 @@ PR_strtod aadj *= 0.5; aadj1 = dsign ? aadj : -aadj; #ifdef Check_FLT_ROUNDS @@ -1891,7 +1879,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev case 2: /* towards +infinity */ aadj1 -= 0.5; break; -@@ -2341,19 +1700,19 @@ PR_strtod +@@ -2341,19 +1715,19 @@ PR_strtod aadj1 += 0.5; } #else @@ -1916,7 +1904,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev if ((word0(rv) & Exp_mask) >= Exp_msk1*(DBL_MAX_EXP+Bias-P)) { if (word0(rv0) == Big0 && word1(rv0) == Big1) -@@ -2366,25 +1725,12 @@ PR_strtod +@@ -2366,25 +1740,12 @@ PR_strtod word0(rv) += P*Exp_msk1; } else { @@ -1945,7 +1933,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #ifdef IBM if ((word0(rv) & Exp_mask) < P*Exp_msk1) #else -@@ -2402,10 +1748,10 @@ PR_strtod +@@ -2402,10 +1763,10 @@ PR_strtod word0(rv) -= P*Exp_msk1; } else { @@ -1959,7 +1947,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev /* Compute adj so that the IEEE rounding rules will * correctly round rv + adj in some half-way cases. * If rv * ulp(rv) is denormalized (i.e., -@@ -2413,24 +1759,19 @@ PR_strtod +@@ -2413,24 +1774,19 @@ PR_strtod * trouble from bits lost to denormalization; * example: 1.2e-307 . */ @@ -1989,7 +1977,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev aadj -= L; /* The tolerances below are conservative. */ if (dsign || word1(rv) || word0(rv) & Bndry_mask) { -@@ -2440,43 +1781,12 @@ PR_strtod +@@ -2440,43 +1796,12 @@ PR_strtod else if (aadj < .4999999/FLT_RADIX) break; } @@ -2033,7 +2021,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev retfree: Bfree(bb); Bfree(bd); -@@ -2486,7 +1796,7 @@ PR_strtod +@@ -2486,7 +1811,7 @@ PR_strtod ret: if (se) *se = (char *)s; @@ -2042,7 +2030,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev } static int -@@ -2498,15 +1808,13 @@ quorem +@@ -2498,15 +1823,13 @@ quorem #endif { int n; @@ -2063,7 +2051,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev n = S->wds; #ifdef DEBUG -@@ -2528,31 +1836,26 @@ quorem +@@ -2528,31 +1851,26 @@ quorem borrow = 0; carry = 0; do { @@ -2104,7 +2092,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev } while(sx <= sxe); if (!*bxe) { -@@ -2569,31 +1872,26 @@ quorem +@@ -2569,31 +1887,26 @@ quorem bx = b->x; sx = S->x; do { @@ -2145,7 +2133,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev } while(sx <= sxe); bx = b->x; -@@ -2607,49 +1905,6 @@ quorem +@@ -2607,75 +1920,10 @@ quorem return q; } @@ -2192,28 +2180,28 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev - return rv; - } - - /* freedtoa(s) must be used to free values s returned by dtoa - * when MULTIPLE_THREADS is #defined. It should be used in all cases, - * but for consistency with earlier versions of dtoa, it is optional -@@ -2663,19 +1918,19 @@ freedtoa(s) char *s; - freedtoa(char *s) - #endif - { +-/* freedtoa(s) must be used to free values s returned by dtoa +- * when MULTIPLE_THREADS is #defined. It should be used in all cases, +- * but for consistency with earlier versions of dtoa, it is optional +- * when MULTIPLE_THREADS is not defined. +- */ +- +- void +-#ifdef KR_headers +-freedtoa(s) char *s; +-#else +-freedtoa(char *s) +-#endif +-{ - Bigint *b = (Bigint *)((int *)s - 1); - b->maxwds = 1 << (b->k = *(int*)b); - Bfree(b); -+ Bigint *b = (Bigint *)((int *)s - 1); -+ b->maxwds = 1 << (b->k = *(int*)b); -+ Bfree(b); - #ifndef MULTIPLE_THREADS +-#ifndef MULTIPLE_THREADS - if (s == dtoa_result) - dtoa_result = 0; -+ if (s == dtoa_result) -+ dtoa_result = 0; - #endif +-#endif - } -+ } - +- /* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. * * Inspired by "How to Print Floating-Point Numbers Accurately" by @@ -2222,7 +2210,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev * * Modifications: * 1. Rather than iterating, we use a simple numeric overestimate -@@ -2706,13 +1961,13 @@ freedtoa(char *s) +@@ -2706,13 +1954,13 @@ freedtoa(char *s) * calculation. */ @@ -2240,7 +2228,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #endif { /* Arguments ndigits, decpt, sign are similar to those -@@ -2734,14 +1989,14 @@ dtoa +@@ -2734,14 +1982,14 @@ dtoa gives a return value similar to that from fcvt, except that trailing zeros are suppressed, and ndigits can be negative. @@ -2263,7 +2251,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev Values of mode other than 0-9 are treated as mode 0. -@@ -2758,21 +2013,19 @@ dtoa +@@ -2758,21 +2006,19 @@ dtoa ULong x; #endif Bigint *b, *b1, *delta, *mlo, *mhi, *S; @@ -2295,7 +2283,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev if (word0(d) & Sign_bit) { /* set sign for everything, including 0's and NaNs */ -@@ -2791,47 +2044,43 @@ dtoa +@@ -2791,47 +2037,43 @@ dtoa { /* Infinity or NaN */ *decpt = 9999; @@ -2362,7 +2350,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #endif /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 -@@ -2870,19 +2119,20 @@ dtoa +@@ -2870,19 +2112,20 @@ dtoa i = bbits + be + (Bias + (P-1) - 1); x = i > 32 ? word0(d) << 64 - i | word1(d) >> i - 32 : word1(d) << 32 - i; @@ -2386,7 +2374,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev k--; k_check = 0; } -@@ -2907,15 +2157,7 @@ dtoa +@@ -2907,15 +2150,7 @@ dtoa } if (mode < 0 || mode > 9) mode = 0; @@ -2402,7 +2390,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev if (mode > 5) { mode -= 4; try_quick = 0; -@@ -2946,19 +2188,18 @@ dtoa +@@ -2946,19 +2181,18 @@ dtoa if (i <= 0) i = 1; } @@ -2428,7 +2416,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev k0 = k; ilim0 = ilim; ieps = 2; /* conservative */ -@@ -2968,7 +2209,7 @@ dtoa +@@ -2968,7 +2202,7 @@ dtoa if (j & Bletch) { /* prevent overflows */ j &= Bletch - 1; @@ -2437,7 +2425,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev ieps++; } for(; j; j >>= 1, i++) -@@ -2976,32 +2217,32 @@ dtoa +@@ -2976,32 +2210,32 @@ dtoa ieps++; ds *= bigtens[i]; } @@ -2479,7 +2467,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev goto no_digits; goto fast_failed; } -@@ -3010,34 +2251,33 @@ dtoa +@@ -3010,34 +2244,33 @@ dtoa /* Use Steele & White method of only * generating digits needed. */ @@ -2527,7 +2515,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev while(*--s == '0'); s++; goto ret1; -@@ -3050,7 +2290,7 @@ dtoa +@@ -3050,7 +2283,7 @@ dtoa #endif fast_failed: s = s0; @@ -2536,7 +2524,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev k = k0; ilim = ilim0; } -@@ -3062,37 +2302,24 @@ dtoa +@@ -3062,37 +2295,24 @@ dtoa ds = tens[k]; if (ndigits < 0 && ilim <= 0) { S = mhi = 0; @@ -2582,7 +2570,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev bump_up: while(*--s == '9') if (s == s0) { -@@ -3104,6 +2331,8 @@ dtoa +@@ -3104,6 +2324,8 @@ dtoa } break; } @@ -2591,7 +2579,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev } goto ret1; } -@@ -3112,15 +2341,31 @@ dtoa +@@ -3112,15 +2334,31 @@ dtoa m5 = b5; mhi = mlo = 0; if (leftright) { @@ -2627,7 +2615,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev b2 += i; s2 += i; mhi = i2b(1); -@@ -3151,15 +2396,10 @@ dtoa +@@ -3151,15 +2389,10 @@ dtoa /* Check for special case that d is a normalized power of 2. */ @@ -2645,7 +2633,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev #endif ) { /* The special case */ -@@ -3167,6 +2407,8 @@ dtoa +@@ -3167,6 +2400,8 @@ dtoa s2 += Log2P; spec_case = 1; } @@ -2654,7 +2642,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev } /* Arrange for convenient computation of quotients: -@@ -3208,7 +2450,7 @@ dtoa +@@ -3208,7 +2443,7 @@ dtoa ilim = ilim1; } } @@ -2663,7 +2651,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev if (ilim < 0 || cmp(b,S = multadd(S,5,0)) <= 0) { /* no digits, fcvt style */ no_digits: -@@ -3245,41 +2487,20 @@ dtoa +@@ -3245,41 +2480,20 @@ dtoa j1 = delta->sign ? 1 : cmp(b, delta); Bfree(delta); #ifndef ROUND_BIASED @@ -2707,7 +2695,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev if (j1 > 0) { b = lshift(b, 1); j1 = cmp(b, S); -@@ -3287,15 +2508,10 @@ dtoa +@@ -3287,15 +2501,10 @@ dtoa && dig++ == '9') goto round_9_up; } @@ -2723,7 +2711,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev if (dig == '9') { /* possible if i == 1 */ round_9_up: *s++ = '9'; -@@ -3304,9 +2520,6 @@ dtoa +@@ -3304,9 +2513,6 @@ dtoa *s++ = dig + 1; goto ret; } @@ -2733,7 +2721,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev *s++ = dig; if (i == ilim) break; -@@ -3322,12 +2535,6 @@ dtoa +@@ -3322,12 +2528,6 @@ dtoa else for(i = 1;; i++) { *s++ = dig = quorem(b,S) + '0'; @@ -2746,7 +2734,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev if (i >= ilim) break; b = multadd(b, 10, 0); -@@ -3335,12 +2542,6 @@ dtoa +@@ -3335,12 +2535,6 @@ dtoa /* Round off last digit */ @@ -2759,7 +2747,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev b = lshift(b, 1); j = cmp(b, S); if (j > 0 || j == 0 && dig & 1) { -@@ -3354,7 +2555,6 @@ dtoa +@@ -3354,7 +2548,6 @@ dtoa ++*s++; } else { @@ -2767,7 +2755,7 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev while(*--s == '0'); s++; } -@@ -3366,18 +2566,11 @@ dtoa +@@ -3366,18 +2559,11 @@ dtoa Bfree(mhi); } ret1: @@ -2790,3 +2778,23 @@ $OpenBSD: patch-nsprpub_pr_src_misc_prdtoa_c,v 1.2 2006/02/05 02:39:18 pvalchev *s = 0; *decpt = k + 1; if (rve) +@@ -3402,8 +2588,10 @@ PR_dtoa(PRFloat64 d, PRIntn mode, PRIntn + PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); + return rv; + } ++ ACQUIRE_DTOA_LOCK(2); + result = dtoa(d, mode, ndigits, decpt, sign, rve); + if (!result) { ++ FREE_DTOA_LOCK(2); + PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + return rv; + } +@@ -3417,7 +2605,7 @@ PR_dtoa(PRFloat64 d, PRIntn mode, PRIntn + } + rv = PR_SUCCESS; + } +- freedtoa(result); ++ FREE_DTOA_LOCK(2); + return rv; + } +