Skip to content

Commit 3e64f99

Browse files
authored
Replace val with fun to fix init order (#3158)
1 parent 60b9269 commit 3e64f99

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

ktor-http/ktor-http-cio/common/src/io/ktor/http/cio/internals/CharArrayPool.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package io.ktor.http.cio.internals
66

77
import io.ktor.utils.io.pool.*
88

9-
internal expect val DISABLE_CHAR_ARRAY_POOLING: Boolean
9+
internal expect fun isPoolingDisabled(): Boolean
1010

1111
internal const val CHAR_ARRAY_POOL_SIZE = 4096
1212

@@ -15,7 +15,7 @@ internal const val CHAR_ARRAY_POOL_SIZE = 4096
1515
*/
1616
internal const val CHAR_BUFFER_ARRAY_LENGTH: Int = 4096 / 2
1717

18-
internal val CharArrayPool: ObjectPool<CharArray> = if (DISABLE_CHAR_ARRAY_POOLING) {
18+
internal val CharArrayPool: ObjectPool<CharArray> = if (isPoolingDisabled()) {
1919
object : NoPoolImpl<CharArray>() {
2020
override fun borrow(): CharArray {
2121
return CharArray(CHAR_BUFFER_ARRAY_LENGTH)

ktor-http/ktor-http-cio/js/src/io/ktor/http/cio/internals/CharArrayPoolJs.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
package io.ktor.http.cio.internals
66

7-
internal actual val DISABLE_CHAR_ARRAY_POOLING: Boolean = false
7+
internal actual fun isPoolingDisabled(): Boolean = false

ktor-http/ktor-http-cio/jvm/src/io/ktor/http/cio/internals/CharArrayPoolJvm.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
package io.ktor.http.cio.internals
66

7-
internal actual val DISABLE_CHAR_ARRAY_POOLING: Boolean =
7+
internal actual fun isPoolingDisabled(): Boolean =
88
System.getProperty("ktor.internal.cio.disable.chararray.pooling")?.toBoolean() ?: false

ktor-http/ktor-http-cio/posix/src/io/ktor/http/cio/internals/CharArrayPoolPosix.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
package io.ktor.http.cio.internals
66

7-
internal actual val DISABLE_CHAR_ARRAY_POOLING: Boolean = false
7+
internal actual fun isPoolingDisabled(): Boolean = false

0 commit comments

Comments
 (0)