]> granicus.if.org Git - procps-ng/commitdiff
library: actually remove those alloc.h & alloc.c files
authorJim Warner <james.warner@comcast.net>
Wed, 15 Nov 2017 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Wed, 20 Dec 2017 10:18:53 +0000 (21:18 +1100)
Signed-off-by: Jim Warner <james.warner@comcast.net>
Makefile.am
proc/alloc.c [deleted file]
proc/alloc.h [deleted file]

index 97dcd4fa3338448b122ae8892f9b24dfcc96e501..077137bb621f3c0a813684595edb78fb608e40a2 100644 (file)
@@ -237,8 +237,6 @@ proc_libprocps_la_LDFLAGS = \
        -Wl,--version-script=$(top_srcdir)/proc/libprocps.sym
 
 proc_libprocps_la_SOURCES = \
-       proc/alloc.c \
-       proc/alloc.h \
        proc/devname.c \
        proc/devname.h \
        proc/diskstats.c \
@@ -277,7 +275,6 @@ proc_libprocps_la_SOURCES = \
 
 proc_libprocps_la_includedir = $(includedir)/proc/
 proc_libprocps_la_include_HEADERS = \
-       proc/alloc.h \
        proc/devname.h \
        proc/diskstats.h \
        proc/escape.h \
diff --git a/proc/alloc.c b/proc/alloc.c
deleted file mode 100644 (file)
index 7d9d69c..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * alloc.c - memory allocation functions
- * Copyright (C) 1992-1998 by Michael K. Johnson, johnsonm@redhat.com
- * Copyright 2002 Albert Cahalan
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "alloc.h"
-
-typedef void (*message_fn)(const char *__restrict, ...) __attribute__((format(printf,1,2)));
- /* change xalloc_err_handler to override the default fprintf(stderr... */
-extern message_fn xalloc_err_handler;
-
-static void xdefault_error(const char *restrict fmts, ...) __attribute__((format(printf,1,2)));
-static void xdefault_error(const char *restrict fmts, ...) {
-    va_list va;
-
-    va_start(va, fmts);
-    fprintf(stderr, fmts, va);
-    va_end(va);
-}
-
-message_fn xalloc_err_handler = xdefault_error;
-
-
-void *xcalloc(unsigned int size) {
-    void * p;
-
-    if (size == 0)
-        ++size;
-    p = calloc(1, size);
-    if (!p) {
-        xalloc_err_handler("%s failed to allocate %u bytes of memory", __func__, size);
-        exit(EXIT_FAILURE);
-    }
-    return p;
-}
-
-void *xmalloc(size_t size) {
-    void *p;
-
-    if (size == 0)
-        ++size;
-    p = malloc(size);
-    if (!p) {
-       xalloc_err_handler("%s failed to allocate %zu bytes of memory", __func__, size);
-        exit(EXIT_FAILURE);
-    }
-    return(p);
-}
-
-void *xrealloc(void *oldp, unsigned int size) {
-    void *p;
-
-    if (size == 0)
-        ++size;
-    p = realloc(oldp, size);
-    if (!p) {
-        xalloc_err_handler("%s failed to allocate %u bytes of memory", __func__, size);
-        exit(EXIT_FAILURE);
-    }
-    return(p);
-}
-
-char *xstrdup(const char *str) {
-    char *p = NULL;
-
-    if (str) {
-        unsigned int size = strlen(str) + 1;
-        p = malloc(size);
-        if (!p) {
-            xalloc_err_handler("%s failed to allocate %u bytes of memory", __func__, size);
-            exit(EXIT_FAILURE);
-        }
-        strcpy(p, str);
-    }
-    return(p);
-}
diff --git a/proc/alloc.h b/proc/alloc.h
deleted file mode 100644 (file)
index c1d3e9d..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef PROCPS_PROC_ALLOC_H
-#define PROCPS_PROC_ALLOC_H
-
-#include <features.h>
-
-__BEGIN_DECLS
-
-#define MALLOC __attribute__ ((__malloc__))
-
-extern void *xcalloc(unsigned int size) MALLOC;
-extern void *xmalloc(size_t size) MALLOC;
-extern void *xrealloc(void *oldp, unsigned int size) MALLOC;
-extern char *xstrdup(const char *str) MALLOC;
-
-__END_DECLS
-
-#endif