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

Diff for /mandoc/mansearch.c between version 1.72 and 1.74

version 1.72, 2017/04/18 15:06:49 version 1.74, 2017/07/01 09:47:30
Line 104  mansearch(const struct mansearch *search,
Line 104  mansearch(const struct mansearch *search,
         }          }
   
         cur = maxres = 0;          cur = maxres = 0;
         *res = NULL;          if (res != NULL)
                   *res = NULL;
   
         outkey = KEY_Nd;          outkey = KEY_Nd;
         if (search->outkey != NULL)          if (search->outkey != NULL)
Line 155  mansearch(const struct mansearch *search,
Line 156  mansearch(const struct mansearch *search,
                 chdir_status = 1;                  chdir_status = 1;
   
                 if (dbm_open(MANDOC_DB) == -1) {                  if (dbm_open(MANDOC_DB) == -1) {
                         warn("%s/%s", paths->paths[i], MANDOC_DB);                          if (errno != ENOENT)
                                   warn("%s/%s", paths->paths[i], MANDOC_DB);
                         continue;                          continue;
                 }                  }
   
Line 172  mansearch(const struct mansearch *search,
Line 174  mansearch(const struct mansearch *search,
                             lstmatch(search->arch, page->arch) == 0)                              lstmatch(search->arch, page->arch) == 0)
                                 continue;                                  continue;
   
                           if (res == NULL) {
                                   cur = 1;
                                   break;
                           }
                         if (cur + 1 > maxres) {                          if (cur + 1 > maxres) {
                                 maxres += 1024;                                  maxres += 1024;
                                 *res = mandoc_reallocarray(*res,                                  *res = mandoc_reallocarray(*res,
Line 203  mansearch(const struct mansearch *search,
Line 209  mansearch(const struct mansearch *search,
                 if (cur && search->firstmatch)                  if (cur && search->firstmatch)
                         break;                          break;
         }          }
         qsort(*res, cur, sizeof(struct manpage), manpage_compare);          if (res != NULL)
                   qsort(*res, cur, sizeof(struct manpage), manpage_compare);
         if (chdir_status && getcwd_status && chdir(buf) == -1)          if (chdir_status && getcwd_status && chdir(buf) == -1)
                 warn("%s", buf);                  warn("%s", buf);
         exprfree(e);          exprfree(e);
         *sz = cur;          *sz = cur;
         return 1;          return res != NULL || cur;
 }  }
   
 /*  /*

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.74

CVSweb