shared/cdiff.c: fix handling of massive XCHGs (bb#2017)

0.96
Tomasz Kojm 15 years ago
parent f75ae61b1c
commit 7b3cc5accb
  1. 4
      ChangeLog
  2. 30
      shared/cdiff.c

@ -1,3 +1,7 @@
Tue Jun 8 12:47:25 CEST 2010 (tk)
----------------------------------
* shared/cdiff.c: fix handling of massive XCHGs (bb#2017)
Fri Jun 4 18:04:37 CEST 2010 (tk)
----------------------------------
* libclamav/cvd.c: load daily.ign[2] files from CVDs (bb#2061)

@ -64,7 +64,7 @@ struct cdiff_ctx {
char *open_db;
struct cdiff_node *add_start, *add_last;
struct cdiff_node *del_start;
struct cdiff_node *xchg_start;
struct cdiff_node *xchg_start, *xchg_last;
};
struct cdiff_cmd {
@ -324,32 +324,12 @@ static int cdiff_cmd_xchg(const char *cmdstr, struct cdiff_ctx *ctx, char *lbuf,
new->str2 = arg2;
new->lineno = lineno;
if(!ctx->xchg_start) {
if(!ctx->xchg_start)
ctx->xchg_start = new;
else
ctx->xchg_last->next = new;
} else {
if(lineno < ctx->xchg_start->lineno) {
new->next = ctx->xchg_start;
ctx->xchg_start = new;
} else {
pt = ctx->xchg_start;
while(pt) {
last = pt;
if((pt->lineno < lineno) && (!pt->next || lineno < pt->next->lineno))
break;
pt = pt->next;
}
new->next = last->next;
last->next = new;
}
}
ctx->xchg_last = new;
return 0;
}

Loading…
Cancel
Save