Browse Source

- Removed one of the constructors of `SafeLLamaHandleBase`, which implicitly states that memory is owned. Better to be explicit about this kind of thing!

- Also fixed `ToString()` in `SafeLLamaHandleBase`
tags/v0.10.0
Martin Evans 2 years ago
parent
commit
5da2a2f64b
3 changed files with 3 additions and 10 deletions
  1. +1
    -1
      LLama/LLamaContext.cs
  2. +1
    -1
      LLama/Native/SafeLLamaGrammarHandle.cs
  3. +1
    -8
      LLama/Native/SafeLLamaHandleBase.cs

+ 1
- 1
LLama/LLamaContext.cs View File

@@ -443,7 +443,7 @@ namespace LLama
: SafeLLamaHandleBase
{
internal State(IntPtr memory)
: base(memory)
: base(memory, true)
{
}



+ 1
- 1
LLama/Native/SafeLLamaGrammarHandle.cs View File

@@ -21,7 +21,7 @@ namespace LLama.Native
/// </summary>
/// <param name="handle"></param>
internal SafeLLamaGrammarHandle(IntPtr handle)
: base(handle)
: base(handle, true)
{
}



+ 1
- 8
LLama/Native/SafeLLamaHandleBase.cs View File

@@ -14,12 +14,6 @@ namespace LLama.Native
{
}

private protected SafeLLamaHandleBase(IntPtr handle)
: base(IntPtr.Zero, ownsHandle: true)
{
SetHandle(handle);
}

private protected SafeLLamaHandleBase(IntPtr handle, bool ownsHandle)
: base(IntPtr.Zero, ownsHandle)
{
@@ -30,7 +24,6 @@ namespace LLama.Native
public override bool IsInvalid => handle == IntPtr.Zero;

/// <inheritdoc />
public override string ToString()
=> $"0x{handle:x16}";
public override string ToString() => handle.ToString();
}
}

Loading…
Cancel
Save