572 |
return status; |
return status; |
573 |
} |
} |
574 |
/* |
/* |
575 |
* gtags_delete: delete records belong to path. |
* gtags_delete: delete records belong to set of fid. |
576 |
* |
* |
577 |
* i) gtop GTOP structure |
* i) gtop GTOP structure |
578 |
* i) path path name |
* i) deleteset bit array of fid |
579 |
*/ |
*/ |
580 |
void |
void |
581 |
gtags_delete(gtop, path) |
gtags_delete(gtop, deleteset) |
582 |
GTOP *gtop; |
GTOP *gtop; |
583 |
const char *path; |
IDSET *deleteset; |
|
{ |
|
|
const char *p, *fid; |
|
|
/* |
|
|
* In compact format, a path is saved as a file number. |
|
|
*/ |
|
|
if (gtop->format & GTAGS_PATHINDEX) { |
|
|
if ((fid = gpath_path2fid(path)) == NULL) |
|
|
die("GPATH is corrupted.('%s' not found)", path); |
|
|
path = fid; |
|
|
} |
|
|
/* |
|
|
* read sequentially, because db(1) has just one index. |
|
|
*/ |
|
|
for (p = dbop_first(gtop->dbop, NULL, NULL, 0); p; p = dbop_next(gtop->dbop)) |
|
|
if (belongto(gtop, path, p)) |
|
|
dbop_delete(gtop->dbop, NULL); |
|
|
/* |
|
|
* don't delete from path index. |
|
|
*/ |
|
|
} |
|
|
/* |
|
|
* gtags_delete_by_fidset: delete records belong to set of fid. |
|
|
* |
|
|
* i) gtop GTOP structure |
|
|
* i) fidset bit array of fid |
|
|
* i) max_fid number of bits in bit array |
|
|
*/ |
|
|
void |
|
|
gtags_delete_by_fidset(gtop, fidset, max_fid) |
|
|
GTOP *gtop; |
|
|
const unsigned char *fidset; |
|
|
int max_fid; |
|
584 |
{ |
{ |
585 |
const char *line, *p; |
const char *line, *p; |
586 |
SPLIT ptable; |
SPLIT ptable; |
606 |
} |
} |
607 |
fid = atoi(p); |
fid = atoi(p); |
608 |
recover(&ptable); |
recover(&ptable); |
609 |
if (fid >= max_fid) |
if (fid >= deleteset->max) |
610 |
continue; |
continue; |
611 |
if (fidset[fid / CHAR_BIT] & (1 << (fid % CHAR_BIT))) |
if (idset_contains(deleteset, fid)) |
612 |
dbop_delete(gtop->dbop, NULL); |
dbop_delete(gtop->dbop, NULL); |
613 |
} |
} |
614 |
} |
} |