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.
Although the current esacpe_string_inplace() can be further fine-tuned
to avoid calling memmove() in a loop, which I can update it in next version.
Thanks,
Qu
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html