Thu, 20 Feb 2003 12:16:00 +0000
my own PDF routines to replace Panda.
1 #include <stdarg.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
6 #include "libpdf.h"
7 #include "libpdf_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 }