[BACK]Return to mandocdb.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/mandocdb.c between version 1.18 and 1.22

version 1.18, 2011/12/01 21:05:49 version 1.22, 2011/12/03 12:09:07
Line 33 
Line 33 
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   
 #ifdef __linux__  #if defined(__linux__)
   # include <endian.h>
 # include <db_185.h>  # include <db_185.h>
   #elif defined(__APPLE__)
   # include <libkern/OSByteOrder.h>
   # include <db.h>
 #else  #else
 # include <db.h>  # include <db.h>
 #endif  #endif
Line 329  main(int argc, char *argv[])
Line 333  main(int argc, char *argv[])
         argv += optind;          argv += optind;
   
         memset(&info, 0, sizeof(BTREEINFO));          memset(&info, 0, sizeof(BTREEINFO));
           info.lorder = 4321;
         info.flags = R_DUP;          info.flags = R_DUP;
   
         mp = mparse_alloc(MPARSE_AUTO, MANDOCLEVEL_FATAL, NULL, NULL);          mp = mparse_alloc(MPARSE_AUTO, MANDOCLEVEL_FATAL, NULL, NULL);
Line 626  index_merge(const struct of *of, struct mparse *mp,
Line 631  index_merge(const struct of *of, struct mparse *mp,
                  * into the database.                   * into the database.
                  */                   */
   
                 vbuf.rec = rec;                  vbuf.rec = htobe32(rec);
                 seq = R_FIRST;                  seq = R_FIRST;
                 while (0 == (ch = (*hash->seq)(hash, &key, &val, seq))) {                  while (0 == (ch = (*hash->seq)(hash, &key, &val, seq))) {
                         seq = R_NEXT;                          seq = R_NEXT;
                           vbuf.mask = htobe64(*(uint64_t *)val.data);
                         vbuf.mask = *(uint64_t *)val.data;  
                         val.size = sizeof(struct db_val);                          val.size = sizeof(struct db_val);
                         val.data = &vbuf;                          val.data = &vbuf;
   
                         dbt_put(db, dbf, &key, &val);                          dbt_put(db, dbf, &key, &val);
                 }                  }
                 if (ch < 0) {                  if (ch < 0) {
Line 732  index_prune(const struct of *ofile, DB *db, const char
Line 735  index_prune(const struct of *ofile, DB *db, const char
                                 break;                                  break;
   
                         vbuf = val.data;                          vbuf = val.data;
                         if (*maxrec != vbuf->rec)                          if (*maxrec != betoh32(vbuf->rec))
                                 continue;                                  continue;
   
                         if ((ch = (*db->del)(db, &key, R_CURSOR)) < 0)                          if ((ch = (*db->del)(db, &key, R_CURSOR)) < 0)

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.22

CVSweb