X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=sv.c;h=2dea64f7014e0e99d22c9b34d4d62bd06ce19885;hb=c8984b0bd19897e6e30588055ac0338326f20a34;hp=fdeed681f51cdd01f23c971d7acc076f8f0c91a8;hpb=2d8e6c8d50eaf50f663a5fd184404c73944226e0;p=p5sagit%2Fp5-mst-13.2.git diff --git a/sv.c b/sv.c index fdeed68..2dea64f 100644 --- a/sv.c +++ b/sv.c @@ -4413,10 +4413,6 @@ sv_vcatpvfn(SV *sv, const char *pat, STRLEN patlen, va_list *args, SV **svargs, char *eptr = Nullch; STRLEN elen = 0; char ebuf[TYPE_DIGITS(int) * 2 + 16]; /* large enough for "%#.#f" */ - - static char *efloatbuf = Nullch; - static STRLEN efloatsize = 0; - char c; int i; unsigned base; @@ -4645,6 +4641,10 @@ sv_vcatpvfn(SV *sv, const char *pat, STRLEN patlen, va_list *args, SV **svargs, base = 10; goto uns_integer; + case 'b': + base = 2; + goto uns_integer; + case 'O': intsize = 'l'; /* FALL THROUGH */ @@ -4700,6 +4700,14 @@ sv_vcatpvfn(SV *sv, const char *pat, STRLEN patlen, va_list *args, SV **svargs, if (alt && *eptr != '0') *--eptr = '0'; break; + case 2: + do { + dig = uv & 1; + *--eptr = '0' + dig; + } while (uv >>= 1); + if (alt && *eptr != '0') + *--eptr = '0'; + break; default: /* it had better be ten or less */ do { dig = uv % base; @@ -4746,10 +4754,10 @@ sv_vcatpvfn(SV *sv, const char *pat, STRLEN patlen, va_list *args, SV **svargs, need = width; need += 20; /* fudge factor */ - if (efloatsize < need) { - Safefree(efloatbuf); - efloatsize = need + 20; /* more fudge */ - New(906, efloatbuf, efloatsize, char); + if (PL_efloatsize < need) { + Safefree(PL_efloatbuf); + PL_efloatsize = need + 20; /* more fudge */ + New(906, PL_efloatbuf, PL_efloatsize, char); } eptr = ebuf + sizeof ebuf; @@ -4774,10 +4782,10 @@ sv_vcatpvfn(SV *sv, const char *pat, STRLEN patlen, va_list *args, SV **svargs, *--eptr = '#'; *--eptr = '%'; - (void)sprintf(efloatbuf, eptr, nv); + (void)sprintf(PL_efloatbuf, eptr, nv); - eptr = efloatbuf; - elen = strlen(efloatbuf); + eptr = PL_efloatbuf; + elen = strlen(PL_efloatbuf); #ifdef LC_NUMERIC /*