1
0
mirror of synced 2026-01-26 12:13:06 +00:00
Files
brouhaha.tumble/pdf_util.c
2003-02-20 12:20:28 +00:00

38 lines
528 B
C

#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pdf.h"
#include "pdf_util.h"
void pdf_fatal (char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
exit (2);
}
void *pdf_calloc (long int size)
{
void *m = calloc (1, size);
if (! m)
pdf_fatal ("failed to allocate memory\n");
return (m);
}
char *pdf_strdup (char *s)
{
unsigned long len = strlen (s);
char *s2 = pdf_calloc (len + 1);
strcpy (s2, s);
return (s2);
}