Skip to content

Commit

Permalink
Replace usage of "in ref" with "ref const"
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberShadow committed Sep 13, 2020
1 parent d1b1cc3 commit afa3782
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions net/http/common.d
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ public:
}

/// Called by the server to compress content, if possible/appropriate
final package void optimizeData(in ref Headers requestHeaders)
final package void optimizeData(ref const Headers requestHeaders)
{
auto acceptEncoding = requestHeaders.get("Accept-Encoding", null);
if (acceptEncoding && "Content-Encoding" !in headers)
Expand Down Expand Up @@ -531,7 +531,7 @@ public:
}

/// Called by the server to apply range request.
final package void sliceData(in ref Headers requestHeaders)
final package void sliceData(ref const Headers requestHeaders)
{
if (status == HttpStatusCode.OK)
{
Expand Down
4 changes: 2 additions & 2 deletions sys/btrfs/clone_range.d
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ struct btrfs_ioctl_clone_range_args
public:

void cloneRange(
in ref File srcFile, ulong srcOffset,
in ref File dstFile, ulong dstOffset,
ref const File srcFile, ulong srcOffset,
ref const File dstFile, ulong dstOffset,
ulong length)
{
btrfs_ioctl_clone_range_args args;
Expand Down
4 changes: 2 additions & 2 deletions sys/d/manager.d
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ EOF");
static assert(false);

/// Returns the command for the make utility.
string[] getMake(in ref Environment env)
string[] getMake(ref const Environment env)
{
version (FreeBSD)
enum makeProgram = "gmake"; // GNU make
Expand All @@ -782,7 +782,7 @@ EOF");
assert(dDoTestEscape(`C:\Foo boo bar\baz quuz\derp.exe`) == `C:\"Foo boo bar"\"baz quuz"\derp.exe`);
}

string[] getPlatformMakeVars(in ref Environment env, string model, bool quote = true)
string[] getPlatformMakeVars(ref const Environment env, string model, bool quote = true)
{
string[] args;

Expand Down
2 changes: 1 addition & 1 deletion sys/file.d
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,7 @@ version (linux)
return XAttrs!(const(char)*, "l")(path.toStringz());
}

auto xAttrs(in ref File f)
auto xAttrs(ref const File f)
{
return XAttrs!(int, "f")(f.fileno);
}
Expand Down
4 changes: 2 additions & 2 deletions sys/net/cachedcurl.d
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class CachedCurlNetwork : Network
int maxRedirects = int.min; // choose depending or method
}

/*private*/ static void req(CachedCurlNetwork instance, in ref Request request, string target, string metadataPath)
/*private*/ static void req(CachedCurlNetwork instance, ref const Request request, string target, string metadataPath)
{
with (instance)
{
Expand Down Expand Up @@ -166,7 +166,7 @@ class CachedCurlNetwork : Network
}
}

Response cachedReq(in ref Request request)
Response cachedReq(ref const Request request)
{
auto hash = getDigestString!MD5(request.url ~ cast(char)request.method ~ request.data);
auto path = buildPath(cacheDir, hash[0..2], hash);
Expand Down
6 changes: 3 additions & 3 deletions utils/aa.d
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ private
// as structs always have non-zero size.
static:

size_t length(in ref ValueType v) nothrow
size_t length(ref const ValueType v) nothrow
{
static if (is(T == Void))
static if (multi)
Expand Down Expand Up @@ -648,13 +648,13 @@ public:

static if (ordered)
{
size_t indexOf()(auto ref in K k)
size_t indexOf()(auto ref const K k)
{
auto p = k in lookup;
return p ? (*p)[0] : -1;
}

size_t[] indicesOf()(auto ref in K k)
size_t[] indicesOf()(auto ref const K k)
{
auto p = k in lookup;
return p ? (*p)[] : null;
Expand Down
4 changes: 2 additions & 2 deletions utils/array.d
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ sizediff_t indexOf(T)(in T[] arr, in T[] val) /// ditto
}

/// Index of element, no BS.
sizediff_t indexOfElement(T, D)(in T[] arr, auto ref in D val)
sizediff_t indexOfElement(T, D)(in T[] arr, auto ref const D val)
if (is(typeof(arr[0]==val)))
{
foreach (i, ref v; arr)
Expand All @@ -201,7 +201,7 @@ sizediff_t indexOfElement(T, D)(in T[] arr, auto ref in D val)
}

/// Whether array contains value, no BS.
bool contains(T, V)(in T[] arr, auto ref in V val)
bool contains(T, V)(in T[] arr, auto ref const V val)
if (is(typeof(arr[0]==val)))
{
return arr.indexOfElement(val) >= 0;
Expand Down
2 changes: 1 addition & 1 deletion utils/text/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ void arrayFromHex(HexParseConfig config = HexParseConfig.init)(in char[] hex, ub
}

/// Fast version for static arrays of known length.
void sarrayFromHex(HexParseConfig config = HexParseConfig.init, size_t N, Hex)(in ref Hex hex, ref ubyte[N] buf)
void sarrayFromHex(HexParseConfig config = HexParseConfig.init, size_t N, Hex)(ref const Hex hex, ref ubyte[N] buf)
if (is(Hex == char[N*2]))
{
foreach (i; 0..N/4)
Expand Down

0 comments on commit afa3782

Please sign in to comment.