styleCheck: Fix some inconsistent identifiers (#16177)
This commit is contained in:
parent
29c9a1c14b
commit
297c8e403d
20 changed files with 64 additions and 64 deletions
|
|
@ -182,7 +182,7 @@ proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} =
|
|||
elif returnType.kind == nnkEmpty:
|
||||
baseType = returnType
|
||||
else:
|
||||
verifyReturnType(repr(returnType), returntype)
|
||||
verifyReturnType(repr(returnType), returnType)
|
||||
|
||||
let subtypeIsVoid = returnType.kind == nnkEmpty or
|
||||
(baseType.kind == nnkIdent and returnType[1].eqIdent("void"))
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ proc signal(cv: var Semaphore) =
|
|||
const CacheLineSize = 32 # true for most archs
|
||||
|
||||
type
|
||||
Barrier {.compilerProc.} = object
|
||||
Barrier {.compilerproc.} = object
|
||||
entered: int
|
||||
cv: Semaphore # Semaphore takes 3 words at least
|
||||
when sizeof(int) < 8:
|
||||
|
|
@ -63,26 +63,26 @@ type
|
|||
cacheAlign2: array[CacheLineSize-sizeof(int), byte]
|
||||
interest: bool # whether the master is interested in the "all done" event
|
||||
|
||||
proc barrierEnter(b: ptr Barrier) {.compilerProc, inline.} =
|
||||
proc barrierEnter(b: ptr Barrier) {.compilerproc, inline.} =
|
||||
# due to the signaling between threads, it is ensured we are the only
|
||||
# one with access to 'entered' so we don't need 'atomicInc' here:
|
||||
inc b.entered
|
||||
# also we need no 'fence' instructions here as soon 'nimArgsPassingDone'
|
||||
# will be called which already will perform a fence for us.
|
||||
|
||||
proc barrierLeave(b: ptr Barrier) {.compilerProc, inline.} =
|
||||
proc barrierLeave(b: ptr Barrier) {.compilerproc, inline.} =
|
||||
atomicInc b.left
|
||||
when not defined(x86): fence()
|
||||
# We may not have seen the final value of b.entered yet,
|
||||
# so we need to check for >= instead of ==.
|
||||
if b.interest and b.left >= b.entered: signal(b.cv)
|
||||
|
||||
proc openBarrier(b: ptr Barrier) {.compilerProc, inline.} =
|
||||
proc openBarrier(b: ptr Barrier) {.compilerproc, inline.} =
|
||||
b.entered = 0
|
||||
b.left = 0
|
||||
b.interest = false
|
||||
|
||||
proc closeBarrier(b: ptr Barrier) {.compilerProc.} =
|
||||
proc closeBarrier(b: ptr Barrier) {.compilerproc.} =
|
||||
fence()
|
||||
if b.left != b.entered:
|
||||
b.cv.initSemaphore()
|
||||
|
|
@ -114,7 +114,7 @@ type
|
|||
FlowVarObj[T] = object of FlowVarBaseObj
|
||||
blob: T
|
||||
|
||||
FlowVar*{.compilerProc.}[T] = ref FlowVarObj[T] ## A data flow variable.
|
||||
FlowVar*{.compilerproc.}[T] = ref FlowVarObj[T] ## A data flow variable.
|
||||
|
||||
ToFreeQueue = object
|
||||
len: int
|
||||
|
|
@ -212,14 +212,14 @@ proc `=destroy`[T](fv: var FlowVarObj[T]) =
|
|||
finished(fv)
|
||||
`=destroy`(fv.blob)
|
||||
|
||||
proc nimCreateFlowVar[T](): FlowVar[T] {.compilerProc.} =
|
||||
proc nimCreateFlowVar[T](): FlowVar[T] {.compilerproc.} =
|
||||
new(result)
|
||||
|
||||
proc nimFlowVarCreateSemaphore(fv: FlowVarBase) {.compilerProc.} =
|
||||
proc nimFlowVarCreateSemaphore(fv: FlowVarBase) {.compilerproc.} =
|
||||
fv.cv.initSemaphore()
|
||||
fv.usesSemaphore = true
|
||||
|
||||
proc nimFlowVarSignal(fv: FlowVarBase) {.compilerProc.} =
|
||||
proc nimFlowVarSignal(fv: FlowVarBase) {.compilerproc.} =
|
||||
if fv.ai != nil:
|
||||
acquire(fv.ai.cv.L)
|
||||
fv.ai.idx = fv.idx
|
||||
|
|
@ -305,7 +305,7 @@ proc isReady*(fv: FlowVarBase): bool =
|
|||
else:
|
||||
result = true
|
||||
|
||||
proc nimArgsPassingDone(p: pointer) {.compilerProc.} =
|
||||
proc nimArgsPassingDone(p: pointer) {.compilerproc.} =
|
||||
let w = cast[ptr Worker](p)
|
||||
signal(w.taskStarted)
|
||||
|
||||
|
|
@ -489,7 +489,7 @@ var
|
|||
|
||||
initLock stateLock
|
||||
|
||||
proc nimSpawn3(fn: WorkerProc; data: pointer) {.compilerProc.} =
|
||||
proc nimSpawn3(fn: WorkerProc; data: pointer) {.compilerproc.} =
|
||||
# implementation of 'spawn' that is used by the code generator.
|
||||
while true:
|
||||
if selectWorker(readyWorker, fn, data): return
|
||||
|
|
@ -574,7 +574,7 @@ var
|
|||
|
||||
initLock distinguishedLock
|
||||
|
||||
proc nimSpawn4(fn: WorkerProc; data: pointer; id: ThreadId) {.compilerProc.} =
|
||||
proc nimSpawn4(fn: WorkerProc; data: pointer; id: ThreadId) {.compilerproc.} =
|
||||
acquire(distinguishedLock)
|
||||
if not distinguishedData[id].initialized:
|
||||
activateDistinguishedThread(id)
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ proc close*(ev: SelectEvent) =
|
|||
raiseIOSelectorsError(osLastError())
|
||||
|
||||
proc selectInto*[T](s: Selector[T], timeout: int,
|
||||
results: var openarray[ReadyKey]): int =
|
||||
results: var openArray[ReadyKey]): int =
|
||||
var maxres = MAX_POLL_EVENTS
|
||||
if maxres > len(results):
|
||||
maxres = len(results)
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ proc unregister*[T](s: Selector[T], ev: SelectEvent) =
|
|||
s.delKey(fd)
|
||||
|
||||
proc selectInto*[T](s: Selector[T], timeout: int,
|
||||
results: var openarray[ReadyKey]): int =
|
||||
results: var openArray[ReadyKey]): int =
|
||||
var tv = Timeval()
|
||||
var ptv = addr tv
|
||||
var rset, wset, eset: FdSet
|
||||
|
|
|
|||
|
|
@ -232,8 +232,8 @@ proc open*(filename: string, mode: FileMode = fmRead,
|
|||
|
||||
if newFileSize != -1:
|
||||
flags = flags or O_CREAT or O_TRUNC
|
||||
var permissions_mode = S_IRUSR or S_IWUSR
|
||||
result.handle = open(filename, flags, permissions_mode)
|
||||
var permissionsMode = S_IRUSR or S_IWUSR
|
||||
result.handle = open(filename, flags, permissionsMode)
|
||||
else:
|
||||
result.handle = open(filename, flags)
|
||||
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ proc getProtoByName*(name: string): int {.since: (1, 3, 5).} =
|
|||
let protoent = posix.getprotobyname(name.cstring)
|
||||
|
||||
if protoent == nil:
|
||||
raise newException(OsError, "protocol not found")
|
||||
raise newException(OSError, "protocol not found")
|
||||
|
||||
result = protoent.p_proto.int
|
||||
|
||||
|
|
|
|||
|
|
@ -551,7 +551,7 @@ when defineSsl:
|
|||
|
||||
proc newContext*(protVersion = protSSLv23, verifyMode = CVerifyPeer,
|
||||
certFile = "", keyFile = "", cipherList = CiphersIntermediate,
|
||||
caDir = "", caFile = ""): SSLContext =
|
||||
caDir = "", caFile = ""): SslContext =
|
||||
## Creates an SSL context.
|
||||
##
|
||||
## Protocol version specifies the protocol to use. SSLv2, SSLv3, TLSv1
|
||||
|
|
@ -644,7 +644,7 @@ when defineSsl:
|
|||
if not found:
|
||||
raise newException(IOError, "No SSL/TLS CA certificates found.")
|
||||
|
||||
result = SSLContext(context: newCTX, referencedData: initHashSet[int](),
|
||||
result = SslContext(context: newCTX, referencedData: initHashSet[int](),
|
||||
extraInternal: new(SslContextExtraInternal))
|
||||
|
||||
proc getExtraInternal(ctx: SslContext): SslContextExtraInternal =
|
||||
|
|
@ -750,7 +750,7 @@ when defineSsl:
|
|||
## Wildcards match only in the left-most label.
|
||||
## When name starts with a dot it will be matched by a certificate valid for any subdomain
|
||||
when not defined(nimDisableCertificateValidation) and not defined(windows):
|
||||
assert socket.isSSL
|
||||
assert socket.isSsl
|
||||
let certificate = socket.sslHandle.SSL_get_peer_certificate()
|
||||
if certificate.isNil:
|
||||
raiseSSLError("No SSL certificate found.")
|
||||
|
|
@ -763,7 +763,7 @@ when defineSsl:
|
|||
if match != 1:
|
||||
raiseSSLError("SSL Certificate check failed.")
|
||||
|
||||
proc wrapConnectedSocket*(ctx: SSLContext, socket: Socket,
|
||||
proc wrapConnectedSocket*(ctx: SslContext, socket: Socket,
|
||||
handshake: SslHandshakeType,
|
||||
hostname: string = "") =
|
||||
## Wraps a connected socket in an SSL context. This function effectively
|
||||
|
|
|
|||
|
|
@ -161,13 +161,13 @@ proc decode*(encoded: string): string {.raises: [PunyError].} =
|
|||
break
|
||||
w *= Base - t
|
||||
k += Base
|
||||
bias = adapt(i - oldi, runelen(result) + 1, oldi == 0)
|
||||
bias = adapt(i - oldi, runeLen(result) + 1, oldi == 0)
|
||||
|
||||
if i div (runelen(result) + 1) > high(int32) - n:
|
||||
if i div (runeLen(result) + 1) > high(int32) - n:
|
||||
raise newException(PunyError, "Value too large")
|
||||
|
||||
n += i div (runelen(result) + 1)
|
||||
i = i mod (runelen(result) + 1)
|
||||
n += i div (runeLen(result) + 1)
|
||||
i = i mod (runeLen(result) + 1)
|
||||
insert(result, $Rune(n), i)
|
||||
inc i
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ when defined(nimdoc):
|
|||
## Unregisters file/socket descriptor ``fd`` from selector ``s``.
|
||||
|
||||
proc selectInto*[T](s: Selector[T], timeout: int,
|
||||
results: var openarray[ReadyKey]): int =
|
||||
results: var openArray[ReadyKey]): int =
|
||||
## Waits for events registered in selector ``s``.
|
||||
##
|
||||
## The ``timeout`` argument specifies the maximum number of milliseconds
|
||||
|
|
|
|||
|
|
@ -112,17 +112,17 @@ proc quitExcpt(smtp: Smtp, msg: string) =
|
|||
const compiledWithSsl = defined(ssl)
|
||||
|
||||
when not defined(ssl):
|
||||
let defaultSSLContext: SSLContext = nil
|
||||
let defaultSSLContext: SslContext = nil
|
||||
else:
|
||||
var defaultSSLContext {.threadvar.}: SSLContext
|
||||
var defaultSSLContext {.threadvar.}: SslContext
|
||||
|
||||
proc getSSLContext(): SSLContext =
|
||||
proc getSSLContext(): SslContext =
|
||||
if defaultSSLContext == nil:
|
||||
defaultSSLContext = newContext(verifyMode = CVerifyNone)
|
||||
result = defaultSSLContext
|
||||
|
||||
proc createMessage*(mSubject, mBody: string, mTo, mCc: seq[string],
|
||||
otherHeaders: openarray[tuple[name, value: string]]): Message =
|
||||
otherHeaders: openArray[tuple[name, value: string]]): Message =
|
||||
## Creates a new MIME compliant message.
|
||||
##
|
||||
## You need to make sure that ``mSubject``, ``mTo`` and ``mCc`` don't contain
|
||||
|
|
@ -172,7 +172,7 @@ proc `$`*(msg: Message): string =
|
|||
result.add(msg.msgBody)
|
||||
|
||||
proc newSmtp*(useSsl = false, debug = false,
|
||||
sslContext: SSLContext = nil): Smtp =
|
||||
sslContext: SslContext = nil): Smtp =
|
||||
## Creates a new ``Smtp`` instance.
|
||||
new result
|
||||
result.debug = debug
|
||||
|
|
@ -187,7 +187,7 @@ proc newSmtp*(useSsl = false, debug = false,
|
|||
{.error: "SMTP module compiled without SSL support".}
|
||||
|
||||
proc newAsyncSmtp*(useSsl = false, debug = false,
|
||||
sslContext: SSLContext = nil): AsyncSmtp =
|
||||
sslContext: SslContext = nil): AsyncSmtp =
|
||||
## Creates a new ``AsyncSmtp`` instance.
|
||||
new result
|
||||
result.debug = debug
|
||||
|
|
@ -222,7 +222,7 @@ proc checkReply*(smtp: Smtp | AsyncSmtp, reply: string) {.multisync.} =
|
|||
## `SMTP extensions<https://en.wikipedia.org/wiki/Extended_SMTP>`_.
|
||||
|
||||
var line = await smtp.debugRecv()
|
||||
if not line.startswith(reply):
|
||||
if not line.startsWith(reply):
|
||||
await quitExcpt(smtp, "Expected " & reply & " reply, got: " & line)
|
||||
|
||||
proc helo*(smtp: Smtp | AsyncSmtp) {.multisync.} =
|
||||
|
|
@ -239,7 +239,7 @@ proc connect*(smtp: Smtp | AsyncSmtp,
|
|||
await smtp.checkReply("220")
|
||||
await smtp.helo()
|
||||
|
||||
proc startTls*(smtp: Smtp | AsyncSmtp, sslContext: SSLContext = nil) {.multisync.} =
|
||||
proc startTls*(smtp: Smtp | AsyncSmtp, sslContext: SslContext = nil) {.multisync.} =
|
||||
## Put the SMTP connection in TLS (Transport Layer Security) mode.
|
||||
## May fail with ReplyError
|
||||
await smtp.debugSend("STARTTLS\c\L")
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import strutils
|
|||
|
||||
# FWIW look for files before scanning entire dirs.
|
||||
|
||||
const certificate_paths = [
|
||||
const certificatePaths = [
|
||||
# Debian, Ubuntu, Arch: maintained by update-ca-certificates, SUSE, Gentoo
|
||||
# NetBSD (security/mozilla-rootcerts)
|
||||
# SLES10/SLES11, https://golang.org/issue/12139
|
||||
|
|
@ -77,7 +77,7 @@ iterator scanSSLCertificates*(useEnvVars = false): string =
|
|||
|
||||
else:
|
||||
when not defined(haiku):
|
||||
for p in certificate_paths:
|
||||
for p in certificatePaths:
|
||||
if p.endsWith(".pem") or p.endsWith(".crt"):
|
||||
if fileExists(p):
|
||||
yield p
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ proc push*(s: var RunningStat, x: int) =
|
|||
## and the other push operation is called.
|
||||
s.push(toFloat(x))
|
||||
|
||||
proc push*(s: var RunningStat, x: openarray[float|int]) =
|
||||
proc push*(s: var RunningStat, x: openArray[float|int]) =
|
||||
## pushes all values of `x` for processing.
|
||||
##
|
||||
## Int values of `x` are simply converted to ``float`` and
|
||||
|
|
@ -277,7 +277,7 @@ proc push*(r: var RunningRegress, x, y: int) {.inline.} =
|
|||
## and the other push operation is called.
|
||||
r.push(toFloat(x), toFloat(y))
|
||||
|
||||
proc push*(r: var RunningRegress, x, y: openarray[float|int]) =
|
||||
proc push*(r: var RunningRegress, x, y: openArray[float|int]) =
|
||||
## pushes two sets of values `x` and `y` for processing.
|
||||
assert(x.len == y.len)
|
||||
for i in 0..<x.len:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue