[PATCH 07/22] os: Remove deprecated malloc/free wrappers
Adam Jackson
ajax at redhat.com
Tue Jul 22 08:46:27 PDT 2014
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
doc/Xserver-spec.xml | 6 ++----
include/os.h | 37 +------------------------------------
os/utils.c | 48 ------------------------------------------------
3 files changed, 3 insertions(+), 88 deletions(-)
diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
index cd1a9d0..4c34419 100644
--- a/doc/Xserver-spec.xml
+++ b/doc/Xserver-spec.xml
@@ -1217,11 +1217,9 @@ library is contained in dix/dixfonts.c
<section>
<title>Memory Management</title>
<para>
-Memory management is based on functions in the C runtime library.
-Xalloc(), Xrealloc(), and Xfree() are deprecated aliases for malloc(),
+Memory management is based on functions in the C runtime library, malloc(),
realloc(), and free(), and you should simply call the C library functions
-directly. Consult a C runtime library reference
-manual for more details.
+directly. Consult a C runtime library reference manual for more details.
</para>
<para>
Treat memory allocation carefully in your implementation. Memory
diff --git a/include/os.h b/include/os.h
index 0cbb928..9982c9b 100644
--- a/include/os.h
+++ b/include/os.h
@@ -67,15 +67,11 @@ SOFTWARE.
typedef struct _FontPathRec *FontPathPtr;
typedef struct _NewClientRec *NewClientPtr;
-#ifndef xalloc
+#ifndef xnfalloc
#define xnfalloc(size) XNFalloc((unsigned long)(size))
#define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size))
#define xnfrealloc(ptr, size) XNFrealloc((void *)(ptr), (unsigned long)(size))
-#define xalloc(size) Xalloc((unsigned long)(size))
-#define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size))
-#define xrealloc(ptr, size) Xrealloc((void *)(ptr), (unsigned long)(size))
-#define xfree(ptr) Xfree((void *)(ptr))
#define xstrdup(s) Xstrdup(s)
#define xnfstrdup(s) XNFstrdup(s)
#endif
@@ -214,37 +210,6 @@ extern _X_EXPORT int set_font_authorizations(char **authorizations,
int *authlen,
void *client);
-#ifndef _HAVE_XALLOC_DECLS
-#define _HAVE_XALLOC_DECLS
-
-/*
- * Use malloc(3) instead.
- */
-extern _X_EXPORT void *
-Xalloc(unsigned long /*amount */ ) _X_DEPRECATED;
-
-/*
- * Use calloc(3) instead
- */
-extern _X_EXPORT void *
-Xcalloc(unsigned long /*amount */ ) _X_DEPRECATED;
-
-/*
- * Use realloc(3) instead
- */
-extern _X_EXPORT void *
-Xrealloc(void * /*ptr */ , unsigned long /*amount */ )
- _X_DEPRECATED;
-
-/*
- * Use free(3) instead
- */
-extern _X_EXPORT void
-Xfree(void * /*ptr */ )
- _X_DEPRECATED;
-
-#endif
-
/*
* This function malloc(3)s buffer, terminating the server if there is not
* enough memory.
diff --git a/os/utils.c b/os/utils.c
index ed7581e..f319743 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1090,24 +1090,6 @@ set_font_authorizations(char **authorizations, int *authlen, void *client)
}
void *
-Xalloc(unsigned long amount)
-{
- /*
- * Xalloc used to return NULL when large amount of memory is requested. In
- * order to catch the buggy callers this warning has been added, slated to
- * removal by anyone who touches this code (or just looks at it) in 2011.
- *
- * -- Mikhail Gusarov
- */
- if ((long) amount <= 0)
- ErrorF("Warning: Xalloc: "
- "requesting unpleasantly large amount of memory: %lu bytes.\n",
- amount);
-
- return malloc(amount);
-}
-
-void *
XNFalloc(unsigned long amount)
{
void *ptr = malloc(amount);
@@ -1118,12 +1100,6 @@ XNFalloc(unsigned long amount)
}
void *
-Xcalloc(unsigned long amount)
-{
- return calloc(1, amount);
-}
-
-void *
XNFcalloc(unsigned long amount)
{
void *ret = calloc(1, amount);
@@ -1134,24 +1110,6 @@ XNFcalloc(unsigned long amount)
}
void *
-Xrealloc(void *ptr, unsigned long amount)
-{
- /*
- * Xrealloc used to return NULL when large amount of memory is requested. In
- * order to catch the buggy callers this warning has been added, slated to
- * removal by anyone who touches this code (or just looks at it) in 2011.
- *
- * -- Mikhail Gusarov
- */
- if ((long) amount <= 0)
- ErrorF("Warning: Xrealloc: "
- "requesting unpleasantly large amount of memory: %lu bytes.\n",
- amount);
-
- return realloc(ptr, amount);
-}
-
-void *
XNFrealloc(void *ptr, unsigned long amount)
{
void *ret = realloc(ptr, amount);
@@ -1161,12 +1119,6 @@ XNFrealloc(void *ptr, unsigned long amount)
return ret;
}
-void
-Xfree(void *ptr)
-{
- free(ptr);
-}
-
char *
Xstrdup(const char *s)
{
--
1.9.3
More information about the xorg-devel
mailing list