Commit graph

16625 commits

Author SHA1 Message Date
Nick Treleaven
7b8fbf0350 Remove unsafe opDispatch
Use @trusted lambda for DIGITAL_MARS_STDIO impl
2022-11-25 10:50:20 +00:00
Adam D. Ruppe
f710b083fd fix #23507 sockets are blocking by default, this needs to reflect that 2022-11-25 04:07:27 +01:00
Adam D. Ruppe
87ebb09b16 add Socket.release method to allow transitioning the handle from the object's ownership to outsdie control, so the destructor won't close it anymore 2022-11-24 00:50:37 +01:00
Nick Treleaven
4796637441 Add LockedFile.opDispatch 2022-11-19 20:26:01 +00:00
Nick Treleaven
89ce0c94de Remove LockedFile.fp method
We can use `fps` for `ferror` calls instead.
2022-11-19 17:08:00 +00:00
Nick Treleaven
59749cbc64 Remove 2 unnecessary vars 2022-11-19 14:42:03 +00:00
Nick Treleaven
96ac2e88c8 Tweak LockedFile unittest 2022-11-19 14:39:34 +00:00
Nick Treleaven
b5df5011a7 Move trusted_FGETC to LockedFile method 2022-11-19 14:39:07 +00:00
Nick Treleaven
b036f74ef2 Use LockedFile struct to enforce safe interface
Instead of wrong trusted_FUNLOCK.
Note: trusted_FGETC does have a @safe interface.
2022-11-17 11:51:10 +00:00
Nick Treleaven
9f05dd4d4a Remove unnecessary trusted lambda 2022-11-16 09:46:05 +00:00
Nick Treleaven
80be7fdba2 Revert "Use slice instead of pointer to avoid lambdas"
This reverts commit a5912ca262.
2022-11-16 09:45:36 +00:00
aG0aep6G
26c7f44de8 fix issue 23488 - std.format.sformat mishandles char ranges 2022-11-15 21:10:14 +01:00
Nick Treleaven
01c80ba94b fp._ptr arithmetic 2022-11-15 18:05:45 +00:00
Nick Treleaven
2da49ee4c8 Make ReadlnAppender.putonly take const array 2022-11-15 17:57:31 +00:00
Nick Treleaven
597e73fd93 3 more @trusted calls 2022-11-15 17:52:11 +00:00
Nick Treleaven
cf131b797d Make StdioException.opCall @safe 2022-11-15 17:40:33 +00:00
Nick Treleaven
a5912ca262 Use slice instead of pointer to avoid lambdas 2022-11-15 17:39:34 +00:00
Nick Treleaven
40df30bc6e Make readlnImpl @safe and use @trusted lambdas 2022-11-15 17:32:04 +00:00
RJ Nowling
6034c4f1ed Update parameter name to match documentation
The documentation for flip(size_t) indicates that the variable name is `pos`, but the parameter is named `i`.  This PR changes the parameter name to `pos` to match the documentation.
2022-11-15 06:26:05 +01:00
Nick Treleaven
5267ccf0b8 Make std.stdio.File.readln @safe 2022-11-14 15:38:54 +00:00
Lucian Danescu
c81788f512 style fix 2022-11-12 19:40:28 +02:00
Lucian Danescu
322fed7bf7 add local imports 2022-11-12 19:29:28 +02:00
Lucian Danescu
8293310cd8 rename variables 2022-11-09 23:28:55 +02:00
Lucian Danescu
452b1def78 same name fix 2022-11-07 19:20:19 +02:00
Lucian Danescu
cdee7e6939 remove redundant attributes in typecons.d 2022-11-04 21:52:10 +01:00
Paul Backus
be1dad3480 Fix 23453 - Generic iota should be a forward range 2022-11-03 14:39:25 -04:00
Per Nordlöw
b9ba6c2d97 Merge remote-tracking branch 'upstream/master' into avoid-EnumMembers-in-formatValueImpl-enum 2022-11-02 13:16:32 +01:00
Nick Treleaven
94997e70fb [std/array] Fix wrong Appender docs 'global locking for each append'
@schveiguy explained there is a thread-local cache that avoids a global
lock once the cache is filled.
See https://github.com/dlang/dlang.org/pull/3445#discussion_r1002773401.
Add link to spec (capacity LREF already exists just above Appender).
2022-11-01 19:18:27 +01:00
Iain Buclaw
e99ec12056
Merge pull request #8618 from ibuclaw/merge_stable
merge stable
2022-11-01 14:58:25 +01:00
Iain Buclaw
a2c7d6d7e9 Merge remote-tracking branch 'upstream/stable' into merge_stable 2022-11-01 11:40:20 +00:00
Razvan Nitu
68c8a87029
Merge pull request #8590 from nordlow/enforce-to-assert
Replace enforce(!empty with assert(!empty at the beginning of range m…
2022-11-01 17:45:50 +08:00
Razvan Nitu
e92aa0e9f4
Merge pull request #8595 from nordlow/reduce-put-in-formatValueImpl-enum
Avoid two calls to put in enum overload of formatValueImpl
2022-11-01 17:44:47 +08:00
Dennis
a3536c6d20
Merge pull request #8604 from ntrel/allocator-docs
Improve std.experimental.allocator docs
2022-10-24 11:49:18 +02:00
Per Nordlöw
05d6e97d1e Use ref element in foreach in assocArray to avoid any calls to copy constructor of element type 2022-10-20 14:12:46 +02:00
Bastiaan Veelo
afda65c58e
Clarify the format flags documentation. (#8612)
* Clarify the format flags documentation.

Resolve a `then`/`than` error and focus on what the flag does instead of on the default behaviour when the flag is absent. This way the descriptions for the `-` and `=` flags are more in line.
2022-10-19 05:37:49 +08:00
Nick Treleaven
6f62de0728 Fix assumeUnique RUNNABLE_EXAMPLE tests
These get wrapped in `void main {...}` by both dspec_tester and
run_examples.js. Workaround this.
2022-10-17 23:51:02 +02:00
Nick Treleaven
acde2b81cb Remove leading '*' from assumeUnique examples
That breaks `dlang.org/tools/dspec_tester.d` test extraction.
No other changes.
2022-10-17 16:44:01 +02:00
Luís Ferreira
957b460b70 chore(bitmanip): add missing attributes
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-10-17 00:38:30 +02:00
Paul Backus
94fa37f2bf Fix issue 23400 - Can't format enum value whose base type has non-const opEquals 2022-10-16 17:46:21 -04:00
Nick Treleaven
281f42d306
Fix missing unittests in docs (#8603)
* Fix missing staticArray unittest in docs

Found using https://github.com/dlang/dmd/pull/14527.

* Fix missing FloatRep and DoubleRep unittests in docs

* 2 JSONValue op overloads

* std.random

* detabber

* remove

* std.digest.murmurhash
2022-10-17 05:43:13 +08:00
Nick Treleaven
14eb9f8432 Replace broken BitmappedBlock example with Region 2022-10-16 16:59:06 +01:00
Nick Treleaven
4a9668ea24 Tweak std.experimental.allocator docs
Add missing LREFs in top table.
Use RUNNABLE_EXAMPLE.
2022-10-16 14:26:19 +01:00
Geod24
9f008f2485 Remove usages of 'in' on Windows C bindings 2022-10-14 13:32:48 +02:00
Per Nordlöw
829afd9783 Merge remote-tracking branch 'upstream/master' into reduce-put-in-formatValueImpl-enum 2022-10-14 10:06:31 +02:00
Mathias LANG
3c97810b36
Re-instate accidentally reverted fixes on RefCounted (#8599)
Those fixes were done in PR #8509 but PR #8368 accidentally reverted them.
2022-10-14 06:23:22 +08:00
Per Nordlöw
b1c705c697
Use early return in formatValueImpl to reduce indentation (#8600) 2022-10-14 06:19:02 +08:00
Per Nordlöw
28aec22c22
Add isAllocator (#8598) 2022-10-13 17:42:03 +08:00
deadalnix
60b78df799
Optimize isHexDigit (#8597) 2022-10-13 10:49:06 +08:00
deadalnix
ab74cf6708 Improve isAlphaNum
Using recent version of LDC, here are the codegen I get:
```
        lea     eax, [rdi - 48]
        cmp     eax, 74
        ja      .LBB2_1
        lea     ecx, [rdi - 97]
        mov     al, 1
        cmp     ecx, -39
        jb      .LBB2_4
        add     edi, -65
        cmp     edi, 26
        setb    al
.LBB2_4:
        ret
.LBB2_1:
        xor     eax, eax
        ret
```

And now:
```
        lea     eax, [rdi - 48]
        cmp     eax, 9
        setb    cl
        or      edi, 32
        add     edi, -97
        cmp     edi, 26
        setb    al
        or      al, cl
        ret
```

Which is much better all around: less instructions, no branches, etc...

I will note that doing `isDigit(c) || isAlpha(c)` also gives me good codegen using LDC, but I chose against it as DMD fails to inline properly and the end result is pretty bad.
2022-10-12 23:30:09 +02:00
deadalnix
f22ef1ac82 Simplify isAlpha
The codegen is literally the same.

I could have delegated to std/ascii, and in fact, I do think this would be the right thing to do int he absence of DMD's inliner being what it is.
2022-10-12 23:29:57 +02:00