This patch series reworks the choose-mode internals to stop using a literal u_int for identifying chosen elements to some data structure, and instead returns a pointer to a struct.
Currently the choose-* commands are returned a u_int representing either a window or session or some other index which can be looked up. These changes instead get each choose-* command to store a pointer to a struct, and for each callback, that struct pointer is returned and used instead. These patches shouldn't alter any of the functionality of the existing choose-* commands, and that's the entire point of them. They're only here to pave the way to allow for choose-tree, and in doing this centralise a lot of code which is currently per choose-* command, but which choose-tree would need access to, without having to reimplement it itself. I apologise for the illogical ordering of these patches. They're a little rough-and-ready, but I'm keen to flesh out the internals of this before I continue. So some observations/ideas (in no particular order): * I don't like the free() callbacks to each cmd-choose-* file. Ideally we should probably look at centralising these where appropriate, perhaps in window_choose_free()? * I am unsure if I've broken the reference counting on ctx->curclient and ctx->curclient->session in each of the choose-* commands. There's probably more, but I can't think of it. Oh, this applies directly on top of my xfree(NULL) patches, by the way. :P Hope that's not going to cause too many problems. Any questions, do please ask. Kindly, -- Thomas Adam Thomas Adam (14): Introduce window_choose_ctx() Convert choose-buffer to use window_choose_ctx() Convert choose-session to use window_choose_ctx() Convert choose-window to use window_choose_ctx() choose-buffer: Remove unused struct. Remove choose-struct from cmd-window-choose.c window_choose_add() to adopt window_choose_data* Removed window-choose-vadd Use window_choose_data in window-choose Convert choose-buffer to use window_choose_data Convert choose-client to use window_choose_data Convert choose-session to use window_choose_data Convert choose-window to use window_choose_data Convert find-window to use window_choose_data trunk/cmd-choose-buffer.c | 87 +++++++++++----------------------- trunk/cmd-choose-client.c | 87 +++++++++++++--------------------- trunk/cmd-choose-session.c | 90 +++++++++++++---------------------- trunk/cmd-choose-window.c | 99 ++++++++++++++------------------------- trunk/cmd-find-window.c | 56 +++++++++++----------- trunk/tmux.h | 26 +++++++++-- trunk/window-choose.c | 111 ++++++++++++++++++++++++++++++-------------- 7 files changed, 250 insertions(+), 306 deletions(-) -- 1.7.10 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users