aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-04-13 06:39:30 +0800
committerGitHub <noreply@github.com>2024-04-13 06:39:30 +0800
commit4f3d018d15d299b66a341bed4d677d7ec03ad44f (patch)
treee79ecb738cb33e606495e141054c184a8e1caf6a /src/nvim/ex_docmd.c
parent64aa0f7d0b7034a5158401cf6b987cb82cc60031 (diff)
downloadrneovim-4f3d018d15d299b66a341bed4d677d7ec03ad44f.tar.gz
rneovim-4f3d018d15d299b66a341bed4d677d7ec03ad44f.tar.bz2
rneovim-4f3d018d15d299b66a341bed4d677d7ec03ad44f.zip
vim-patch:9.0.2180: POSIX function name in exarg causes issues (#28308)
Problem: POSIX function name in exarg struct causes issues on OpenVMS Solution: Rename getline member in exarg struct to ea_getline, remove isinf() workaround for VMS There are compilers that do not treat well POSIX functions - like getline - usage in the structs. Older VMS compilers could digest this... but the newer OpenVMS compilers ( like VSI C x86-64 X7.4-843 (GEM 50XB9) ) cannot deal with these structs. This could be limited to getline() that is defined via getdelim() and might not affect all POSIX functions in general - but avoiding POSIX function names usage in the structs is a "safe side" practice without compromising the functionality or the code readability. The previous OpenVMS X86 port used a workaround limiting the compiler capabilities using __CRTL_VER_OVERRIDE=80400000 In order to make the OpenVMS port future proof, this pull request proposes a possible solution. closes: vim/vim#13704 https://github.com/vim/vim/commit/6fdb6280821a822768df5689a5d727e37d38306c Co-authored-by: Zoltan Arpadffy <zoltan.arpadffy@gmail.com>
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 318d2e4ff2..e0a5e3e2bb 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -144,7 +144,7 @@ struct loop_cookie {
int current_line; // last read line from growarray
int repeating; // true when looping a second time
// When "repeating" is false use "getline" and "cookie" to get lines
- char *(*getline)(int, void *, int, bool);
+ LineGetter lc_getline;
void *cookie;
};
@@ -622,7 +622,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
cmd_cookie = (void *)&cmd_loop_cookie;
cmd_loop_cookie.lines_gap = &lines_ga;
cmd_loop_cookie.current_line = current_line;
- cmd_loop_cookie.getline = fgetline;
+ cmd_loop_cookie.lc_getline = fgetline;
cmd_loop_cookie.cookie = cookie;
cmd_loop_cookie.repeating = (current_line < lines_ga.ga_len);
@@ -1003,10 +1003,10 @@ static char *get_loop_line(int c, void *cookie, int indent, bool do_concat)
}
char *line;
// First time inside the ":while"/":for": get line normally.
- if (cp->getline == NULL) {
+ if (cp->lc_getline == NULL) {
line = getcmdline(c, 0, indent, do_concat);
} else {
- line = cp->getline(c, cp->cookie, indent, do_concat);
+ line = cp->lc_getline(c, cp->cookie, indent, do_concat);
}
if (line != NULL) {
store_loop_line(cp->lines_gap, line);
@@ -1043,7 +1043,7 @@ bool getline_equal(LineGetter fgetline, void *cookie, LineGetter func)
LineGetter gp = fgetline;
struct loop_cookie *cp = (struct loop_cookie *)cookie;
while (gp == get_loop_line) {
- gp = cp->getline;
+ gp = cp->lc_getline;
cp = cp->cookie;
}
return gp == func;
@@ -1061,7 +1061,7 @@ void *getline_cookie(LineGetter fgetline, void *cookie)
LineGetter gp = fgetline;
struct loop_cookie *cp = (struct loop_cookie *)cookie;
while (gp == get_loop_line) {
- gp = cp->getline;
+ gp = cp->lc_getline;
cp = cp->cookie;
}
return cp;
@@ -1488,7 +1488,7 @@ bool parse_cmdline(char *cmdline, exarg_T *eap, CmdParseInfo *cmdinfo, const cha
.line2 = 1,
.cmd = cmdline,
.cmdlinep = &cmdline,
- .getline = NULL,
+ .ea_getline = NULL,
.cookie = NULL,
};
@@ -1997,7 +1997,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
// The "ea" structure holds the arguments that can be used.
ea.cmd = *cmdlinep;
ea.cmdlinep = cmdlinep;
- ea.getline = fgetline;
+ ea.ea_getline = fgetline;
ea.cookie = cookie;
ea.cstack = cstack;
@@ -2472,7 +2472,7 @@ int parse_command_modifiers(exarg_T *eap, const char **errormsg, cmdmod_T *cmod,
// in ex mode, an empty line works like :+
if (*eap->cmd == NUL && exmode_active
- && getline_equal(eap->getline, eap->cookie, getexline)
+ && getline_equal(eap->ea_getline, eap->cookie, getexline)
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
eap->cmd = "+";
if (!skip_only) {