~jonathank89/burg/burg-percise

« back to all changes in this revision

Viewing changes to disk/ieee1275/nand.c

  • Committer: Bean
  • Date: 2009-12-18 20:28:39 UTC
  • Revision ID: bean123ch@gmail.com-20091218202839-6rca0kh3455py32d
Eliminate nested functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
  grub_uint32_t block_size;
30
30
};
31
31
 
 
32
struct grub_nand_iterate_closure
 
33
{
 
34
  int (*hook) (const char *name, void *closure);
 
35
  void *closure;
 
36
};
 
37
 
32
38
static int
33
 
grub_nand_iterate (int (*hook) (const char *name))
 
39
dev_iterate (struct grub_ieee1275_devalias *alias, void *closure)
34
40
{
35
 
  auto int dev_iterate (struct grub_ieee1275_devalias *alias);
36
 
  int dev_iterate (struct grub_ieee1275_devalias *alias)
 
41
  struct grub_nand_iterate_closure *c = closure;
 
42
 
 
43
  if (! grub_strcmp (alias->name, "nand"))
37
44
    {
38
 
      if (! grub_strcmp (alias->name, "nand"))
39
 
        {
40
 
          hook (alias->name);
41
 
          return 1;
42
 
        }
43
 
 
44
 
      return 0;
 
45
      c->hook (alias->name, c->closure);
 
46
      return 1;
45
47
    }
46
48
 
47
 
  return grub_devalias_iterate (dev_iterate);
 
49
  return 0;
 
50
}
 
51
 
 
52
static int
 
53
grub_nand_iterate (int (*hook) (const char *name, void *closure),
 
54
                   void *closure)
 
55
{
 
56
  struct grub_nand_iterate_closure c;
 
57
 
 
58
  c.hook = hook;
 
59
  c.closure = closure;
 
60
  return grub_devalias_iterate (dev_iterate, &c);
48
61
}
49
62
 
50
63
static grub_err_t