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

Diff for /mandoc/mandoc.c between version 1.3 and 1.4

version 1.3, 2009/07/24 20:22:24 version 1.4, 2009/10/28 19:21:59
Line 19 
Line 19 
 #include <assert.h>  #include <assert.h>
 #include <ctype.h>  #include <ctype.h>
 #include <stdlib.h>  #include <stdlib.h>
   #include <stdio.h>
   #include <string.h>
   
 #include "libmandoc.h"  #include "libmandoc.h"
   
Line 103  mandoc_special(const char *p)
Line 105  mandoc_special(const char *p)
         return(*p == ']' ? c : 0);          return(*p == ']' ? c : 0);
 }  }
   
   
   void *
   mandoc_calloc(size_t num, size_t size)
   {
           void            *ptr;
   
           ptr = calloc(num, size);
           if (NULL == ptr) {
                   fprintf(stderr, "memory exhausted\n");
                   exit(EXIT_FAILURE);
           }
   
           return(ptr);
   }
   
   
   void *
   mandoc_malloc(size_t size)
   {
           void            *ptr;
   
           ptr = malloc(size);
           if (NULL == ptr) {
                   fprintf(stderr, "memory exhausted\n");
                   exit(EXIT_FAILURE);
           }
   
           return(ptr);
   }
   
   
   void *
   mandoc_realloc(void *ptr, size_t size)
   {
   
           ptr = realloc(ptr, size);
           if (NULL == ptr) {
                   fprintf(stderr, "memory exhausted\n");
                   exit(EXIT_FAILURE);
           }
   
           return(ptr);
   }
   
   
   void *
   mandoc_reallocf(void *old_ptr, size_t size) /* FIXME: remove (not used) */
   {
           void            *ptr;
   
           ptr = realloc(old_ptr, size);
           if (NULL == ptr)
                   free(old_ptr);
   
           return(ptr);
   }
   
   
   char *
   mandoc_strdup(const char *ptr)
   {
           char            *p;
   
           p = strdup(ptr);
           if (NULL == p) {
                   fprintf(stderr, "memory exhausted\n");
                   exit(EXIT_FAILURE);
           }
   
           return(p);
   }

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

CVSweb