Skip to content
Snippets Groups Projects
  • Mike Frysinger's avatar
    64419e47
    print_buffer: optimize & shrink · 64419e47
    Mike Frysinger authored
    
    Applying a little creative format string allows us to shrink the initial
    data read & display loop by only calling printf once.  Re-using the local
    data buffer to generate the string we want to display then allows us to
    output everything with just one printf call instead of multiple calls to
    the putc function.
    
    The local stack buffer needs increasing by 1 byte, but the resulting code
    shrink and speed up is worth it I think.
    
    Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
    64419e47
    History
    print_buffer: optimize & shrink
    Mike Frysinger authored
    
    Applying a little creative format string allows us to shrink the initial
    data read & display loop by only calling printf once.  Re-using the local
    data buffer to generate the string we want to display then allows us to
    output everything with just one printf call instead of multiple calls to
    the putc function.
    
    The local stack buffer needs increasing by 1 byte, but the resulting code
    shrink and speed up is worth it I think.
    
    Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>