/** * gtags_delete: delete records belong to set of fid. * * @param[in] gtop #GTOP structure * @param[in] deleteset bit array of fid */ void gtags_delete(GTOP *gtop, IDSET *deleteset) { const char *tagline; int fid; long id; #ifdef USE_SQLITE3 if (gtop->dbop->openflags & DBOP_SQLITE3) { STRBUF *where = strbuf_open(0); strbuf_puts(where, "("); for (id = idset_first(deleteset); id != END_OF_ID; id = idset_next(deleteset)) { strbuf_puts(where, "'"); strbuf_putn(where, id); strbuf_puts(where, "',"); } strbuf_unputc(where, ','); strbuf_puts(where, ")"); dbop_delete(gtop->dbop, strbuf_value(where)); strbuf_close(where); } else #endif for (tagline = dbop_first(gtop->dbop, NULL, NULL, 0); tagline; tagline = dbop_next(gtop->dbop)) { /* * Extract path from the tag line. */ fid = atoi(tagline); /* * If the file id exists in the deleteset, delete the tagline. */ if (idset_contains(deleteset, fid)) dbop_delete(gtop->dbop, NULL); } }
/** * gpath_delete: delete specified path record * * @param[in] path path name */ void gpath_delete(const char *path) { const char *fid; assert(opened > 0); assert(_mode == 2); assert(path[0] == '.' && path[1] == '/'); fid = dbop_get(dbop, path); if (fid == NULL) return; dbop_delete(dbop, fid); dbop_delete(dbop, path); }
/** * gtags_delete: delete records belong to set of fid. * * @param[in] gtop #GTOP structure * @param[in] deleteset bit array of fid */ void gtags_delete(GTOP *gtop, IDSET *deleteset) { const char *tagline; int fid; for (tagline = dbop_first(gtop->dbop, NULL, NULL, 0); tagline; tagline = dbop_next(gtop->dbop)) { /* * Extract path from the tag line. */ fid = atoi(tagline); /* * If the file id exists in the deleteset, delete the tagline. */ if (idset_contains(deleteset, fid)) dbop_delete(gtop->dbop, NULL); } }