|
|
1.1 root 1: #include "quipu/util.h"
2: #include "quipu/attrvalue.h"
3: #include "quipu/dsp.h" /* for ds_error.h */
4: #include "quipu/ds_error.h"
5:
6: extern LLog * log_dsap;
7:
8: AV_Sequence avs_merge (a,b)
9: AV_Sequence a,b;
10: {
11: register AV_Sequence aptr, bptr, result, trail, tmp;
12:
13: if ( a == NULLAV )
14: return (b);
15: if ( b == NULLAV )
16: return (a);
17:
18: /* start sequence off, make sure 'a' is the first */
19: switch (avs_cmp_comp (a,b)) {
20: default:
21: LLOG (log_dsap,LLOG_EXCEPTIONS,("invalid syntax")) ;
22: /* continue as if equal */
23:
24: case 0: /* equal */
25: result = a;
26: aptr = a->avseq_next;
27: bptr = b->avseq_next;
28: avs_comp_free (b);
29: break;
30: case -1:
31: result = b;
32: aptr = a;
33: bptr = b->avseq_next;
34: break;
35: case 2: /* no compare function defined - treat as if a > b */
36: case 1:
37: result = a;
38: aptr = a->avseq_next;
39: bptr = b;
40: break;
41: }
42:
43: trail = result;
44: while ( (aptr != NULLAV) && (bptr != NULLAV) ) {
45:
46: switch (avs_cmp_comp (aptr,bptr)) {
47: default:
48: LLOG (log_dsap,LLOG_EXCEPTIONS,("invalid syntax")) ;
49: /* continue as if equal */
50:
51: case 0: /* equal */
52: trail->avseq_next = aptr;
53: trail = aptr;
54: tmp = bptr->avseq_next;
55: avs_comp_free (bptr);
56: aptr = aptr->avseq_next;
57: bptr = tmp;
58: break;
59: case -1:
60: trail->avseq_next = bptr;
61: trail = bptr;
62: bptr = bptr->avseq_next;
63: break;
64: case 2: /* no compare function defined - treat as if a > b */
65: case 1:
66: trail->avseq_next = aptr;
67: trail = aptr;
68: aptr = aptr->avseq_next;
69: break;
70: }
71: }
72: if (aptr == NULLAV)
73: trail->avseq_next = bptr;
74: else
75: trail->avseq_next = aptr;
76:
77: return (result);
78: }
79:
80:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.