From: michael Date: Thu, 7 May 2015 18:59:02 +0000 (+0000) Subject: - Moved malloc.c to memory.c X-Git-Tag: 1.1.0beta1~94 X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=e65ada168dd3a032592f2c679492e5e26bb680c0;p=hopm.git - Moved malloc.c to memory.c git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@5947 82007160-df01-0410-b94d-b575c5fd34c7 --- diff --git a/configure b/configure index 298e535..b3c5622 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Id: configure.ac 5314 2015-01-06 13:27:34Z michael . +# From configure.ac Id: configure.ac 5943 2015-05-06 19:09:49Z michael . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for hopm TRUNK. # diff --git a/src/libopm/src/Makefile.am b/src/libopm/src/Makefile.am index 184b8a2..a4ce852 100644 --- a/src/libopm/src/Makefile.am +++ b/src/libopm/src/Makefile.am @@ -7,8 +7,8 @@ libopm_la_SOURCES = config.c \ libopm.h \ list.c \ list.h \ - malloc.c \ - malloc.h \ + memory.c \ + memory.h \ opm_common.h \ opm_error.h \ opm.h \ diff --git a/src/libopm/src/Makefile.in b/src/libopm/src/Makefile.in index 1cbdc78..6061b1f 100644 --- a/src/libopm/src/Makefile.in +++ b/src/libopm/src/Makefile.in @@ -100,7 +100,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libopm_la_DEPENDENCIES = @LTLIBOBJS@ -am_libopm_la_OBJECTS = config.lo libopm.lo list.lo malloc.lo proxy.lo +am_libopm_la_OBJECTS = config.lo libopm.lo list.lo memory.lo proxy.lo libopm_la_OBJECTS = $(am_libopm_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -298,8 +298,8 @@ libopm_la_SOURCES = config.c \ libopm.h \ list.c \ list.h \ - malloc.c \ - malloc.h \ + memory.c \ + memory.h \ opm_common.h \ opm_error.h \ opm.h \ @@ -365,7 +365,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libopm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxy.Plo@am__quote@ .c.o: diff --git a/src/libopm/src/config.c b/src/libopm/src/config.c index bcb82b0..7cc5f59 100644 --- a/src/libopm/src/config.c +++ b/src/libopm/src/config.c @@ -25,7 +25,7 @@ #include -#include "malloc.h" +#include "memory.h" #include "config.h" #include "inet.h" #include "opm_error.h" diff --git a/src/libopm/src/libopm.c b/src/libopm/src/libopm.c index 817b768..bd5b1b2 100644 --- a/src/libopm/src/libopm.c +++ b/src/libopm/src/libopm.c @@ -25,7 +25,7 @@ #include "config.h" #include "libopm.h" -#include "malloc.h" +#include "memory.h" #include "opm_error.h" #include "opm_types.h" #include "opm_common.h" diff --git a/src/libopm/src/list.c b/src/libopm/src/list.c index 8e0a72d..5fd707a 100644 --- a/src/libopm/src/list.c +++ b/src/libopm/src/list.c @@ -25,7 +25,7 @@ #include "opm_common.h" #include "list.h" -#include "malloc.h" +#include "memory.h" #include "opm.h" diff --git a/src/libopm/src/malloc.c b/src/libopm/src/malloc.c deleted file mode 100644 index f7988b4..0000000 --- a/src/libopm/src/malloc.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2002 Erik Fears - * - * 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. - * 59 Temple Place - Suite 330 - * Boston, MA 02111-1307, USA. - * - * - */ - -#include -#include -#include "setup.h" - -#include "malloc.h" -#include "opm.h" - - -/* xcalloc - * - * A wrapper function for malloc(), for catching memory issues - * and error handling. - * - * Parameters - * bytes: amount in bytes to allocate - * - * Return: - * Pointer to allocated memory - */ - -void *libopm_xcalloc(size_t bytes) -{ - void *ret = calloc(1, bytes); - - assert(ret); - - return ret; -} - - - -/* MyFree - * - * Free memory allocated with xcalloc - * - * Parameters: - * var: pointer to memory to free - * - * Return: - * None - */ - -void libopm_MyFree(void **var) -{ - if(*var != NULL) - free(*var); - *var = NULL; -} - -void * -libopm_xstrdup(const char *s) -{ - void *ret = malloc(strlen(s) + 1); - - assert(ret); - strcpy(ret, s); - - return ret; -} diff --git a/src/libopm/src/malloc.h b/src/libopm/src/malloc.h deleted file mode 100644 index 4e4a79c..0000000 --- a/src/libopm/src/malloc.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef MALLOC_H -#define MALLOC_H - -#include "setup.h" - -#include - -#define xcalloc(SIZE) libopm_xcalloc(SIZE) -#define MyFree(X) libopm_MyFree((void **) &X) - -void *libopm_xcalloc(size_t bytes); -void libopm_MyFree(void **var); -extern void *libopm_xstrdup(const char *); - -#endif /* MALLOC_H */ diff --git a/src/libopm/src/memory.c b/src/libopm/src/memory.c new file mode 100644 index 0000000..569a526 --- /dev/null +++ b/src/libopm/src/memory.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2002 Erik Fears + * + * 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. + * 59 Temple Place - Suite 330 + * Boston, MA 02111-1307, USA. + * + * + */ + +#include +#include +#include "setup.h" + +#include "memory.h" +#include "opm.h" + + +/* xcalloc + * + * A wrapper function for malloc(), for catching memory issues + * and error handling. + * + * Parameters + * bytes: amount in bytes to allocate + * + * Return: + * Pointer to allocated memory + */ + +void *libopm_xcalloc(size_t bytes) +{ + void *ret = calloc(1, bytes); + + assert(ret); + + return ret; +} + + + +/* MyFree + * + * Free memory allocated with xcalloc + * + * Parameters: + * var: pointer to memory to free + * + * Return: + * None + */ + +void libopm_MyFree(void **var) +{ + if(*var != NULL) + free(*var); + *var = NULL; +} + +void * +libopm_xstrdup(const char *s) +{ + void *ret = malloc(strlen(s) + 1); + + assert(ret); + strcpy(ret, s); + + return ret; +} diff --git a/src/libopm/src/memory.h b/src/libopm/src/memory.h new file mode 100644 index 0000000..4e4a79c --- /dev/null +++ b/src/libopm/src/memory.h @@ -0,0 +1,15 @@ +#ifndef MALLOC_H +#define MALLOC_H + +#include "setup.h" + +#include + +#define xcalloc(SIZE) libopm_xcalloc(SIZE) +#define MyFree(X) libopm_MyFree((void **) &X) + +void *libopm_xcalloc(size_t bytes); +void libopm_MyFree(void **var); +extern void *libopm_xstrdup(const char *); + +#endif /* MALLOC_H */