Eliminate make_cleanup_ui_file_delete
And now that ui_file_as_string is in, let's eliminate it. :-) Makes ui_file a real C++ hierarchy. mem_fileopen is replaced with a new string_file class that is treated as a value class created on the stack. This alone eliminates most make_cleanup_ui_file_delete calls, and, simplifies code a whole lot (diffstat shows almost 1k loc dropped.) string_file has a string() method that gives you a direct reference to the internal std::string. This is what replaces old (well, new) ui_file_as_string, which used to alway return a new copy of the same data the stream had inside.. With direct access via a writable reference, we can instead move the string out of the string_stream. Note I needed a tweak on scoped_restore. That one should probably be split out to a separate patch. This exposed the need to make use of gnulib namespace support. Otherwise, making use of read/write/printf/puts/etc symbol names will clash on systems where gnulib replaces those functions, due to '#define foo rpl_foo'.
Loading
Please register or sign in to comment