Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always pass 9 parameters to tparm() #218

Merged
merged 1 commit into from
Jul 30, 2017
Merged

Always pass 9 parameters to tparm() #218

merged 1 commit into from
Jul 30, 2017

Conversation

mptre
Copy link
Owner

@mptre mptre commented Jul 30, 2017

Some implementations like NetBSD have a non-variadic prototype of
tparm() requiring 9 explicit parameters. Therefore always make sure to
pass 9 parameters. Since other implementations uses a variadic prototype
it will work on them as well.

Inspired by how this solved in the portable version of tmux.

@ghost
Copy link

ghost commented Jul 30, 2017

It works, but gcc (nb2 20150115) 4.8.5 on NetBSD 7.1 complains again:

pick.c:315:4: error: passing argument 1 of 'tty_parm1' discards 'const' qualifier from pointer target type [-Werror]

so it should be tty_parm1(const char *, int) ... and please rename it to tty_parm or tty_tparm :-)

@mptre
Copy link
Owner Author

mptre commented Jul 30, 2017

so it should be tty_parm1(const char *, int)

Well that doesn't work on OpenBSD since:

char *tparm(char *, ...);

... and on NetBSD:

char *tparm(const char *, ...);

It's not pretty but the updated commit should work, please confirm.

@mptre mptre force-pushed the tparm branch 2 times, most recently from 843a450 to eea9ffc Compare July 30, 2017 18:45
Some implementations like NetBSD have a non-variadic prototype of
tparm() requiring 9 explicit parameters. Therefore always make sure to
pass 9 parameters. Since other implementations uses a variadic prototype
it will work on them as well.

Inspired by how this solved in the portable version of tmux.

Spotted by Jenz Guenther in PR #216 and later fixed in PR #218.
@ghost
Copy link

ghost commented Jul 30, 2017

Confirmed.

@mptre mptre merged commit d3a158d into master Jul 30, 2017
@mptre mptre deleted the tparm branch July 30, 2017 18:53
@mptre
Copy link
Owner Author

mptre commented Jul 30, 2017

Thanks, merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant