]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* include/grub/mm.h (grub_extend_alloc): Remove.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 22 Aug 2013 14:44:20 +0000 (16:44 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 22 Aug 2013 14:44:20 +0000 (16:44 +0200)
* grub-core/loader/i386/pc/plan9.c: Use own version of
grub_extend_alloc with appropriate types.

ChangeLog
grub-core/loader/i386/pc/plan9.c
include/grub/mm.h

index f6ef39a3b501154610648417e4cce800694d2184..77a4e423b29d0ad0197179b8a4d77c54badfe3ef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-08-22  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * include/grub/mm.h (grub_extend_alloc): Remove.
+       * grub-core/loader/i386/pc/plan9.c: Use own version of
+       grub_extend_alloc with appropriate types.
+
 2013-08-22  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * conf/Makefile.common (CFLAGS_GCRY): Add -Wno-redundant-decls.
index 1c7b381c6e7f754e8283eb109973bf7719037394..0d10b1c243bf97eb0e0dc132d425d633b4822f3c 100644 (file)
@@ -119,6 +119,23 @@ static const char prefixes[5][10] = {
   "dos", "plan9", "ntfs", "linux", "linuxswap"
 };
 
+#include <grub/err.h>
+
+static inline grub_err_t 
+grub_extend_alloc (grub_size_t sz, grub_size_t *allocated, char **ptr)
+{
+  void *n;
+  if (sz < *allocated)
+    return GRUB_ERR_NONE;
+
+  *allocated = 2 * sz;
+  n = grub_realloc (*ptr, *allocated);
+  if (!n)
+    return grub_errno;
+  *ptr = n;
+  return GRUB_ERR_NONE;
+}
+
 /* Helper for grub_cmd_plan9.  */
 static int
 fill_partition (grub_disk_t disk, const grub_partition_t partition, void *data)
@@ -130,7 +147,7 @@ fill_partition (grub_disk_t disk, const grub_partition_t partition, void *data)
   if (!fill_ctx->noslash)
     {
       if (grub_extend_alloc (fill_ctx->pmapptr + 1, &fill_ctx->pmapalloc,
-                            (void **) &fill_ctx->pmap))
+                            &fill_ctx->pmap))
        return 1;
       fill_ctx->pmap[fill_ctx->pmapptr++] = '/';
     }
@@ -149,7 +166,7 @@ fill_partition (grub_disk_t disk, const grub_partition_t partition, void *data)
       do
        {
          if (grub_extend_alloc (fill_ctx->pmapptr + 1, &fill_ctx->pmapalloc,
-                                (void **) &fill_ctx->pmap))
+                                &fill_ctx->pmap))
            return 1;
          err = grub_disk_read (disk, 1, ptr, 1,
                                fill_ctx->pmap + fill_ctx->pmapptr);
@@ -197,14 +214,14 @@ fill_partition (grub_disk_t disk, const grub_partition_t partition, void *data)
                       fill_ctx->prefixescnt[c]);
       fill_ctx->prefixescnt[c]++;
       if (grub_extend_alloc (fill_ctx->pmapptr + grub_strlen (name) + 1,
-                            &fill_ctx->pmapalloc, (void **) &fill_ctx->pmap))
+                            &fill_ctx->pmapalloc, &fill_ctx->pmap))
        return 1;
       grub_strcpy (fill_ctx->pmap + fill_ctx->pmapptr, name);
       fill_ctx->pmapptr += grub_strlen (name);
     }
   pend = fill_ctx->pmapptr;
   if (grub_extend_alloc (fill_ctx->pmapptr + 2 + 25 + 5 + 25,
-                        &fill_ctx->pmapalloc, (void **) &fill_ctx->pmap))
+                        &fill_ctx->pmapalloc, &fill_ctx->pmap))
     return 1;
   fill_ctx->pmap[fill_ctx->pmapptr++] = ' ';
   grub_snprintf (fill_ctx->pmap + fill_ctx->pmapptr, 25 + 5 + 25,
@@ -329,7 +346,7 @@ fill_disk (const char *name, void *data)
     }
   if (grub_extend_alloc (fill_ctx->pmapptr + grub_strlen (plan9name)
                         + sizeof ("part="), &fill_ctx->pmapalloc,
-                        (void **) &fill_ctx->pmap))
+                        &fill_ctx->pmap))
     {
       grub_free (plan9name);
       return 1;
@@ -351,7 +368,7 @@ fill_disk (const char *name, void *data)
   if (grub_partition_iterate (dev->disk, fill_partition, fill_ctx))
     return 1;
   if (grub_extend_alloc (fill_ctx->pmapptr + 1, &fill_ctx->pmapalloc,
-                        (void **) &fill_ctx->pmap))
+                        &fill_ctx->pmap))
     return 1;
   fill_ctx->pmap[fill_ctx->pmapptr++] = '\n';
 
@@ -399,7 +416,7 @@ grub_cmd_plan9 (grub_extcmd_context_t ctxt, int argc, char *argv[])
     goto fail;
 
   if (grub_extend_alloc (fill_ctx.pmapptr + 1, &fill_ctx.pmapalloc,
-                        (void **) &fill_ctx.pmap))
+                        &fill_ctx.pmap))
     goto fail;
   fill_ctx.pmap[fill_ctx.pmapptr] = 0;
 
index 82b200c271878eb9c008aa929222d91ae597753b..04700694414b2d4c878c81a40226ddafced0ce3e 100644 (file)
@@ -72,21 +72,4 @@ void *EXPORT_FUNC(grub_debug_memalign) (const char *file, int line,
                                        grub_size_t align, grub_size_t size);
 #endif /* MM_DEBUG && ! GRUB_UTIL */
 
-#include <grub/err.h>
-
-static inline grub_err_t 
-grub_extend_alloc (grub_size_t sz, grub_size_t *allocated, void **ptr)
-{
-  void *n;
-  if (sz < *allocated)
-    return GRUB_ERR_NONE;
-
-  *allocated = 2 * sz;
-  n = grub_realloc (*ptr, *allocated);
-  if (!n)
-    return grub_errno;
-  *ptr = n;
-  return GRUB_ERR_NONE;
-}
-
 #endif /* ! GRUB_MM_H */