Use a better variable name for w

This commit is contained in:
Takashi Kokubun 2023-10-04 09:40:08 -07:00
Родитель 577ff858bc
Коммит 7db6f448ed
3 изменённых файлов: 8 добавлений и 7 удалений

4
ruby.c
Просмотреть файл

@ -296,12 +296,12 @@ show_usage_line(const struct ruby_opt_message *m,
void
ruby_show_usage_line(const char *name, const char *secondary, const char *description,
int help, int highlight, unsigned int w, int columns)
int help, int highlight, unsigned int width, int columns)
{
unsigned int namelen = (unsigned int)strlen(name);
unsigned int secondlen = (secondary ? (unsigned int)strlen(secondary) : 0);
show_usage_part(name, namelen, secondary, secondlen,
description, help, highlight, w, columns);
description, help, highlight, width, columns);
}
static void

2
yjit.h
Просмотреть файл

@ -43,7 +43,7 @@ void rb_yjit_iseq_free(void *payload);
void rb_yjit_before_ractor_spawn(void);
void rb_yjit_constant_ic_update(const rb_iseq_t *const iseq, IC ic, unsigned insn_idx);
void rb_yjit_tracing_invalidate_all(void);
void rb_yjit_show_usage(int help, int highlight, unsigned int w, int columns);
void rb_yjit_show_usage(int help, int highlight, unsigned int width, int columns);
#else
// !USE_YJIT

Просмотреть файл

@ -244,16 +244,17 @@ pub fn parse_option(str_ptr: *const std::os::raw::c_char) -> Option<()> {
return Some(());
}
/// Print YJIT options for `ruby --help`.
/// Print YJIT options for `ruby --help`. `width` is width of option parts, and
/// `columns` is indent width of descriptions.
#[no_mangle]
pub extern "C" fn rb_yjit_show_usage(help: c_int, highlight: c_int, w: c_uint, columns: c_int) {
pub extern "C" fn rb_yjit_show_usage(help: c_int, highlight: c_int, width: c_uint, columns: c_int) {
for &(name, description) in YJIT_OPTIONS.iter() {
extern "C" {
fn ruby_show_usage_line(name: *const c_char, secondary: *const c_char, description: *const c_char,
help: c_int, highlight: c_int, w: c_uint, columns: c_int);
help: c_int, highlight: c_int, width: c_uint, columns: c_int);
}
let name = CString::new(name).unwrap();
let description = CString::new(description).unwrap();
unsafe { ruby_show_usage_line(name.as_ptr(), null(), description.as_ptr(), help, highlight, w, columns) }
unsafe { ruby_show_usage_line(name.as_ptr(), null(), description.as_ptr(), help, highlight, width, columns) }
}
}