]> git.ozlabs.org Git - yaboot.git/commitdiff
Remove magic numbers in print_message_file
authorAnton Blanchard <anton@samba.org>
Sat, 10 Apr 2010 18:04:27 +0000 (18:04 +0000)
committerTony Breeds <tony@bakeyournoodle.com>
Fri, 16 Jul 2010 05:39:07 +0000 (15:39 +1000)
Create a define instead of using a magic number in print_message_file.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
second/yaboot.c

index 9075db1bf004fdaab7625683408844e97358d62f..ac63c462c36d5cd4af3dda15e93714cc8f80e6bb 100644 (file)
@@ -58,6 +58,8 @@
 #define CONFIG_FILE_NAME       "yaboot.conf"
 #define CONFIG_FILE_MAX                0x8000          /* 32k */
 
+#define MESSAGE_FILE_MAX       2048
+
 #ifdef USE_MD5_PASSWORDS
 #include "md5.h"
 #endif /* USE_MD5_PASSWORDS */
@@ -295,13 +297,13 @@ void print_message_file(char *filename)
      } else
          opened = 1;
 
-     msg = malloc(2001);
+     msg = malloc(MESSAGE_FILE_MAX + 1);
      if (!msg)
          goto done;
      else
-         memset(msg, 0, 2001);
+         memset(msg, 0, MESSAGE_FILE_MAX + 1);
 
-     if (file.fs->read(&file, 2000, msg) <= 0)
+     if (file.fs->read(&file, MESSAGE_FILE_MAX, msg) <= 0)
          goto done;
      else
          prom_printf("%s", msg);