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

Diff for /mandoc/mansearch.c between version 1.33 and 1.34

version 1.33, 2014/04/17 19:20:01 version 1.34, 2014/04/20 16:46:05
Line 64  extern const char *const mansearch_keynames[];
Line 64  extern const char *const mansearch_keynames[];
         } while (0)          } while (0)
   
 struct  expr {  struct  expr {
         uint64_t         bits;    /* type-mask */          uint64_t         bits;    /* type-mask */
         const char      *substr;  /* to search for, if applicable */          const char      *substr;  /* to search for, if applicable */
         regex_t          regexp;  /* compiled regexp, if applicable */          regex_t          regexp;  /* compiled regexp, if applicable */
         int              open;    /* opening parentheses before */          int              open;    /* opening parentheses before */
Line 87  static char  *buildoutput(sqlite3 *, sqlite3_stmt *,
Line 87  static char  *buildoutput(sqlite3 *, sqlite3_stmt *,
 static  void            *hash_alloc(size_t, void *);  static  void            *hash_alloc(size_t, void *);
 static  void             hash_free(void *, size_t, void *);  static  void             hash_free(void *, size_t, void *);
 static  void            *hash_halloc(size_t, void *);  static  void            *hash_halloc(size_t, void *);
 static  struct expr     *exprcomp(const struct mansearch *,  static  struct expr     *exprcomp(const struct mansearch *,
                                 int, char *[]);                                  int, char *[]);
 static  void             exprfree(struct expr *);  static  void             exprfree(struct expr *);
 static  struct expr     *exprspec(struct expr *, uint64_t,  static  struct expr     *exprspec(struct expr *, uint64_t,
Line 101  static void   sql_regexp(sqlite3_context *context,
Line 101  static void   sql_regexp(sqlite3_context *context,
                                 int argc, sqlite3_value **argv);                                  int argc, sqlite3_value **argv);
 static  char            *sql_statement(const struct expr *);  static  char            *sql_statement(const struct expr *);
   
   
 int  int
 mansearch_setup(int start)  mansearch_setup(int start)
 {  {
Line 235  mansearch(const struct mansearch *search,
Line 236  mansearch(const struct mansearch *search,
                 } else if (-1 == chdir(paths->paths[i])) {                  } else if (-1 == chdir(paths->paths[i])) {
                         perror(paths->paths[i]);                          perror(paths->paths[i]);
                         continue;                          continue;
                 }                  }
   
                 c =  sqlite3_open_v2                  c = sqlite3_open_v2(MANDOC_DB, &db,
                         (MANDOC_DB, &db,                      SQLITE_OPEN_READONLY, NULL);
                          SQLITE_OPEN_READONLY, NULL);  
   
                 if (SQLITE_OK != c) {                  if (SQLITE_OK != c) {
                         perror(MANDOC_DB);                          perror(MANDOC_DB);
Line 288  mansearch(const struct mansearch *search,
Line 288  mansearch(const struct mansearch *search,
                  */                   */
                 while (SQLITE_ROW == (c = sqlite3_step(s))) {                  while (SQLITE_ROW == (c = sqlite3_step(s))) {
                         pageid = sqlite3_column_int64(s, 2);                          pageid = sqlite3_column_int64(s, 2);
                         idx = ohash_lookup_memory                          idx = ohash_lookup_memory(&htab,
                                 (&htab, (char *)&pageid,                              (char *)&pageid, sizeof(uint64_t),
                                  sizeof(uint64_t), (uint32_t)pageid);                              (uint32_t)pageid);
   
                         if (NULL != ohash_find(&htab, idx))                          if (NULL != ohash_find(&htab, idx))
                                 continue;                                  continue;
Line 309  mansearch(const struct mansearch *search,
Line 309  mansearch(const struct mansearch *search,
   
                 sqlite3_finalize(s);                  sqlite3_finalize(s);
   
                 c = sqlite3_prepare_v2(db,                  c = sqlite3_prepare_v2(db,
                     "SELECT * FROM mlinks WHERE pageid=?"                      "SELECT * FROM mlinks WHERE pageid=?"
                     " ORDER BY sec, arch, name",                      " ORDER BY sec, arch, name",
                     -1, &s, NULL);                      -1, &s, NULL);
Line 327  mansearch(const struct mansearch *search,
Line 327  mansearch(const struct mansearch *search,
                                 mp = ohash_next(&htab, &idx)) {                                  mp = ohash_next(&htab, &idx)) {
                         if (cur + 1 > maxres) {                          if (cur + 1 > maxres) {
                                 maxres += 1024;                                  maxres += 1024;
                                 *res = mandoc_realloc                                  *res = mandoc_realloc(*res,
                                         (*res, maxres * sizeof(struct manpage));                                      maxres * sizeof(struct manpage));
                         }                          }
                         mpage = *res + cur;                          mpage = *res + cur;
                         mpage->form = mp->form;                          mpage->form = mp->form;

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

CVSweb