source: subversion/applications/utils/tirex/backend-mapnik/mortal.h @ 29342

Last change on this file since 29342 was 29247, checked in by Dane Springmeyer, 7 years ago

malloc.h is not available on osx and should not be needed to be explicitly included on other platforms

File size: 675 bytes
Line 
1/*
2 * Tirex Tile Rendering System
3 *
4 * Mapnik rendering backend
5 *
6 * Originally written by Jochen Topf & Frederik Ramm.
7 *
8 */
9
10/**
11 * Mortal
12 *
13 * Superclass for classes that may terminate the program.
14 */
15
16#ifndef mortal_included
17#define mortal_included
18
19#include <sys/types.h>
20#include <string.h>
21#include <stdio.h>
22#include <stdlib.h>
23#include <stdarg.h>
24
25class Mortal
26{
27    protected:
28
29    void die(const char *fmt, ...)
30    {
31        char *cpy;
32        cpy = (char *) malloc(strlen(fmt) + 256);
33        sprintf(cpy, "%s\n", fmt);
34        va_list ap;
35        va_start(ap, fmt);
36        vfprintf(stderr, cpy, ap);
37        va_end(ap);
38        exit(1);
39    }
40};
41
42#endif
43
Note: See TracBrowser for help on using the repository browser.