/[global]/global/libutil/gtagsop.c
ViewVC logotype

Diff of /global/libutil/gtagsop.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.65 by h-iwamoto, Sun Jun 26 04:57:30 2005 UTC revision 1.66 by h-iwamoto, Mon Jun 27 12:39:51 2005 UTC
# Line 36  Line 36 
36  #ifdef HAVE_UNISTD_H  #ifdef HAVE_UNISTD_H
37  #include <unistd.h>  #include <unistd.h>
38  #endif  #endif
39    #ifdef HAVE_LIMITS_H
40    #include <limits.h>
41    #endif
42    
43  #include "char.h"  #include "char.h"
44  #include "conf.h"  #include "conf.h"
# Line 558  gtags_delete(gtop, path) Line 561  gtags_delete(gtop, path)
561           */           */
562  }  }
563  /*  /*
564     * gtags_delete_by_fidset: delete records belong to set of fid.
565     *
566     *      i)      gtop    GTOP structure
567     *      i)      fidset  bit array of fid
568     *      i)      max_fid number of bits in bit array
569     */
570    void
571    gtags_delete_by_fidset(gtop, fidset, max_fid)
572            GTOP *gtop;
573            const unsigned char *fidset;
574            int max_fid;
575    {
576            const char *line, *p;
577            SPLIT ptable;
578            int fid, n;
579    
580            for (line = dbop_first(gtop->dbop, NULL, NULL, 0); line; line = dbop_next(gtop->dbop)) {
581                    n = split((char *)line, 4, &ptable);
582                    if (gtop->format & GTAGS_COMPACT) {
583                            if (n != 3)
584                                    die("illegal compact format.\n");
585                            p = ptable.part[1].start;
586                    } else {
587                            if (n < 4) {
588                                    recover(&ptable);
589                                    die("too small number of parts.\n'%s'", line);
590                            }
591                            p = ptable.part[2].start;
592                    }
593                    if (!(gtop->format & GTAGS_PATHINDEX)) {
594                            p = gpath_path2fid(p);
595                            if (p == NULL)
596                                    die("GPATH is corrupted.");
597                    }
598                    fid = atoi(p);
599                    recover(&ptable);
600                    if (fid >= max_fid)
601                            continue;
602                    if (fidset[fid  / CHAR_BIT] & (1 << (fid % CHAR_BIT)))
603                            dbop_delete(gtop->dbop, NULL);
604            }
605    }
606    /*
607   * gtags_first: return first record   * gtags_first: return first record
608   *   *
609   *      i)      gtop    GTOP structure   *      i)      gtop    GTOP structure

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.66

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26