aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDundar Goc <gocdundar@gmail.com>2022-05-07 12:53:37 +0200
committerDundar Goc <gocdundar@gmail.com>2022-06-10 16:16:41 +0200
commita732c253b71f89702285d5ec6fd7803045f6add9 (patch)
treecd6b0dbad292dcbfaae637ffad385298594a2ff2 /config
parente15d31b530c443daea04d7a772b24da737397c53 (diff)
downloadrneovim-a732c253b71f89702285d5ec6fd7803045f6add9.tar.gz
rneovim-a732c253b71f89702285d5ec6fd7803045f6add9.tar.bz2
rneovim-a732c253b71f89702285d5ec6fd7803045f6add9.zip
refactor: change type of linenr_T from long to int32_t
The size of long varies depending on architecture, in contrast to the MAXLNUM constant which sets the maximum allowable number of lines to 2^32-1. This discrepancy may lead to hard to detect bugs, for example https://github.com/neovim/neovim/issues/18454. Setting linenr_T to a fix maximum size of 2^32-1 will prevent this type of errors in the future. Also change the variables `amount` and `amount_after` to be linenr_T since they're referring to "the line number difference" between two texts.
Diffstat (limited to 'config')
-rw-r--r--config/CMakeLists.txt1
-rw-r--r--config/config.h.in1
2 files changed, 2 insertions, 0 deletions
diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt
index abc6dde008..1f5885758c 100644
--- a/config/CMakeLists.txt
+++ b/config/CMakeLists.txt
@@ -8,6 +8,7 @@ include(CheckCSourceCompiles)
check_type_size("int" SIZEOF_INT LANGUAGE C)
check_type_size("long" SIZEOF_LONG LANGUAGE C)
check_type_size("intmax_t" SIZEOF_INTMAX_T LANGUAGE C)
+check_type_size("int32_t" SIZEOF_INT32_T LANGUAGE C)
check_type_size("size_t" SIZEOF_SIZE_T LANGUAGE C)
check_type_size("long long" SIZEOF_LONG_LONG LANGUAGE C)
check_type_size("void *" SIZEOF_VOID_PTR LANGUAGE C)
diff --git a/config/config.h.in b/config/config.h.in
index 72ac87bbb3..59be83fb5e 100644
--- a/config/config.h.in
+++ b/config/config.h.in
@@ -5,6 +5,7 @@
#cmakedefine SIZEOF_INT @SIZEOF_INT@
#cmakedefine SIZEOF_INTMAX_T @SIZEOF_INTMAX_T@
+#cmakedefine SIZEOF_INT32_T @SIZEOF_INT32_T@
#cmakedefine SIZEOF_LONG @SIZEOF_LONG@
#cmakedefine SIZEOF_LONG_LONG @SIZEOF_LONG_LONG@
#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@