diff options
author | Adam Jackson <ajax@redhat.com> | 2009-12-14 16:26:31 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2009-12-14 16:32:15 -0500 |
commit | 947ab16f2938e8883503ef679a40684dfe2a90e5 (patch) | |
tree | 85e7eed319197aca6f05f936fedd9a5e4411d81c /src/common_io.c | |
parent | d4e008eeb9af7773edadd259cf55da43411f1a7f (diff) |
Fix I/O handle array allocator to work for devices past the first
Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'src/common_io.c')
-rw-r--r-- | src/common_io.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/common_io.c b/src/common_io.c index b4aa360..58628b4 100644 --- a/src/common_io.c +++ b/src/common_io.c @@ -28,13 +28,13 @@ #include "pciaccess.h" #include "pciaccess_private.h" -static struct pci_io_handle **ios; +static struct pci_io_handle *ios; static unsigned int num_ios; static struct pci_io_handle * new_io_handle(void) { - struct pci_io_handle **new; + struct pci_io_handle *new; new = realloc(ios, sizeof(struct pci_io_handle) * (num_ios + 1)); if (!new) @@ -43,13 +43,13 @@ new_io_handle(void) ios = new; num_ios++; - return ios[num_ios - 1]; + return ios + num_ios - 1; } static void delete_io_handle(struct pci_io_handle *handle) { - struct pci_io_handle **new; + struct pci_io_handle *new; int i = 0; if (!handle || !num_ios || (void *)handle < (void *)ios || @@ -57,7 +57,7 @@ delete_io_handle(struct pci_io_handle *handle) return; for (i = 0; i < num_ios; i++) { - if (ios[i] == handle) { + if (ios + i == handle) { memmove(&ios[i], &ios[i+1], sizeof(struct pci_io_handle) * (num_ios - i - 1)); break; |