]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.10/Include/pymem.h
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / Include / pymem.h
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pymem.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pymem.h
deleted file mode 100644 (file)
index 27c72f1..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/* The PyMem_ family:  low-level memory allocation interfaces.\r
-   See objimpl.h for the PyObject_ memory family.\r
-*/\r
-\r
-#ifndef Py_PYMEM_H\r
-#define Py_PYMEM_H\r
-\r
-#include "pyport.h"\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-/* BEWARE:\r
-\r
-   Each interface exports both functions and macros.  Extension modules should\r
-   use the functions, to ensure binary compatibility across Python versions.\r
-   Because the Python implementation is free to change internal details, and\r
-   the macros may (or may not) expose details for speed, if you do use the\r
-   macros you must recompile your extensions with each Python release.\r
-\r
-   Never mix calls to PyMem_ with calls to the platform malloc/realloc/\r
-   calloc/free.  For example, on Windows different DLLs may end up using\r
-   different heaps, and if you use PyMem_Malloc you'll get the memory from the\r
-   heap used by the Python DLL; it could be a disaster if you free()'ed that\r
-   directly in your own extension.  Using PyMem_Free instead ensures Python\r
-   can return the memory to the proper heap.  As another example, in\r
-   PYMALLOC_DEBUG mode, Python wraps all calls to all PyMem_ and PyObject_\r
-   memory functions in special debugging wrappers that add additional\r
-   debugging info to dynamic memory blocks.  The system routines have no idea\r
-   what to do with that stuff, and the Python wrappers have no idea what to do\r
-   with raw blocks obtained directly by the system routines then.\r
-\r
-   The GIL must be held when using these APIs.\r
-*/\r
-\r
-/*\r
- * Raw memory interface\r
- * ====================\r
- */\r
-\r
-/* Functions\r
-\r
-   Functions supplying platform-independent semantics for malloc/realloc/\r
-   free.  These functions make sure that allocating 0 bytes returns a distinct\r
-   non-NULL pointer (whenever possible -- if we're flat out of memory, NULL\r
-   may be returned), even if the platform malloc and realloc don't.\r
-   Returned pointers must be checked for NULL explicitly.  No action is\r
-   performed on failure (no exception is set, no warning is printed, etc).\r
-*/\r
-\r
-PyAPI_FUNC(void *) PyMem_Malloc(size_t);\r
-PyAPI_FUNC(void *) PyMem_Realloc(void *, size_t);\r
-PyAPI_FUNC(void) PyMem_Free(void *);\r
-\r
-/* Starting from Python 1.6, the wrappers Py_{Malloc,Realloc,Free} are\r
-   no longer supported. They used to call PyErr_NoMemory() on failure. */\r
-\r
-/* Macros. */\r
-#ifdef PYMALLOC_DEBUG\r
-/* Redirect all memory operations to Python's debugging allocator. */\r
-#define PyMem_MALLOC           _PyMem_DebugMalloc\r
-#define PyMem_REALLOC          _PyMem_DebugRealloc\r
-#define PyMem_FREE             _PyMem_DebugFree\r
-\r
-#else  /* ! PYMALLOC_DEBUG */\r
-\r
-/* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL\r
-   for malloc(0), which would be treated as an error. Some platforms\r
-   would return a pointer with no memory behind it, which would break\r
-   pymalloc. To solve these problems, allocate an extra byte. */\r
-/* Returns NULL to indicate error if a negative size or size larger than\r
-   Py_ssize_t can represent is supplied.  Helps prevents security holes. */\r
-#define PyMem_MALLOC(n)                ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \\r
-                               : malloc((n) ? (n) : 1))\r
-#define PyMem_REALLOC(p, n)    ((size_t)(n) > (size_t)PY_SSIZE_T_MAX  ? NULL \\r
-                               : realloc((p), (n) ? (n) : 1))\r
-#define PyMem_FREE             free\r
-\r
-#endif /* PYMALLOC_DEBUG */\r
-\r
-/*\r
- * Type-oriented memory interface\r
- * ==============================\r
- *\r
- * Allocate memory for n objects of the given type.  Returns a new pointer\r
- * or NULL if the request was too large or memory allocation failed.  Use\r
- * these macros rather than doing the multiplication yourself so that proper\r
- * overflow checking is always done.\r
- */\r
-\r
-#define PyMem_New(type, n) \\r
-  ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL :     \\r
-       ( (type *) PyMem_Malloc((n) * sizeof(type)) ) )\r
-#define PyMem_NEW(type, n) \\r
-  ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL :     \\r
-       ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) )\r
-\r
-/*\r
- * The value of (p) is always clobbered by this macro regardless of success.\r
- * The caller MUST check if (p) is NULL afterwards and deal with the memory\r
- * error if so.  This means the original value of (p) MUST be saved for the\r
- * caller's memory error handler to not lose track of it.\r
- */\r
-#define PyMem_Resize(p, type, n) \\r
-  ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL :       \\r
-       (type *) PyMem_Realloc((p), (n) * sizeof(type)) )\r
-#define PyMem_RESIZE(p, type, n) \\r
-  ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL :       \\r
-       (type *) PyMem_REALLOC((p), (n) * sizeof(type)) )\r
-\r
-/* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used\r
- * anymore.  They're just confusing aliases for PyMem_{Free,FREE} now.\r
- */\r
-#define PyMem_Del              PyMem_Free\r
-#define PyMem_DEL              PyMem_FREE\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* !Py_PYMEM_H */\r