Skip to content

Commit

Permalink
Auto-convert to D2
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-palmer-sociomantic committed Oct 1, 2019
1 parent 20d8c8f commit 32460bb
Show file tree
Hide file tree
Showing 354 changed files with 2,730 additions and 2,730 deletions.
2 changes: 1 addition & 1 deletion .D2-ready
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Enables D2 testing in Jenkins
ONLY
2 changes: 1 addition & 1 deletion integrationtest/flexiblefilequeue/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void main ()
auto test_dir = DirectorySandbox.create(["flexiblefilequeue"]);
scope (exit) test_dir.remove();

const istring test_file = "testfile";
static immutable istring test_file = "testfile";


static void pushItems (FlexibleFileQueue queue, size_t size)
Expand Down
6 changes: 3 additions & 3 deletions integrationtest/httpserver/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import core.stdc.errno;
import core.stdc.stdlib;

/// The payload of the HTTP response.
const response_payload = "Hello World!";
static immutable response_payload = "Hello World!";

/// The server address, initialised in `main` and used by both the server and
/// the client.
Expand All @@ -47,7 +47,7 @@ class TestHttpHandler: TaskHttpConnectionHandler
{
import ocean.io.Stdout;

public this ( FinalizeDg finalizer )
public this ( scope FinalizeDg finalizer )
{
super(finalizer, HttpMethod.Get);
}
Expand Down Expand Up @@ -171,7 +171,7 @@ static class ResponseParser
char[] response;
/// The token that denotes the end of the HTTP header and the beginning of
/// the payload.
const end_of_header_token = "\r\n\r\n";
static immutable end_of_header_token = "\r\n\r\n";
/// true if `end_of_header_token` has been fond in `response`.
bool have_payload;
/// The index in `response` after `end_of_header_token`.
Expand Down
2 changes: 1 addition & 1 deletion integrationtest/selectlistener/UnixServer.d
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private class UnixConnectionHandler: IFiberConnectionHandler
***************************************************************************/

public this ( FinalizeDg finalize_dg, EpollSelectDispatcher epoll )
public this ( scope FinalizeDg finalize_dg, EpollSelectDispatcher epoll )
{
super(epoll, new UnixSocket, finalize_dg);

Expand Down
4 changes: 2 additions & 2 deletions integrationtest/signalfd/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private class SignalFDTest
***************************************************************************/

private const max_signal = 32;
private static immutable max_signal = 32;


/***************************************************************************
Expand Down Expand Up @@ -431,7 +431,7 @@ private class SignalFDTest
while (ret == -1 && errno == EINTR);
enforce (ret == 0);

const int timeout_ms = 100; // just in case
static immutable int timeout_ms = 100; // just in case
epoll_event_t[1] fired_events;
auto epoll_res = epoll.wait(fired_events, timeout_ms);

Expand Down
4 changes: 2 additions & 2 deletions integrationtest/unixsocket/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ import core.thread;

import ocean.text.util.StringC;

const istring CLIENT_STRING = "Hello from the client";
static immutable istring CLIENT_STRING = "Hello from the client";

const istring SERVER_STRING = "Hello from the server";
static immutable istring SERVER_STRING = "Hello from the server";

int runClient ( sockaddr_un* socket_address )
{
Expand Down
46 changes: 23 additions & 23 deletions src/ocean/LibFeatures.d
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@

module ocean.LibFeatures;

const has_features_4_2 = true;
const has_features_4_1 = true;
const has_features_4_0 = true;
const has_features_3_9 = true;
const has_features_3_8 = true;
const has_features_3_7 = true;
const has_features_3_6 = true;
const has_features_3_5 = true;
const has_features_3_4 = true;
const has_features_3_3 = true;
const has_features_3_2 = true;
const has_features_3_1 = true;
const has_features_3_0 = true;
const has_features_2_10 = true;
const has_features_2_9 = true;
const has_features_2_8 = true;
const has_features_2_7 = true;
const has_features_2_6 = true;
const has_features_2_5 = true;
const has_features_2_4 = true;
const has_features_2_3 = true;
const has_features_2_1 = true;
const has_features_2_0 = true;
static immutable has_features_4_2 = true;
static immutable has_features_4_1 = true;
static immutable has_features_4_0 = true;
static immutable has_features_3_9 = true;
static immutable has_features_3_8 = true;
static immutable has_features_3_7 = true;
static immutable has_features_3_6 = true;
static immutable has_features_3_5 = true;
static immutable has_features_3_4 = true;
static immutable has_features_3_3 = true;
static immutable has_features_3_2 = true;
static immutable has_features_3_1 = true;
static immutable has_features_3_0 = true;
static immutable has_features_2_10 = true;
static immutable has_features_2_9 = true;
static immutable has_features_2_8 = true;
static immutable has_features_2_7 = true;
static immutable has_features_2_6 = true;
static immutable has_features_2_5 = true;
static immutable has_features_2_4 = true;
static immutable has_features_2_3 = true;
static immutable has_features_2_1 = true;
static immutable has_features_2_0 = true;
26 changes: 13 additions & 13 deletions src/ocean/application/components/PidLock.d
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public struct PidLock

public void parseConfig ( ConfigParser config )
{
this.pidlock_path = config.get("PidLock", "path", "").dup;
(&this).pidlock_path = config.get("PidLock", "path", "").dup;
}

/***************************************************************************
Expand All @@ -84,12 +84,12 @@ public struct PidLock

public void lock ( )
{
if (this.pidlock_path.length)
if ((&this).pidlock_path.length)
{
istring msg =
idup("Couldn't lock the pid lock file '" ~ this.pidlock_path
idup("Couldn't lock the pid lock file '" ~ (&this).pidlock_path
~ "'. Probably another instance of the application is running.");
enforce(this.tryLockPidFile(), msg);
enforce((&this).tryLockPidFile(), msg);
}
}

Expand All @@ -104,14 +104,14 @@ public struct PidLock

public void unlock ( )
{
if (!this.is_locked)
if (!(&this).is_locked)
{
return;
}

// releases the lock and closes the lock file
this.enforcePosix!(close)(this.lock_fd);
this.enforcePosix!(unlink)(StringC.toCString(this.pidlock_path));
(&this).enforcePosix!(close)((&this).lock_fd);
(&this).enforcePosix!(unlink)(StringC.toCString((&this).pidlock_path));
}

/***************************************************************************
Expand All @@ -134,11 +134,11 @@ public struct PidLock

private bool tryLockPidFile ( )
{
this.lock_fd = this.enforcePosix!(open)(StringC.toCString(this.pidlock_path),
(&this).lock_fd = (&this).enforcePosix!(open)(StringC.toCString((&this).pidlock_path),
O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);

// TODO these will be available in tango v1.6.0
const F_SETLK = 6;
enum F_SETLK = 6;

// Lock the pidfile
flock fl;
Expand All @@ -147,7 +147,7 @@ public struct PidLock
fl.l_start = 0;
fl.l_len = 0;

if (fcntl(this.lock_fd, F_SETLK, &fl) == -1)
if (fcntl((&this).lock_fd, F_SETLK, &fl) == -1)
{
// Region already locked, can't acquire a lock
if (errno == EAGAIN || errno == EACCES)
Expand All @@ -161,14 +161,14 @@ public struct PidLock
}

// Clear the any previous contents of the file
this.enforcePosix!(ftruncate)(this.lock_fd, 0);
(&this).enforcePosix!(ftruncate)((&this).lock_fd, 0);

char[512] buf;
auto pid_string = snformat(buf, "{}\n", getpid());

this.writeNonInterrupted(this.lock_fd, pid_string);
(&this).writeNonInterrupted((&this).lock_fd, pid_string);

this.is_locked = true;
(&this).is_locked = true;
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ocean/application/components/Signals.d
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public class Signals
***************************************************************************/

public this ( HandlerDg handler_dg )
public this ( scope HandlerDg handler_dg )
{
verify(handler_dg !is null);
this.handler_dg = handler_dg;
Expand Down
4 changes: 2 additions & 2 deletions src/ocean/application/components/TaskScheduler.d
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void parseSchedulerConfig ( ConfigParser parser,
if (parser is null)
return;

const category = "SCHEDULER";
static immutable category = "SCHEDULER";

foreach (idx, ref field; config.tupleof)
{
Expand Down Expand Up @@ -92,7 +92,7 @@ public void parseSchedulerConfig ( ConfigParser parser,
*******************************************************************************/

public int runInTask ( int delegate () dg )
public int runInTask ( scope int delegate () dg )
{
auto task = new class Task {
int delegate() dg;
Expand Down
6 changes: 3 additions & 3 deletions src/ocean/application/components/Timers.d
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public class Timers
***************************************************************************/

public void register ( EventDg dg, double period_s )
public void register ( scope EventDg dg, double period_s )
{
verify(dg !is null);
verify(period_s >= 0.0);
Expand All @@ -131,7 +131,7 @@ public class Timers
***************************************************************************/

public void register ( EventDg dg, double init_s, double period_s )
public void register ( scope EventDg dg, double init_s, double period_s )
{
verify(dg !is null);
verify(init_s >= 0.0);
Expand All @@ -157,7 +157,7 @@ public class Timers
***************************************************************************/

public void registerMicrosec ( EventDg dg, ulong init_microsec, ulong period_microsec )
public void registerMicrosec ( scope EventDg dg, ulong init_microsec, ulong period_microsec )
{
verify(dg !is null);

Expand Down
4 changes: 2 additions & 2 deletions src/ocean/core/Array.d
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ unittest
test(concat_test(dest, staticstr1, staticstr2), "Static array concatenation test failed");

// Check manifest constant array concatenation
const conststr1 = "hi ";
const conststr2 = "there";
static immutable conststr1 = "hi ";
static immutable conststr2 = "there";
test(concat_test(dest, conststr1, conststr2), "Const array concatenation test failed");
}

Expand Down
Loading

0 comments on commit 32460bb

Please sign in to comment.