diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-15 11:52:26 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-15 11:52:26 +0200 |
commit | 73c9788a7bd64a7f74d9e40b8ab5963817dad59e (patch) | |
tree | e9cc21dcda6bcd5c3471602fcec634299856d970 | |
parent | 2cf74b74d1c57940037d23c4a7b44ba2afd38725 (diff) | |
download | chawan-73c9788a7bd64a7f74d9e40b8ab5963817dad59e.tar.gz |
Fix compilation with --assertions:off
Remove side effects from assert statements. The flag is not used currently, but let's not depend on that.
-rw-r--r-- | src/io/serialize.nim | 3 | ||||
-rw-r--r-- | src/local/client.nim | 6 | ||||
-rw-r--r-- | src/server/buffer.nim | 3 | ||||
-rw-r--r-- | src/server/forkserver.nim | 6 | ||||
-rw-r--r-- | src/utils/twtstr.nim | 3 |
5 files changed, 14 insertions, 7 deletions
diff --git a/src/io/serialize.nim b/src/io/serialize.nim index fd558ba9..bb65d157 100644 --- a/src/io/serialize.nim +++ b/src/io/serialize.nim @@ -320,7 +320,8 @@ proc sread*(stream: Stream, blob: var Blob) = blob.buffer = alloc(blob.size) blob.deallocFun = dealloc if blob.size > 0: - assert stream.readData(blob.buffer, int(blob.size)) == int(blob.size) + let n = stream.readData(blob.buffer, int(blob.size)) + assert n == int(blob.size) func slen*(blob: Blob): int = result += slen(blob.isfile) diff --git a/src/local/client.nim b/src/local/client.nim index 7b27e9c4..70293d70 100644 --- a/src/local/client.nim +++ b/src/local/client.nim @@ -407,7 +407,8 @@ proc inputLoop(client: Client) = client.attrs = getWindowAttributes(client.console.tty) client.pager.windowChange(client.attrs) if selectors.Event.Timer in event.events: - assert client.timeouts.runTimeoutFd(event.fd) + let r = client.timeouts.runTimeoutFd(event.fd) + assert r client.runJSJobs() client.console.container.requestLines().then(proc() = client.console.container.cursorLastLine()) @@ -439,7 +440,8 @@ proc headlessLoop(client: Client) = if Error in event.events: client.handleError(event.fd) if selectors.Event.Timer in event.events: - assert client.timeouts.runTimeoutFd(event.fd) + let r = client.timeouts.runTimeoutFd(event.fd) + assert r client.runJSJobs() client.loader.unregistered.setLen(0) client.acceptBuffers() diff --git a/src/server/buffer.nim b/src/server/buffer.nim index 5bdef808..fb87c719 100644 --- a/src/server/buffer.nim +++ b/src/server/buffer.nim @@ -1445,7 +1445,8 @@ proc runBuffer(buffer: Buffer, rfd: int) = break if selectors.Event.Timer in event.events: assert buffer.window != nil - assert buffer.window.timeouts.runTimeoutFd(event.fd) + let r = buffer.window.timeouts.runTimeoutFd(event.fd) + assert r buffer.window.runJSJobs() buffer.loader.unregistered.setLen(0) diff --git a/src/server/forkserver.nim b/src/server/forkserver.nim index fafaf9c9..7fa7a63f 100644 --- a/src/server/forkserver.nim +++ b/src/server/forkserver.nim @@ -96,7 +96,8 @@ proc forkLoader(ctx: var ForkServerContext, config: LoaderConfig): Pid = var readf: File if not open(readf, FileHandle(readfd), fmRead): raise newException(Defect, "Failed to open output handle.") - assert readf.readChar() == char(0u8) + let c = readf.readChar() + assert c == char(0u8) close(readf) discard close(pipefd[0]) return pid @@ -152,7 +153,8 @@ proc forkBuffer(ctx: var ForkServerContext): Pid = doAssert false discard close(pipefd[1]) # close write let ps = newPosixStream(pipefd[0]) - assert ps.readChar() == char(0) + let c = ps.readChar() + assert c == char(0) ps.close() ctx.children.add((pid, loaderPid)) return pid diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim index 33806ba3..257bdc66 100644 --- a/src/utils/twtstr.nim +++ b/src/utils/twtstr.nim @@ -633,7 +633,8 @@ func processIdna(str: string, checkhyphens, checkbidi, checkjoiners, transitiona var cr: CharRange {.cast(noSideEffect).}: cr_init(addr cr, nil, passRealloc) - assert unicode_general_category(addr cr, "Mark") == 0 + let r = unicode_general_category(addr cr, "Mark") + assert r == 0 var labels: seq[string] for label in ($mapped).split('.'): if label.startsWith("xn--"): |