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

Diff for /docbook2mdoc/statistics.c between version 1.34 and 1.37

version 1.34, 2019/04/15 00:34:15 version 1.37, 2019/04/28 15:03:29
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("acronym", "TEXT");                  table_add("acronym", "TEXT");
Line 508  main(int argc, char *argv[])
Line 504  main(int argc, char *argv[])
                 table_add("phrase", "TEXT");                  table_add("phrase", "TEXT");
                 table_add("preface", NULL);                  table_add("preface", NULL);
                 table_add("primary", NULL);                  table_add("primary", NULL);
                   table_add("productname", "TEXT");
                 table_add("programlisting", NULL);                  table_add("programlisting", NULL);
                 table_add("property", "TEXT");                  table_add("property", "TEXT");
                 table_add("pubdate", "TEXT");                  table_add("pubdate", "TEXT");
Line 524  main(int argc, char *argv[])
Line 521  main(int argc, char *argv[])
                 table_add("refentryinfo", "authorgroup");                  table_add("refentryinfo", "authorgroup");
                 table_add("refentryinfo", "copyright");                  table_add("refentryinfo", "copyright");
                 table_add("refentryinfo", "date");                  table_add("refentryinfo", "date");
                   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.34  
changed lines
  Added in v.1.37

CVSweb