36 |
#ifdef HAVE_UNISTD_H |
#ifdef HAVE_UNISTD_H |
37 |
#include <unistd.h> |
#include <unistd.h> |
38 |
#endif |
#endif |
|
#ifdef HAVE_LIMITS_H |
|
|
#include <limits.h> |
|
|
#endif |
|
39 |
|
|
40 |
#include "char.h" |
#include "char.h" |
41 |
#include "conf.h" |
#include "conf.h" |
55 |
|
|
56 |
static const char *unpack_pathindex(const char *); |
static const char *unpack_pathindex(const char *); |
57 |
static const char *genrecord(GTOP *); |
static const char *genrecord(GTOP *); |
|
static int belongto(GTOP *, const char *, const char *); |
|
58 |
static regex_t reg; |
static regex_t reg; |
59 |
|
|
60 |
/* |
/* |
529 |
strbuf_close(ib); |
strbuf_close(ib); |
530 |
} |
} |
531 |
/* |
/* |
|
* belongto: wheather or not record belongs to the path. |
|
|
* |
|
|
* i) gtop GTOP structure |
|
|
* i) path path name (in standard format) |
|
|
* path number (in compact format) |
|
|
* i) line record |
|
|
* r) 1: belong, 0: not belong |
|
|
* |
|
|
*/ |
|
|
static int |
|
|
belongto(gtop, path, line) |
|
|
GTOP *gtop; |
|
|
const char *path; |
|
|
const char *line; /* virtually const */ |
|
|
{ |
|
|
const char *p = NULL; |
|
|
int status, n; |
|
|
SPLIT ptable; |
|
|
|
|
|
/* |
|
|
* Get path. |
|
|
*/ |
|
|
n = split((char *)line, 4, &ptable); |
|
|
if (gtop->format == GTAGS_STANDARD || gtop->format == GTAGS_PATHINDEX) { |
|
|
if (n < 4) { |
|
|
recover(&ptable); |
|
|
die("too small number of parts.\n'%s'", line); |
|
|
} |
|
|
p = ptable.part[2].start; |
|
|
} else if (gtop->format & GTAGS_COMPACT) { |
|
|
if (n != 3) |
|
|
die("illegal compact format.\n"); |
|
|
p = ptable.part[1].start; |
|
|
} |
|
|
status = !strcmp(p, path) ? 1 : 0; |
|
|
recover(&ptable); |
|
|
return status; |
|
|
} |
|
|
/* |
|
532 |
* gtags_delete: delete records belong to set of fid. |
* gtags_delete: delete records belong to set of fid. |
533 |
* |
* |
534 |
* i) gtop GTOP structure |
* i) gtop GTOP structure |
563 |
} |
} |
564 |
fid = atoi(p); |
fid = atoi(p); |
565 |
recover(&ptable); |
recover(&ptable); |
|
if (fid >= deleteset->max) |
|
|
continue; |
|
566 |
if (idset_contains(deleteset, fid)) |
if (idset_contains(deleteset, fid)) |
567 |
dbop_delete(gtop->dbop, NULL); |
dbop_delete(gtop->dbop, NULL); |
568 |
} |
} |