Skip to content

Commit

Permalink
Fix ServiceController name population perf (dotnet/corefx#32072)
Browse files Browse the repository at this point in the history
* Fix ServiceController name population perf

* Split tests

* Remove dead field

* Remove new use of DangerousGetHandle

* SafeHandle all the things!

* VSB #1

* VSB dotnet#2

* Fix GLE

* Initialize machineName in ctor

* Test for empty name ex

* Null names

* Inadvertent edit

* Unix build

* Move interop into class

* Reverse SafeHandle for HAllocGlobal

* Fix tests

* Disable test for NETFX

* CR feedback

* Pattern matching on VSB

* Direct call

* typo

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
  • Loading branch information
danmoseley authored and dotnet-bot committed Sep 5, 2018
1 parent aee79af commit 99f8f58
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,22 @@ public void EnsureCapacity(int capacity)
Grow(capacity - _chars.Length);
}

/// <summary>
/// Get a pinnable reference to the builder.
/// Does not ensure there is a null char after <see cref="Length"/>
/// This overload is pattern matched in the C# 7.3+ compiler so you can omit
/// the explicit method call, and write eg "fixed (char* c = builder)"
/// </summary>
public ref char GetPinnableReference()
{
return ref MemoryMarshal.GetReference(_chars);
}

/// <summary>
/// Get a pinnable reference to the builder.
/// </summary>
/// <param name="terminate">Ensures that the builder has a null char after <see cref="Length"/></param>
public ref char GetPinnableReference(bool terminate = false)
public ref char GetPinnableReference(bool terminate)
{
if (terminate)
{
Expand Down

0 comments on commit 99f8f58

Please sign in to comment.