]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2010-01-22 Vladimir Serbinenko <phcoder@gmail.com>
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 22 Jan 2010 19:42:02 +0000 (20:42 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 22 Jan 2010 19:42:02 +0000 (20:42 +0100)
* term/ieee1275/ofconsole.c (grub_ofconsole_setcolorstate): Allocate on
stack since heap may be unavailable at that point.
(grub_ofconsole_gotoxy): Likewise.

ChangeLog
term/ieee1275/ofconsole.c

index a44d1f66ea995e796cf0aeccf8ce5b0f148160b5..d700466faba88853832bb91ef13e65132a289b2f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-22  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * term/ieee1275/ofconsole.c (grub_ofconsole_setcolorstate): Allocate on
+       stack since heap may be unavailable at that point.
+       (grub_ofconsole_gotoxy): Likewise.
+
 2010-01-22  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * configure.ac: Check for _restgpr_14_x.
index 3799e2e273939e045197eed7a98852fff7eb011c..51dca7a53c217a48357508476d2e0d7971966e70 100644 (file)
@@ -109,7 +109,7 @@ grub_ofconsole_getcharwidth (grub_uint32_t c __attribute__((unused)))
 static void
 grub_ofconsole_setcolorstate (grub_term_color_state state)
 {
-  char *setcol;
+  char setcol[256];
   int fg;
   int bg;
 
@@ -128,10 +128,8 @@ grub_ofconsole_setcolorstate (grub_term_color_state state)
       return;
     }
 
-  setcol = grub_xasprintf ("\e[3%dm\e[4%dm", fg, bg);
-  if (setcol)
-    grub_ofconsole_writeesc (setcol);
-  grub_free (setcol);
+  grub_snprintf (setcol, sizeof (setcol), "\e[3%dm\e[4%dm", fg, bg);
+  grub_ofconsole_writeesc (setcol);
 }
 
 static void
@@ -288,14 +286,12 @@ grub_ofconsole_gotoxy (grub_uint8_t x, grub_uint8_t y)
 {
   if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_ANSI))
     {
-      char *s;
+      char s[256];
       grub_curr_x = x;
       grub_curr_y = y;
 
-      s = grub_xasprintf ("\e[%d;%dH", y + 1, x + 1);
-      if (s)
-       grub_ofconsole_writeesc (s);
-      grub_free (s);
+      grub_snprintf (s, sizeof (s), "\e[%d;%dH", y + 1, x + 1);
+      grub_ofconsole_writeesc (s);
     }
   else
     {