58 lines
1.3 KiB
C
58 lines
1.3 KiB
C
/*
|
|
Copyright (C) 2004, Wolfgang Hottgenroth
|
|
|
|
This file is part of smmapdfw.
|
|
|
|
smmapdfw is free software; you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
smmapdfw is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with smmapdfw. If not, write to the Free Software Foundation, 59
|
|
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
|
|
#include <stdlib.h>
|
|
#include <syslog.h>
|
|
#include <string.h>
|
|
#include "htmalloc.h"
|
|
|
|
|
|
void *htmalloc(size_t size) {
|
|
void *p = malloc(size);
|
|
if (NULL == p) {
|
|
syslog(LOG_ERR, "htmalloc: out of memory");
|
|
exit(153);
|
|
}
|
|
return p;
|
|
}
|
|
|
|
void *htrealloc(void *ptr, size_t size) {
|
|
void *p = realloc(ptr, size);
|
|
if (NULL == p) {
|
|
syslog(LOG_ERR, "htremalloc: out of memory");
|
|
exit(153);
|
|
}
|
|
return p;
|
|
}
|
|
|
|
char *htstrdup(const char *s) {
|
|
char *p = htmalloc(strlen(s) + 1);
|
|
strcpy(p, s);
|
|
return p;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|