>Author: tommaso >Date: Wed Dec 30 23:21:23 2009 >New Revision: 32682 >URL: http://www.lyx.org/trac/changeset/32682 > >Log: >Code cleanup. > >Modified: lyx-devel/trunk/src/lyxfind.cpp >======================================================================= ======= > bool next_open_buffer(Buffer * & p_buf) { > p_buf = theBufferList().next(p_buf); > return p_buf == *theBufferList().begin(); > } > > bool prev_open_buffer(Buffer * & p_buf) { > p_buf = theBufferList().previous(p_buf); > return p_buf == *(theBufferList().end() - 1); > }
Is it still worth the effort to have these two functions? You can just rewrite as: case FindAndReplaceOptions::S_OPEN_BUFFERS: next_buf = theBufferList().previous(p_buf); prompt = next_buf == *(theBufferList().end() - 1); Then we are also rid of the non-const pointer parameters that are changed in a function (which makes the code just hard to read if someone else will ever dive into this code). Vincent