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

Diff for /mandoc/mandocdb.c between version 1.223 and 1.224

version 1.223, 2016/07/29 15:23:57 version 1.224, 2016/07/29 15:26:37
Line 122  static void  mlink_add(struct mlink *, const struct st
Line 122  static void  mlink_add(struct mlink *, const struct st
 static  void     mlink_check(struct mpage *, struct mlink *);  static  void     mlink_check(struct mpage *, struct mlink *);
 static  void     mlink_free(struct mlink *);  static  void     mlink_free(struct mlink *);
 static  void     mlinks_undupe(struct mpage *);  static  void     mlinks_undupe(struct mpage *);
   int              mpages_compare(const void *, const void *);
 static  void     mpages_free(void);  static  void     mpages_free(void);
 static  void     mpages_merge(struct dba *, struct mparse *);  static  void     mpages_merge(struct dba *, struct mparse *);
 static  void     parse_cat(struct mpage *, int);  static  void     parse_cat(struct mpage *, int);
Line 1084  mlink_check(struct mpage *mpage, struct mlink *mlink)
Line 1085  mlink_check(struct mpage *mpage, struct mlink *mlink)
 static void  static void
 mpages_merge(struct dba *dba, struct mparse *mp)  mpages_merge(struct dba *dba, struct mparse *mp)
 {  {
         struct mpage            *mpage, *mpage_dest;          struct mpage            **mplist, *mpage, *mpage_dest;
         struct mlink            *mlink, *mlink_dest;          struct mlink            *mlink, *mlink_dest;
         struct roff_man         *man;          struct roff_man         *man;
         char                    *sodest;          char                    *sodest;
         char                    *cp;          char                    *cp;
         int                      fd;          int                      fd;
         unsigned int             pslot;          unsigned int             ip, npages, pslot;
   
           npages = ohash_entries(&mpages);
           mplist = mandoc_reallocarray(NULL, npages, sizeof(*mplist));
           ip = 0;
         mpage = ohash_first(&mpages, &pslot);          mpage = ohash_first(&mpages, &pslot);
         while (mpage != NULL) {          while (mpage != NULL) {
                 mlinks_undupe(mpage);                  mlinks_undupe(mpage);
                 if ((mlink = mpage->mlinks) == NULL) {                  if (mpage->mlinks != NULL)
                         mpage = ohash_next(&mpages, &pslot);                          mplist[ip++] = mpage;
                         continue;                  mpage = ohash_next(&mpages, &pslot);
                 }          }
           npages = ip;
           qsort(mplist, npages, sizeof(*mplist), mpages_compare);
   
           for (ip = 0; ip < npages; ip++) {
                   mpage = mplist[ip];
                   mlink = mpage->mlinks;
                 name_mask = NAME_MASK;                  name_mask = NAME_MASK;
                 mandoc_ohash_init(&names, 4, offsetof(struct str, key));                  mandoc_ohash_init(&names, 4, offsetof(struct str, key));
                 mandoc_ohash_init(&strings, 6, offsetof(struct str, key));                  mandoc_ohash_init(&strings, 6, offsetof(struct str, key));
Line 1207  mpages_merge(struct dba *dba, struct mparse *mp)
Line 1216  mpages_merge(struct dba *dba, struct mparse *mp)
 nextpage:  nextpage:
                 ohash_delete(&strings);                  ohash_delete(&strings);
                 ohash_delete(&names);                  ohash_delete(&names);
                 mpage = ohash_next(&mpages, &pslot);  
         }          }
           free(mplist);
   }
   
   int
   mpages_compare(const void *vp1, const void *vp2)
   {
           const struct mpage      *mp1, *mp2;
   
           mp1 = *(const struct mpage **)vp1;
           mp2 = *(const struct mpage **)vp2;
           return strcmp(mp1->mlinks->file, mp2->mlinks->file);
 }  }
   
 static void  static void

Legend:
Removed from v.1.223  
changed lines
  Added in v.1.224

CVSweb