mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Avoid a lot of malloc/free traffic
Each console write caused temporary buffer allocation. Avoid allocations by changing console_draw_str() to use Forth string parameters, which are usually readily available. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@872 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -382,12 +382,12 @@ do_con_trol(unsigned char ch)
|
||||
}
|
||||
|
||||
int
|
||||
console_draw_str( const char *str )
|
||||
console_draw_fstr(const char *str, int len)
|
||||
{
|
||||
unsigned int y, x;
|
||||
unsigned char ch;
|
||||
|
||||
if (!str) {
|
||||
if (!str || len <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ console_draw_str( const char *str )
|
||||
return -1;
|
||||
|
||||
show_cursor(0);
|
||||
while( (ch=*str++) ) {
|
||||
while((ch = *str++) && len--) {
|
||||
do_con_trol(ch);
|
||||
|
||||
if( cons.x >= cons.w ) {
|
||||
|
||||
Reference in New Issue
Block a user