mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 08:56:29 +00:00
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.
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
#ifndef NVIM_POS_H
|
||||
#define NVIM_POS_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
/// Line number type
|
||||
typedef long linenr_T;
|
||||
typedef int32_t linenr_T;
|
||||
/// Format used to print values which have linenr_T type
|
||||
#define PRIdLINENR "ld"
|
||||
#define PRIdLINENR PRId32
|
||||
|
||||
/// Column number type
|
||||
typedef int colnr_T;
|
||||
|
Reference in New Issue
Block a user