diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml index cd1a9d07a..4c344194d 100644 --- a/doc/Xserver-spec.xml +++ b/doc/Xserver-spec.xml @@ -1217,11 +1217,9 @@ library is contained in dix/dixfonts.c
Memory Management -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. Treat memory allocation carefully in your implementation. Memory diff --git a/include/os.h b/include/os.h index 0cbb9288e..9982c9bb7 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 ed7581e1c..f3197430a 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1089,24 +1089,6 @@ set_font_authorizations(char **authorizations, int *authlen, void *client) #endif /* TCPCONN */ } -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) { @@ -1117,12 +1099,6 @@ XNFalloc(unsigned long amount) return ptr; } -void * -Xcalloc(unsigned long amount) -{ - return calloc(1, amount); -} - void * XNFcalloc(unsigned long amount) { @@ -1133,24 +1109,6 @@ XNFcalloc(unsigned long amount) return ret; } -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) { @@ -1161,12 +1119,6 @@ XNFrealloc(void *ptr, unsigned long amount) return ret; } -void -Xfree(void *ptr) -{ - free(ptr); -} - char * Xstrdup(const char *s) {