]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
replaced magic numbers with macros
authorBVK Chaitanya <bvk.groups@gmail.com>
Sat, 23 Jan 2010 14:16:28 +0000 (19:46 +0530)
committerBVK Chaitanya <bvk.groups@gmail.com>
Sat, 23 Jan 2010 14:16:28 +0000 (19:46 +0530)
script/execute.c

index c956960dabd8c2d4ea0663bbd972eb578fcef3ba..d42918f50ebcf8d62531b8c50beb8300b5b2bfb0 100644 (file)
@@ -35,6 +35,9 @@ grub_script_execute_cmd (struct grub_script_cmd *cmd)
   return cmd->exec (cmd);
 }
 
+#define ARG_ALLOCATION_UNIT  (32 * sizeof (char))
+#define ARGV_ALLOCATION_UNIT (8 * sizeof (void*))
+
 /* Expand arguments in ARGLIST into multiple arguments.  */
 char **
 grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *count)
@@ -56,7 +59,7 @@ grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *c
     if (oom)
       return;
 
-    p = grub_realloc (argv, ALIGN_UP (sizeof(char*) * (argc + 1), 32));
+    p = grub_realloc (argv, ALIGN_UP (sizeof(char*) * (argc + 1), ARGV_ALLOCATION_UNIT));
     if (!p)
       oom = 1;
     else
@@ -78,7 +81,7 @@ grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *c
 
     len = nchar ?: grub_strlen (str);
     old = argv[argc - 1] ? grub_strlen (argv[argc - 1]) : 0;
-    p = grub_realloc (argv[argc - 1], ALIGN_UP(old + len + 1, 32));
+    p = grub_realloc (argv[argc - 1], ALIGN_UP(old + len + 1, ARG_ALLOCATION_UNIT));
 
     if (p)
       {