Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive

utf.d: use safe construct for .ptr instead#1616

Merged
andralex merged 1 commit intodlang:masterfrom
WalterBright:utf-safe
Jul 20, 2016
Merged

utf.d: use safe construct for .ptr instead#1616
andralex merged 1 commit intodlang:masterfrom
WalterBright:utf-safe

Conversation

@WalterBright
Copy link
Member

Blocking dlang/dmd#5860

@WalterBright WalterBright changed the title use safe construct for .ptr instead utf.d: use safe construct for .ptr instead Jul 19, 2016
@andralex
Copy link
Member

noice

@andralex
Copy link
Member

Auto-merge toggled on

@schveiguy
Copy link
Member

schveiguy commented Jul 20, 2016

Hm... since we know that r has a 0 termination, we know that r[0] is valid.

Seems like a wasteful bounds check. But of course, this can be a further enhancement, needs a @trusted escape.

ugh, and then there's the r.length = s.length + 1 followed by r.length = 0. Which does nothing except throw away an allocation :)

@andralex andralex merged commit 4830414 into dlang:master Jul 20, 2016
@WalterBright
Copy link
Member Author

ugh, and then there's the r.length = s.length + 1 followed by r.length = 0. Which does nothing except throw away an allocation :)

It's meant to reserve the space, not throw away the allocation.

@aG0aep6G
Copy link
Contributor

It's meant to reserve the space, not throw away the allocation.

Would need assumeSafeAppend to make that work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants