On 9/18/20 12:30 AM, Eli Zaretskii wrote: > How about ... we modify doprint to exit when either it finds > NUL or reaches the character specified by FORMAT_END? This will allow > us to keep some of the feature, and I think the amount of changes will > be smaller. It should also not be much slower than what you propose. Better yet, let's leave doprnt's API unchanged, and add a function evsnprintf (named by analogy from esprintf) whose API is like C vsnprintf but which does formatting the Emacs way. We can avoid duplication of code by implementing doprnt in terms of evsnprintf. This fixes the performance issue with current Emacs, and avoids the need for evsnprintf having to check for both NULs and FORMAT_END etc. Updated patch attached.