summaryrefslogtreecommitdiffstats
path: root/pcilib/unit.c
diff options
context:
space:
mode:
authornicolas.zilio@hotmail.fr <>2015-09-15 12:07:04 +0200
committernicolas.zilio@hotmail.fr <>2015-09-15 12:07:04 +0200
commit33db9c07bd08fae74c145c547f1b0e9f55ab25ae (patch)
tree7121279d8ebe972374cae6238096f0f8008be1d5 /pcilib/unit.c
parent6c47064466d8484813741f347e41af1d4ac90f85 (diff)
downloadpcitool-33db9c07bd08fae74c145c547f1b0e9f55ab25ae.tar.gz
pcitool-33db9c07bd08fae74c145c547f1b0e9f55ab25ae.tar.bz2
pcitool-33db9c07bd08fae74c145c547f1b0e9f55ab25ae.tar.xz
pcitool-33db9c07bd08fae74c145c547f1b0e9f55ab25ae.zip
merge views and units, some name homogeneisation
Diffstat (limited to 'pcilib/unit.c')
-rw-r--r--pcilib/unit.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/pcilib/unit.c b/pcilib/unit.c
deleted file mode 100644
index a9766ed..0000000
--- a/pcilib/unit.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "pcilib.h"
-#include "pci.h"
-#include "stdio.h"
-#include <string.h>
-#include "error.h"
-#include "unit.h"
-
-int pcilib_add_units(pcilib_t *ctx, size_t n, const pcilib_unit_t* units) {
-
- pcilib_unit_t *units2;
- size_t size;
-
- if (!n) {
- for (n = 0; units[n].name[0]; n++);
- }
-
- if ((ctx->num_units + n + 1) > ctx->alloc_units) {
- for (size = ctx->alloc_units; size < 2 * (n + ctx->num_units + 1); size<<=1);
-
- units2 = (pcilib_unit_t*)realloc(ctx->units, size * sizeof(pcilib_unit_t));
- if (!units2) return PCILIB_ERROR_MEMORY;
-
- ctx->units = units2;
- ctx->alloc_units = size;
- }
-
- memcpy(ctx->units + ctx->num_units, units, n * sizeof(pcilib_unit_t));
- memset(ctx->units + ctx->num_units + n, 0, sizeof(pcilib_unit_t));
-
- ctx->num_units += n;
-
- return 0;
-}
-