@@ -43,7 +43,7 @@ private struct Demangle
43
43
// allocation during the course of a parsing run, this is still
44
44
// faster than assembling the result piecemeal.
45
45
46
-
46
+ pure :
47
47
enum AddType { no, yes }
48
48
49
49
@@ -506,10 +506,7 @@ private struct Demangle
506
506
507
507
tbuf[tlen] = 0 ;
508
508
debug (info) printf( " got (%s)\n " , tbuf.ptr );
509
- import core.stdc.stdlib : strtold;
510
- val = strtold( tbuf.ptr, null );
511
- import core.stdc.stdio : snprintf;
512
- tlen = snprintf( tbuf.ptr, tbuf.length, " %#Lg" , val );
509
+ pureReprintReal( tbuf.ptr, tbuf.length );
513
510
debug (info) printf( " converted (%.*s)\n " , cast (int ) tlen, tbuf.ptr );
514
511
put( tbuf[0 .. tlen] );
515
512
}
@@ -2389,3 +2386,23 @@ string decodeDmdString( const(char)[] ln, ref size_t p )
2389
2386
}
2390
2387
return s;
2391
2388
}
2389
+
2390
+ // locally purified for internal use here only
2391
+ extern (C ) private
2392
+ {
2393
+ pure @trusted @nogc nothrow pragma (mangle, " fakePureReprintReal" ) real pureReprintReal(char * nptr, size_t len);
2394
+
2395
+ char * fakePureReprintReal (char * nptr, size_t len)
2396
+ {
2397
+ import core.stdc.stdlib : strtold;
2398
+ import core.stdc.stdio : snprintf;
2399
+ import core.stdc.errno : errno;
2400
+
2401
+ const err = errno;
2402
+ real val = strtold(nptr, null );
2403
+ len = snprintf(nptr, len, " %#Lg" , val);
2404
+ errno = err;
2405
+
2406
+ return nptr;
2407
+ }
2408
+ }
0 commit comments