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

Diff for /mandoc/Attic/apropos_db.c between version 1.17 and 1.23

version 1.17, 2011/12/01 23:46:26 version 1.23, 2011/12/10 21:46:59
Line 15 
Line 15 
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */   */
   #ifdef HAVE_CONFIG_H
   #include "config.h"
   #endif
   
 #include <assert.h>  #include <assert.h>
 #include <fcntl.h>  #include <fcntl.h>
 #include <regex.h>  #include <regex.h>
Line 24 
Line 28 
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   
 #include <arpa/inet.h>  #if defined(__linux__)
   # include <endian.h>
 #ifdef __linux__  
 # 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 177  btree_read(const DBT *k, const DBT *v, 
Line 183  btree_read(const DBT *k, const DBT *v, 
   
         vp = v->data;          vp = v->data;
         norm_string((const char *)k->data, mc, buf);          norm_string((const char *)k->data, mc, buf);
         dbv->rec = ntohl(vp->rec);          dbv->rec = betoh32(vp->rec);
         dbv->mask = vp->mask;          dbv->mask = betoh64(vp->mask);
         return(1);          return(1);
 }  }
   
Line 535  single_search(struct rectree *tree, const struct opts 
Line 541  single_search(struct rectree *tree, const struct opts 
   
                 if (opts->cat && strcasecmp(opts->cat, r.res.cat))                  if (opts->cat && strcasecmp(opts->cat, r.res.cat))
                         continue;                          continue;
                 if (opts->arch && strcasecmp(opts->arch, r.res.arch))  
                         continue;  
   
                   if (opts->arch && *r.res.arch)
                           if (strcasecmp(opts->arch, r.res.arch))
                                   continue;
   
                 tree->node = rs = mandoc_realloc                  tree->node = rs = mandoc_realloc
                         (rs, (tree->len + 1) * sizeof(struct rec));                          (rs, (tree->len + 1) * sizeof(struct rec));
   
                 memcpy(&rs[tree->len], &r, sizeof(struct rec));                  memcpy(&rs[tree->len], &r, sizeof(struct rec));
                   memset(&r, 0, sizeof(struct rec));
                 rs[tree->len].matches =                  rs[tree->len].matches =
                         mandoc_calloc(terms, sizeof(int));                          mandoc_calloc(terms, sizeof(int));
   
Line 557  single_search(struct rectree *tree, const struct opts 
Line 566  single_search(struct rectree *tree, const struct opts 
                 } else                  } else
                         root = tree->len;                          root = tree->len;
   
                 memset(&r, 0, sizeof(struct rec));  
                 tree->len++;                  tree->len++;
         }          }
   
Line 565  single_search(struct rectree *tree, const struct opts 
Line 573  single_search(struct rectree *tree, const struct opts 
         (*idx->close)(idx);          (*idx->close)(idx);
   
         free(buf);          free(buf);
           recfree(&r);
         return(1 == ch);          return(1 == ch);
 }  }
   

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.23

CVSweb