summaryrefslogtreecommitdiff
path: root/src/mem.c
diff options
context:
space:
mode:
authorSehong Na <sehong.na@samsung.com>2014-05-31 12:39:36 +0900
committerSehong Na <sehong.na@samsung.com>2014-05-31 12:39:36 +0900
commitf1c4a07bea53a9ca2f04896c92c0077336dfb07a (patch)
treeaa2b32eaea1b1e6ad17923f2bbbc24fa5230e2a3 /src/mem.c
downloadepson-inkjet-printer-escpr-submit/tizen_2.3/20140531.073831.tar.gz
epson-inkjet-printer-escpr-submit/tizen_2.3/20140531.073831.tar.bz2
epson-inkjet-printer-escpr-submit/tizen_2.3/20140531.073831.zip
Diffstat (limited to 'src/mem.c')
-rwxr-xr-xsrc/mem.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/mem.c b/src/mem.c
new file mode 100755
index 0000000..67da996
--- /dev/null
+++ b/src/mem.c
@@ -0,0 +1,70 @@
+/*
+ * Epson Inkjet Printer Driver (ESC/P-R) for Linux
+ * Copyright (C) 2002-2005 AVASYS CORPORATION.
+ * Copyright (C) Seiko Epson Corporation 2002-2012.
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include "mem.h"
+#include "err.h"
+
+
+void *
+mem_malloc (unsigned int size, bool_t crit)
+{
+ void *m;
+
+ m = malloc (size);
+ if (crit && m == NULL)
+ err_system ("mem_malloc");
+
+ return m;
+}
+
+void *
+mem_calloc (unsigned int num, unsigned int size, bool_t crit)
+{
+ void *m;
+
+ m = calloc (num, size);
+ if (crit && m == NULL)
+ err_system ("mem_calloc");
+
+ return m;
+}
+
+void *
+mem_realloc (void *m, u_int size, bool_t crit)
+{
+ m = realloc (m, size);
+ if (crit && m == NULL)
+ err_system ("mem_realloc");
+
+ return m;
+}
+
+void
+mem_free (void *m)
+{
+ if (m) free (m);
+
+ return;
+}