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

Diff for /docbook2mdoc/statistics.c between version 1.35 and 1.39

version 1.35, 2019/04/16 21:21:27 version 1.39, 2019/04/29 02:00:50
Line 14 
Line 14 
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */   */
   #include <sys/types.h>
   
 #include <assert.h>  #include <assert.h>
 #include <ctype.h>  #include <ctype.h>
 #include <err.h>  #include <err.h>
Line 24 
Line 26 
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   
   #include "xmalloc.h"
   
 /*  /*
  * Count parent-child element relations in a corpus of DocBook documents.   * Count parent-child element relations in a corpus of DocBook documents.
  *   *
Line 125  table_add(const char *parent, const char *child)
Line 129  table_add(const char *parent, const char *child)
   
         if (tablei == tablesz) {          if (tablei == tablesz) {
                 tablesz += 64;                  tablesz += 64;
                 table = reallocarray(table, tablesz, sizeof(*table));                  table = xreallocarray(table, tablesz, sizeof(*table));
                 if (table == NULL)  
                         err(1, NULL);  
         }          }
   
         /* Add a new entry to the table. */          /* Add a new entry to the table. */
   
         if ((table[tablei].parent = strdup(parent)) == NULL)          table[tablei].parent = xstrdup(parent);
                 err(1, NULL);          table[tablei].child = child == NULL ? NULL : xstrdup(child);
         if (child == NULL)  
                 table[tablei].child = NULL;  
         else if ((table[tablei].child = strdup(child)) == NULL)  
                 err(1, NULL);  
         table[tablei++].count = init_done ? 1 : -1;          table[tablei++].count = init_done ? 1 : -1;
 }  }
   
Line 152  stack_push(const char *name)
Line 150  stack_push(const char *name)
   
         if (stacki == stacksz) {          if (stacki == stacksz) {
                 stacksz += 8;                  stacksz += 8;
                 stack = reallocarray(stack, stacksz, sizeof(*stack));                  stack = xreallocarray(stack, stacksz, sizeof(*stack));
                 if (stack == NULL)  
                         err(1, NULL);  
         }          }
         if ((stack[stacki++] = strdup(name)) == NULL)          stack[stacki++] = xstrdup(name);
                 err(1, NULL);  
 }  }
   
 /*  /*
Line 368  main(int argc, char *argv[])
Line 363  main(int argc, char *argv[])
                 table_add("ROOT", "part");                  table_add("ROOT", "part");
                 table_add("ROOT", "preface");                  table_add("ROOT", "preface");
                 table_add("ROOT", "refentry");                  table_add("ROOT", "refentry");
                   table_add("ROOT", "reference");
                 table_add("ROOT", "sect1");                  table_add("ROOT", "sect1");
                 table_add("ROOT", "sect2");                  table_add("ROOT", "sect2");
                   table_add("abstract", NULL);
                 table_add("acronym", "TEXT");                  table_add("acronym", "TEXT");
                 table_add("affiliation", "orgdiv");                  table_add("affiliation", "orgdiv");
                 table_add("affiliation", "orgname");                  table_add("affiliation", "orgname");
Line 377  main(int argc, char *argv[])
Line 374  main(int argc, char *argv[])
                 table_add("application", "TEXT");                  table_add("application", "TEXT");
                 table_add("arg", "option");                  table_add("arg", "option");
                 table_add("article", NULL);                  table_add("article", NULL);
                   table_add("articleinfo", "abstract");
                 table_add("articleinfo", "author");                  table_add("articleinfo", "author");
                 table_add("articleinfo", "authorgroup");                  table_add("articleinfo", "authorgroup");
                 table_add("articleinfo", "copyright");                  table_add("articleinfo", "copyright");
Line 398  main(int argc, char *argv[])
Line 396  main(int argc, char *argv[])
                 table_add("authorgroup", "othercredit");                  table_add("authorgroup", "othercredit");
                 table_add("blockquote", NULL);                  table_add("blockquote", NULL);
                 table_add("book", NULL);                  table_add("book", NULL);
                   table_add("bookinfo", "abstract");
                 table_add("bookinfo", "authorgroup");                  table_add("bookinfo", "authorgroup");
                 table_add("bookinfo", "copyright");                  table_add("bookinfo", "copyright");
                 table_add("bookinfo", "legalnotice");                  table_add("bookinfo", "legalnotice");
Line 465  main(int argc, char *argv[])
Line 464  main(int argc, char *argv[])
                 table_add("itemizedlist", "listitem");                  table_add("itemizedlist", "listitem");
                 table_add("keycap", "TEXT");                  table_add("keycap", "TEXT");
                 table_add("keycode", "TEXT");                  table_add("keycode", "TEXT");
                   table_add("keycombo", "keycap");
                 table_add("keysym", "TEXT");                  table_add("keysym", "TEXT");
                 table_add("legalnotice", NULL);                  table_add("legalnotice", NULL);
                 table_add("link", NULL);                  table_add("link", NULL);
Line 527  main(int argc, char *argv[])
Line 527  main(int argc, char *argv[])
                 table_add("refentryinfo", "date");                  table_add("refentryinfo", "date");
                 table_add("refentryinfo", "productname");                  table_add("refentryinfo", "productname");
                 table_add("refentrytitle", "TEXT");                  table_add("refentrytitle", "TEXT");
                   table_add("reference", "refentry");
                 table_add("refmeta", "manvolnum");                  table_add("refmeta", "manvolnum");
                 table_add("refmeta", "refentrytitle");                  table_add("refmeta", "refentrytitle");
                 table_add("refmeta", "refmiscinfo");                  table_add("refmeta", "refmiscinfo");

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.39

CVSweb