On Wed, Nov 02, 2016 at 09:19:10AM +0800, Qu Wenruo wrote: > > > At 11/01/2016 06:08 PM, David Sterba wrote: > > On Tue, Nov 01, 2016 at 04:01:43PM +0800, Qu Wenruo wrote: > >> Introduce new function, escape_string_inplace(), to escape specified > >> characters in place. > > > > Sorry, the pointer to seq_path was misleading. The actual escape > > function is mangle_path and it copies one string to another. As we just > > print the path, we can simply switch and call putchar. > > > > Putchar() method is indeed much easier to implement. > > But it makes us hard to do further formatting, like aligning the path to > given width. (At least we are still using 32 chars alignment for path) > > So I still prefer the current full function string escaping and still > use %-32s for formatting. > > > And the idea of implementing escape_string_inplace() as a pure string > manipulation function can make it more agile for later use. > For example, we can reuse it for print-tree.
Reusing is fine, but I really don't like that the function modifies the argument. What if the function is called twice on the same string? Also, in the print-tree, this would mean the extent buffer would be modified, potentially overwriting other items. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html