Skip to content

Commit 5ac1941

Browse files
author
Michail Pevnev
committed
Extract callback type aliases into a GC-allowed block.
It turns out, it's completely OK for a `@nogc` to receive a GC-allowed function as an argument, you just can't call it. Passing it to some other routine is fine as well. Moreover, it's not forbidden to pass a `@nogc` function where a GC-allowed one is expected. So the only thing that needs to be done is to put the callback type aliases into a block without `@nogc`, so they are not marked as such.
1 parent 101803b commit 5ac1941

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

source/deimos/ncurses/curses.d

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,8 +925,6 @@ int vid_attr(chtype a, ...)
925925
* These functions are extensions - not in X/Open Curses.
926926
*/
927927
//TODO Check
928-
alias int function(WINDOW *, void *) NCURSES_WINDOW_CB;
929-
alias int function(SCREEN *, void *) NCURSES_SCREEN_CB;
930928

931929
bool is_term_resized(int lines, int columns);
932930
char* keybound(int keycode, int count);
@@ -1492,3 +1490,12 @@ body
14921490
}
14931491

14941492
}//end extern (C)
1493+
1494+
// Things where @nogc would be needlessly limiting.
1495+
extern (C) nothrow
1496+
{
1497+
1498+
alias int function(WINDOW *, void *) NCURSES_WINDOW_CB;
1499+
alias int function(SCREEN *, void *) NCURSES_SCREEN_CB;
1500+
1501+
}

0 commit comments

Comments
 (0)