Use int as the standard type for boolean options.

All options are accessed by passing char_u pointers around, casting the
pointer to the right pointer type for the specific option, and then
dereferencing that pointer.

This dance works fine on little-endian systems when some bool options
are int types (as in Vim) and some are bool types (as would make more
sense), but on big-endian systems *(int *)varp when varp is pointing to
a bool will read random memory.

Therefore, all boolean options must remain a consistent type and int is
currently the easiest to choose.
This commit is contained in:
James McCoy
2016-10-30 23:18:29 -04:00
parent 349fa0048b
commit 87ff2682d7
3 changed files with 16 additions and 18 deletions

View File

@@ -488,7 +488,7 @@ struct file_buffer {
bool file_id_valid;
FileID file_id;
bool b_changed; /* 'modified': Set to true if something in the
int b_changed; /* 'modified': Set to true if something in the
file has been changed and not written out. */
int b_changedtick; /* incremented for each change, also for undo */
@@ -655,7 +655,7 @@ struct file_buffer {
long b_p_sts; ///< 'softtabstop'
long b_p_sts_nopaste; ///< b_p_sts saved for paste mode
char_u *b_p_sua; ///< 'suffixesadd'
bool b_p_swf; ///< 'swapfile'
int b_p_swf; ///< 'swapfile'
long b_p_smc; ///< 'synmaxcol'
char_u *b_p_syn; ///< 'syntax'
long b_p_ts; ///< 'tabstop'