diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-05-07 18:59:29 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-05-07 18:59:29 +0200 |
commit | 588f56970840cef83792f77374a0c033d5f5a9fd (patch) | |
tree | 08c142bf7de8c2eed237466144c98e1e89906f9c | |
parent | 76a5b22625edfc46109064298682fb1ecdefb216 (diff) | |
download | xine-lib-588f56970840cef83792f77374a0c033d5f5a9fd.tar.gz xine-lib-588f56970840cef83792f77374a0c033d5f5a9fd.tar.bz2 |
Deprecate xine_xmalloc().
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/xine-utils/utils.c | 20 | ||||
-rw-r--r-- | src/xine-utils/xineutils.h | 2 |
3 files changed, 22 insertions, 2 deletions
@@ -7,6 +7,8 @@ xine-lib (1.1.12.1) 2008-??-?? in CVE-2008-1482, backport more calloc usage from 1.2 branch. * Added MIME types and .mpp for musepack. * Fixed display of some MJPEG streams (YUVJ420P). + * Deprecate xine_xmalloc() function, see src/xine-utils/utils.c for more + information about the reason. xine-lib (1.1.12) 2008-04-14 * Security fixes: diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index 48ceef688..4085d65ee 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -236,7 +236,25 @@ static const lang_locale_t lang_locales[] = { { NULL, NULL, NULL, NULL } }; - +/** + * @brief Allocate and clean memory size_t 'size', then return the + * pointer to the allocated memory. + * @param size Size of the memory area to allocate. + * + * @return A pointer to the allocated memory area, or NULL in case of + * error. + * + * The behaviour of this function differs from standard malloc() as + * xine_xmalloc(0) will not return a NULL pointer, but rather a + * pointer to a memory area of size 1 byte. + * + * The NULL value is only ever returned in case of an error in + * malloc(), and is reported to stderr stream. + * + * @deprecated This function has been deprecated, as the behaviour of + * allocating a 1 byte memory area on zero size is almost + * never desired, and the function is thus mostly misused. + */ void *xine_xmalloc(size_t size) { void *ptr; diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 2099bf7f3..89aff96bf 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -621,7 +621,7 @@ void xine_profiler_print_results (void) XINE_PROTECTED; * Allocate and clean memory size_t 'size', then return the pointer * to the allocated memory. */ -void *xine_xmalloc(size_t size) XINE_MALLOC XINE_PROTECTED; +void *xine_xmalloc(size_t size) XINE_MALLOC XINE_DEPRECATED XINE_PROTECTED; /* * Same as above, but memory is aligned to 'alignement'. |