X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fcclqual.c;h=e0761b8eecd5e5374ac784d10f141fdcb9ad8fad;hp=e55a654c021791927079a9ad20e5d14a5edc135f;hb=4e0757c4ea6d3081ccdd5420d8a80926c858c960;hpb=1f3fef356c699a9d7c68902cd6d3e33b08c3cc4e diff --git a/src/cclqual.c b/src/cclqual.c index e55a654..e0761b8 100644 --- a/src/cclqual.c +++ b/src/cclqual.c @@ -277,7 +277,6 @@ CCL_bibset ccl_qual_dup(CCL_bibset b) attrp = &(*qp)->attr_list; for (attr = q->attr_list; attr; attr = attr->next) { - int i; *attrp = xmalloc(sizeof(**attrp)); (*attrp)->next = 0; (*attrp)->set = attr->set ? xstrdup(attr->set) : 0; @@ -287,14 +286,20 @@ CCL_bibset ccl_qual_dup(CCL_bibset b) else if (attr->kind == CCL_RPN_ATTR_STRING) (*attrp)->value.str = xstrdup(attr->value.str); + attrp = &(*attrp)->next; + } + (*qp)->no_sub = q->no_sub; + if (!q->sub) + (*qp)->sub = 0; + else + { /* fix up the sub qualifiers.. */ - for (i = 0; q->sub[i]; i++) - ; - (*qp)->sub = xmalloc(sizeof(*(*qp)->sub) * (i+1)); - for (i = 0; q->sub[i]; i++) + int i; + (*qp)->sub = xmalloc(sizeof(*q->sub) * (q->no_sub + 1)); + for (i = 0; i < q->no_sub; i++) { struct ccl_qualifier *q1, *q2; - + /* sweep though original and match up the corresponding ent */ q2 = n->list; for (q1 = b->list; q1 && q2; q1 = q1->next, q2 = q2->next) @@ -302,9 +307,6 @@ CCL_bibset ccl_qual_dup(CCL_bibset b) break; (*qp)->sub[i] = q2; } - (*qp)->sub[i] = 0; - - attrp = &(*attrp)->next; } qp = &(*qp)->next; }