summaryrefslogtreecommitdiff
path: root/src/cli_new.c
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-11-09 18:27:39 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2007-11-09 18:27:39 -0800
commitd488a9b9f4d0afd95e68dbad02fe0bd2aa74aa48 (patch)
treed6455d9ba07549761ea95cc81f82687a4d14dee0 /src/cli_new.c
parent646112e4e6e4d4ab36c61cba47e71c0a58322637 (diff)
downloadvyatta-cfg-d488a9b9f4d0afd95e68dbad02fe0bd2aa74aa48.tar.gz
vyatta-cfg-d488a9b9f4d0afd95e68dbad02fe0bd2aa74aa48.zip
* fix for bug 2338: for values of "multi:" nodes, input ordering is now
used for commit actions. * fix array index out of bound.
Diffstat (limited to 'src/cli_new.c')
-rw-r--r--src/cli_new.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/cli_new.c b/src/cli_new.c
index a998b91..0f5abd9 100644
--- a/src/cli_new.c
+++ b/src/cli_new.c
@@ -271,8 +271,14 @@ void vtw_sort(valstruct *valp, vtw_sorted *sortp)
void *curp, *parp;
sortp->num = valp->cnt?valp->cnt : 1;
+#ifdef CLI_DEBUG
+ printf("vtw_sort type=%d num=%d\n", type, sortp->num);
+ for (i = 0; i < sortp->num; i++) {
+ printf(" [%s]\n", (valp->cnt) ? valp->vals[i] : valp->val);
+ }
+#endif
sortp->ptrs = my_malloc(sortp->num * sizeof(void *), "sort_ptrs");
- sortp->partnum = cond_format_lens[type];
+ sortp->partnum = (type < DOMAIN_TYPE) ? cond_format_lens[type] : 0;
if (sortp->partnum) {
sortp->parts = my_malloc(sortp->partnum * sortp->num * sizeof(void *),
"sort_parts");
@@ -333,6 +339,23 @@ void vtw_sort(valstruct *valp, vtw_sorted *sortp)
}
if (sortp->num < 2)
return;
+#ifdef CLI_DEBUG
+ if (sortp->parts) {
+ int i, j;
+ printf("sortp parts:\n");
+ for (i = 0; i < sortp->num; i++) {
+ printf(" ");
+ unsigned int *parts = (unsigned int *) sortp->ptrs[i];
+ for (j = 0; j < sortp->partnum; j++) {
+ printf("%u ", parts[j]);
+ }
+ printf("\n");
+ }
+ }
+#endif
+ /* the following sort throws away the input ordering. */
+ /* NOT doing this for now */
+#if 0
/* now do a heap sort */
/* build heap */
/* from left to right, we start with the heap of only one (first) element*/
@@ -448,6 +471,7 @@ void vtw_sort(valstruct *valp, vtw_sorted *sortp)
}
}
}
+#endif
}
/* returns FALSE if execution returns non-null,