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

Diff for /mandoc/dba.c between version 1.4 and 1.8

version 1.4, 2016/08/05 21:38:11 version 1.8, 2016/08/17 20:46:56
Line 17 
Line 17 
  * Allocation-based version of the mandoc database, for read-write access.   * Allocation-based version of the mandoc database, for read-write access.
  * The interface is defined in "dba.h".   * The interface is defined in "dba.h".
  */   */
   #include "config.h"
   
 #include <sys/types.h>  #include <sys/types.h>
   #if HAVE_ENDIAN
 #include <endian.h>  #include <endian.h>
   #elif HAVE_SYS_ENDIAN
   #include <sys/endian.h>
   #elif HAVE_NTOHL
   #include <arpa/inet.h>
   #endif
 #include <errno.h>  #include <errno.h>
 #include <stdint.h>  #include <stdint.h>
 #include <stdlib.h>  #include <stdlib.h>
Line 128  dba_write(const char *fname, struct dba *dba)
Line 136  dba_write(const char *fname, struct dba *dba)
  * Create a new page and append it to the pages table.   * Create a new page and append it to the pages table.
  */   */
 struct dba_array *  struct dba_array *
 dba_page_new(struct dba_array *pages, const char *name, const char *sect,  dba_page_new(struct dba_array *pages, const char *arch,
     const char *arch, const char *desc, const char *file, enum form form)      const char *desc, const char *file, enum form form)
 {  {
         struct dba_array *page, *entry;          struct dba_array *page, *entry;
   
         page = dba_array_new(DBP_MAX, 0);          page = dba_array_new(DBP_MAX, 0);
         entry = dba_array_new(1, DBA_STR | DBA_GROW);          entry = dba_array_new(1, DBA_STR | DBA_GROW);
         dba_array_add(entry, prepend(name, NAME_FILE & NAME_MASK));  
         dba_array_add(page, entry);          dba_array_add(page, entry);
         entry = dba_array_new(1, DBA_STR | DBA_GROW);          entry = dba_array_new(1, DBA_STR | DBA_GROW);
         dba_array_add(entry, (void *)sect);  
         dba_array_add(page, entry);          dba_array_add(page, entry);
         if (arch != NULL && *arch != '\0') {          if (arch != NULL && *arch != '\0') {
                 entry = dba_array_new(1, DBA_STR | DBA_GROW);                  entry = dba_array_new(1, DBA_STR | DBA_GROW);
Line 169  dba_page_add(struct dba_array *page, int32_t ie, const
Line 175  dba_page_add(struct dba_array *page, int32_t ie, const
         if (ie == DBP_ARCH) {          if (ie == DBP_ARCH) {
                 if (entries == NULL)                  if (entries == NULL)
                         return;                          return;
                 if (str == NULL) {                  if (str == NULL || *str == '\0') {
                         dba_array_free(entries);                          dba_array_free(entries);
                         dba_array_set(page, DBP_ARCH, NULL);                          dba_array_set(page, DBP_ARCH, NULL);
                         return;                          return;

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

CVSweb