+2013-10-20 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/fs/xfs.c: Remove variable length arrays.
+ Reduces xfs.mod by 40 bytes (43 compressed).
+
2013-10-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/fshelp.c: Remove variable length arrays.
fdiro = grub_malloc (sizeof (struct grub_fshelp_node)
- sizeof (struct grub_xfs_inode)
- + (1 << ctx->diro->data->sblock.log2_inode));
+ + (1 << ctx->diro->data->sblock.log2_inode) + 1);
if (!fdiro)
{
grub_print_error ();
grub_uint8_t *inopos = (((grub_uint8_t *) de)
+ sizeof (struct grub_xfs_dir_entry)
+ de->len - 1);
- char name[de->len + 1];
+ grub_uint8_t c;
/* inopos might be unaligned. */
if (smallino)
| (((grub_uint64_t) inopos[7]) << 0);
ino = grub_cpu_to_be64 (ino);
- grub_memcpy (name, de->name, de->len);
- name[de->len] = '\0';
- if (iterate_dir_call_hook (ino, name, &ctx))
+ c = de->name[de->len];
+ de->name[de->len] = '\0';
+ if (iterate_dir_call_hook (ino, de->name, &ctx))
return 1;
+ de->name[de->len] = c;
de = ((struct grub_xfs_dir_entry *)
(((char *) de)+ sizeof (struct grub_xfs_dir_entry) + de->len
data = grub_realloc (data,
sizeof (struct grub_xfs_data)
- sizeof (struct grub_xfs_inode)
- + (1 << data->sblock.log2_inode));
+ + (1 << data->sblock.log2_inode) + 1);
if (! data)
goto fail;