Displaying 3 results from an estimated 3 matches for "nr_method_script".
Did you mean:
nr_method_scripts
2020 Apr 20
1
Re: [PATCH nbdkit 2/2] Add insert function and use the new vector library in several places.
...d, char *script)
> {
> - struct method_script *newp;
> - size_t i;
> int r;
> + size_t i;
> + struct method_script new_entry = { .method = method, .script = script };
>
> - newp = realloc (method_scripts,
> - sizeof (struct method_script) * (nr_method_scripts + 1));
> - if (newp == NULL) {
> - nbdkit_error ("insert_method_script: realloc: %m");
> - return -1;
> - }
> - nr_method_scripts++;
> - method_scripts = newp;
The old code appended the new element first, then
> -
> - for (i = 0; i < nr_method_scri...
2020 Apr 19
2
[PATCH nbdkit 1/2] vddk: Use new vector library to allocate the argv list.
---
plugins/vddk/vddk.c | 41 +++++++++++++++++++++++++----------------
TODO | 1 -
2 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 87c0d146..d1a3015f 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -51,6 +51,7 @@
#include "isaligned.h"
#include "minmax.h"
#include
2020 Apr 19
0
[PATCH nbdkit 2/2] Add insert function and use the new vector library in several places.
...clude "cleanup.h"
+#include "vector.h"
#include "call.h"
#include "methods.h"
@@ -87,11 +88,12 @@ static const char *known_methods[] = {
/* List of method scripts that we have saved. This is stored in
* sorted order of method name.
*/
-static size_t nr_method_scripts;
-static struct method_script {
+struct method_script {
const char *method;
char *script;
-} *method_scripts;
+};
+DEFINE_VECTOR_TYPE(method_script_list, struct method_script);
+static method_script_list method_scripts;
static int
compare_script (const void *methodvp, const void *entryvp...