]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
merge with mainline
authorBVK Chaitanya <bvk.groups@gmail.com>
Thu, 20 May 2010 08:26:14 +0000 (13:56 +0530)
committerBVK Chaitanya <bvk.groups@gmail.com>
Thu, 20 May 2010 08:26:14 +0000 (13:56 +0530)
1  2 
conf/common.rmk
include/grub/script_sh.h
script/argv.c
script/execute.c
tests/util/grub-shell.in

diff --cc conf/common.rmk
Simple merge
Simple merge
diff --cc script/argv.c
index 369be49b8d23bb3b7b4e65aed99b9943ea22003f,56274f263fe5d350305d43d25a9a032d017eacd1..b8d4b903cf0e7817e9781d96027846bcc6d64b0e
   */
  
  #include <grub/mm.h>
 +#include <grub/fs.h>
 +#include <grub/env.h>
 +#include <grub/file.h>
 +#include <grub/device.h>
  #include <grub/script_sh.h>
  
 +#include <regex.h>
 +
 +#define ARG_ALLOCATION_UNIT  (32 * sizeof (char))
 +#define ARGV_ALLOCATION_UNIT (8 * sizeof (void*))
 +
+ static unsigned
+ round_up_exp (unsigned v)
+ {
+   v--;
+   v |= v >> 1;
+   v |= v >> 2;
+   v |= v >> 4;
+   v |= v >> 8;
+   v |= v >> 16;
+   if (sizeof (v) > 4)
+     v |= v >> 32;
+   v++;
+   v += (v == 0);
+   return v;
+ }
 +static inline int regexop (char ch);
 +static char ** merge (char **lhs, char **rhs);
 +static char *make_dir (const char *prefix, const char *start, const char *end);
 +static int make_regex (const char *regex_start, const char *regex_end,
 +                     regex_t *regexp);
 +static void split_path (char *path, char **suffix_end, char **regex_end);
 +static char ** match_devices (const regex_t *regexp);
 +static char ** match_files (const char *prefix, const char *suffix_start,
 +                          const char *suffix_end, const regex_t *regexp);
 +static char ** match_paths_with_escaped_suffix (char **paths,
 +                                              const char *suffix_start,
 +                                              const char *suffix_end,
 +                                              const regex_t *regexp);
 +static int expand (char *arg, struct grub_script_argv *argv);
 +
  void
  grub_script_argv_free (struct grub_script_argv *argv)
  {
@@@ -112,10 -99,9 +130,9 @@@ append (struct grub_script_argv *argv, 
      return 0;
  
    a = p ? grub_strlen (p) : 0;
 -  b = grub_strlen (s);
 +  b = grub_strlen (s) * (type == APPEND_ESCAPED ? 2 : 1);
  
-   p = grub_realloc (p, ALIGN_UP ((a + b + 1) * sizeof (char),
-                                ARG_ALLOCATION_UNIT));
+   p = grub_realloc (p, round_up_exp ((a + b + 1) * sizeof (char)));
    if (! p)
      return 1;
  
Simple merge
Simple merge