aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-08-05 21:03:04 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-08-05 21:29:35 -0700
commit9636a1bbb1c1394fc9fb7cf66d97ffe5f5f43ff3 (patch)
tree94c9c850b9c323ebf2a19ba32203e7a757e5a2d5 /com32
parent22a679c93b85c064844b0a12cb1e59eba1cf4aa4 (diff)
downloadsyslinux-9636a1bbb1c1394fc9fb7cf66d97ffe5f5f43ff3.tar.gz
syslinux-9636a1bbb1c1394fc9fb7cf66d97ffe5f5f43ff3.tar.xz
syslinux-9636a1bbb1c1394fc9fb7cf66d97ffe5f5f43ff3.zip
gpllib: Introduce typedefs for callbacks
typedefs are evil but useful for function pointers as it makes them more readable and maintainable. This fixes a bug by the way: we had void *callback(struct driveinfo *, struct part_entry *, int, int) where we should have had void (*callback)(struct driveinfo *, struct part_entry *, int, int) Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Diffstat (limited to 'com32')
-rw-r--r--com32/gplinclude/disk/msdos.h4
-rw-r--r--com32/gpllib/disk/msdos.c8
2 files changed, 7 insertions, 5 deletions
diff --git a/com32/gplinclude/disk/msdos.h b/com32/gplinclude/disk/msdos.h
index c8dcb1de..405b9b99 100644
--- a/com32/gplinclude/disk/msdos.h
+++ b/com32/gplinclude/disk/msdos.h
@@ -11,7 +11,9 @@
#define _MSDOS_H_
#include <disk/geom.h>
+#include <disk/partition.h>
-int parse_partition_table(struct driveinfo *, void *);
+typedef void (*p_callback)(struct driveinfo *, struct part_entry *, int, int);
+int parse_partition_table(struct driveinfo *, p_callback);
#endif /* _MSDOS_H_ */
diff --git a/com32/gpllib/disk/msdos.c b/com32/gpllib/disk/msdos.c
index 249d39c4..e69aa71b 100644
--- a/com32/gpllib/disk/msdos.c
+++ b/com32/gpllib/disk/msdos.c
@@ -16,6 +16,7 @@
#include <disk/common.h>
#include <disk/geom.h>
+#include <disk/msdos.h>
#include <disk/partition.h>
#include <disk/read.h>
@@ -40,7 +41,7 @@ static inline int msdos_magic_present(const char *ptab)
**/
static int process_extended_partition(struct driveinfo *drive_info,
int partition_offset,
- void *callback(struct driveinfo *, struct part_entry *, int, int),
+ p_callback callback,
int nb_part_seen)
{
int status = 0;
@@ -102,7 +103,7 @@ static int process_extended_partition(struct driveinfo *drive_info,
* @callback: Callback to execute
**/
static int process_mbr(struct driveinfo *drive_info, struct part_entry *ptab,
- void *callback(struct driveinfo *, struct part_entry *, int, int))
+ p_callback callback)
{
int status = 0;
@@ -132,7 +133,6 @@ static int process_mbr(struct driveinfo *drive_info, struct part_entry *ptab,
* parse_partition_table - execute a callback for each partition entry
* @d: driveinfo struct describing the drive
* @callback: Callback to execute
- * @error: Return the error code (I/O), if needed
*
* The signature of the callback should be the following:
*
@@ -141,7 +141,7 @@ static int process_mbr(struct driveinfo *drive_info, struct part_entry *ptab,
* int offset_root,
* int nb_part_seen)
**/
-int parse_partition_table(struct driveinfo *d, void *callback)
+int parse_partition_table(struct driveinfo *d, p_callback callback)
{
char *mbr = malloc(SECTOR * sizeof(char));