pdf_util.c

Thu, 20 Feb 2003 12:20:28 +0000

author
eric
date
Thu, 20 Feb 2003 12:20:28 +0000
changeset 60
ffb5b1e54eb2
parent 59
e8821eb2fb08
child 62
9bd354b83e16
permissions
-rw-r--r--

fix includes.

     1 #include <stdarg.h>
     2 #include <stdio.h>
     3 #include <stdlib.h>
     4 #include <string.h>
     6 #include "pdf.h"
     7 #include "pdf_util.h"
    10 void pdf_fatal (char *fmt, ...)
    11 {
    12   va_list ap;
    14   va_start (ap, fmt);
    15   vfprintf (stderr, fmt, ap);
    16   va_end (ap);
    18   exit (2);
    19 }
    22 void *pdf_calloc (long int size)
    23 {
    24   void *m = calloc (1, size);
    25   if (! m)
    26     pdf_fatal ("failed to allocate memory\n");
    27   return (m);
    28 }
    31 char *pdf_strdup (char *s)
    32 {
    33   unsigned long len = strlen (s);
    34   char *s2 = pdf_calloc (len + 1);
    35   strcpy (s2, s);
    36   return (s2);
    37 }