-
Notifications
You must be signed in to change notification settings - Fork 36
Do not use wattr_set() if wattr_get() is unavailable #132
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2783,7 +2783,7 @@ window_setscrreg(VALUE obj, VALUE top, VALUE bottom) | |
| #endif | ||
| } | ||
|
|
||
| #if defined(USE_COLOR) && (defined(HAVE_WCOLOR_SET) || defined(HAVE_WATTR_SET)) | ||
| #if defined(USE_COLOR) && ((defined(HAVE_WATTR_SET) && defined(HAVE_WATTR_GET)) || defined(HAVE_WCOLOR_SET)) | ||
| /* | ||
| * Document-method: Curses::Window.color_set | ||
| * call-seq: color_set(col) | ||
|
|
@@ -2810,13 +2810,11 @@ window_color_set(VALUE obj, VALUE col) | |
| return Qfalse; | ||
| return (wattr_set(winp->window, attrs, NUM2INT(col), NULL) == OK) ? Qtrue : Qfalse; | ||
| } | ||
| #elif defined(HAVE_WATTR_SET) | ||
| return (wattr_set(winp->window, 0, NUM2INT(col), NULL) == OK) ? Qtrue : Qfalse; | ||
| #else | ||
| return (wcolor_set(winp->window, NUM2INT(col), NULL) == OK) ? Qtrue : Qfalse; | ||
| #endif | ||
|
Comment on lines
2814
to
2815
|
||
| } | ||
| #endif /* defined(USE_COLOR) && (defined(HAVE_WCOLOR_SET) || defined(HAVE_WATTR_SET)) */ | ||
| #endif /* defined(USE_COLOR) && ((defined(HAVE_WATTR_SET) && defined(HAVE_WATTR_GET)) || defined(HAVE_WCOLOR_SET)) */ | ||
|
|
||
| /* | ||
| * Document-method: Curses::Window.scroll | ||
|
|
@@ -5286,9 +5284,9 @@ Init_curses(void) | |
| rb_define_method(cWindow, "move", window_move, 2); | ||
| rb_define_method(cWindow, "move_relative", window_move_relative, 2); | ||
| rb_define_method(cWindow, "setpos", window_setpos, 2); | ||
| #if defined(USE_COLOR) && (defined(HAVE_WCOLOR_SET) || defined(HAVE_WATTR_SET)) | ||
| #if defined(USE_COLOR) && ((defined(HAVE_WATTR_SET) && defined(HAVE_WATTR_GET)) || defined(HAVE_WCOLOR_SET)) | ||
| rb_define_method(cWindow, "color_set", window_color_set, 1); | ||
| #endif /* USE_COLOR && (HAVE_WCOLOR_SET || HAVE_WATTR_SET) */ | ||
| #endif | ||
| rb_define_method(cWindow, "cury", window_cury, 0); | ||
| rb_define_method(cWindow, "curx", window_curx, 0); | ||
| rb_define_method(cWindow, "maxy", window_maxy, 0); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compile-time guard for defining
window_color_setwas tightened to requireHAVE_WATTR_GETwhen usingHAVE_WATTR_SET, but the laterrb_define_method(..., "color_set", window_color_set, ...)guard in this file still usesHAVE_WATTR_SETalone. On platforms whereHAVE_WATTR_SETis defined butHAVE_WATTR_GETis not (andHAVE_WCOLOR_SETis also not defined), this will lead to a build failure becausewindow_color_setis not compiled but is still referenced. Please update therb_define_methodguard to match this new condition (or otherwise ensurewindow_color_setis always available when referenced).