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

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

version 1.73, 2017/05/17 21:19:32 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 173  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 204  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.73  
changed lines
  Added in v.1.74

CVSweb