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

Diff for /mandoc/dbm.c between version 1.4 and 1.5

version 1.4, 2016/08/30 22:01:07 version 1.5, 2016/10/18 22:27:25
Line 346  page_byarch(const struct dbm_match *arg_match)
Line 346  page_byarch(const struct dbm_match *arg_match)
 }  }
   
 static struct dbm_res  static struct dbm_res
 page_bymacro(int32_t im, const struct dbm_match *match)  page_bymacro(int32_t arg_im, const struct dbm_match *arg_match)
 {  {
         static const int32_t    *pp;          static const struct dbm_match   *match;
         struct dbm_res           res = {-1, 0};          static const int32_t            *pp;
         const char              *cp;          static const char               *cp;
         int32_t                  iv;          static int32_t                   im, iv;
           struct dbm_res                   res = {-1, 0};
   
         assert(im >= 0);          assert(im >= 0);
         assert(im < MACRO_MAX);          assert(im < MACRO_MAX);
   
         /* Initialize for a new iteration. */          /* Initialize for a new iteration. */
   
         if (match != NULL) {          if (arg_match != NULL) {
                 iteration = ITER_MACRO;                  iteration = ITER_MACRO;
                   match = arg_match;
                   im = arg_im;
                 cp = nvals[im] ? dbm_get(macros[im]->value) : NULL;                  cp = nvals[im] ? dbm_get(macros[im]->value) : NULL;
                 for (iv = 0; iv < nvals[im]; iv++) {                  pp = NULL;
                         if (dbm_match(match, cp))                  iv = -1;
                                 break;  
                         cp = strchr(cp, '\0') + 1;  
                 }  
                 pp = iv == nvals[im] ? NULL : dbm_get(macros[im][iv].pages);  
                 return res;                  return res;
         }          }
         if (iteration != ITER_MACRO)          if (iteration != ITER_MACRO)
                 return res;                  return res;
   
         /* No more matches. */          /* Find the next matching macro value. */
   
         if (pp == NULL || *pp == 0) {          while (pp == NULL || *pp == 0) {
                 iteration = ITER_NONE;                  if (++iv == nvals[im]) {
                 pp = NULL;                          iteration = ITER_NONE;
                 return res;                          return res;
                   }
                   if (iv)
                           cp = strchr(cp, '\0') + 1;
                   if (dbm_match(match, cp))
                           pp = dbm_get(macros[im][iv].pages);
         }          }
   
         /* Found a match. */          /* Found a matching page. */
   
         res.page = (struct page *)dbm_get(*pp++) - pages;          res.page = (struct page *)dbm_get(*pp++) - pages;
         return res;          return res;

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

CVSweb