X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/729e4ab9bc6618bc3d8a898e575df7f4019e29ca..HEAD:/icuSources/common/unicode/uclean.h diff --git a/icuSources/common/unicode/uclean.h b/icuSources/common/unicode/uclean.h index de6d7363..7cef6dba 100644 --- a/icuSources/common/unicode/uclean.h +++ b/icuSources/common/unicode/uclean.h @@ -1,12 +1,12 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** -* * -* Copyright (C) 2001-2009, International Business Machines * -* Corporation and others. All Rights Reserved. * -* * +* Copyright (C) 2001-2014, International Business Machines +* Corporation and others. All Rights Reserved. ****************************************************************************** * file name: uclean.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -52,6 +52,7 @@ U_STABLE void U_EXPORT2 u_init(UErrorCode *status); +#ifndef U_HIDE_SYSTEM_API /** * Clean up the system resources, such as allocated memory or open files, * used in all ICU libraries. This will free/delete all memory owned by the @@ -69,7 +70,7 @@ u_init(UErrorCode *status); * This has the effect of restoring ICU to its initial condition, before * any of these override functions were installed. Refer to * u_setMemoryFunctions(), u_setMutexFunctions and - * utrace_setFunctions(). If ICU is to be reinitialized after after + * utrace_setFunctions(). If ICU is to be reinitialized after * calling u_cleanup(), these runtime override functions will need to * be set up again if they are still required. *

@@ -100,32 +101,93 @@ u_init(UErrorCode *status); U_STABLE void U_EXPORT2 u_cleanup(void); +U_CDECL_BEGIN +/** + * Pointer type for a user supplied memory allocation function. + * @param context user supplied value, obtained from u_setMemoryFunctions(). + * @param size The number of bytes to be allocated + * @return Pointer to the newly allocated memory, or NULL if the allocation failed. + * @stable ICU 2.8 + * @system + */ +typedef void *U_CALLCONV UMemAllocFn(const void *context, size_t size); +/** + * Pointer type for a user supplied memory re-allocation function. + * @param context user supplied value, obtained from u_setMemoryFunctions(). + * @param size The number of bytes to be allocated + * @return Pointer to the newly allocated memory, or NULL if the allocation failed. + * @stable ICU 2.8 + * @system + */ +typedef void *U_CALLCONV UMemReallocFn(const void *context, void *mem, size_t size); +/** + * Pointer type for a user supplied memory free function. Behavior should be + * similar the standard C library free(). + * @param context user supplied value, obtained from u_setMemoryFunctions(). + * @param mem Pointer to the memory block to be resized + * @param size The new size for the block + * @return Pointer to the resized memory block, or NULL if the resizing failed. + * @stable ICU 2.8 + * @system + */ +typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem); +/** + * Set the functions that ICU will use for memory allocation. + * Use of this function is optional; by default (without this function), ICU will + * use the standard C library malloc() and free() functions. + * This function can only be used when ICU is in an initial, unused state, before + * u_init() has been called. + * @param context This pointer value will be saved, and then (later) passed as + * a parameter to the memory functions each time they + * are called. + * @param a Pointer to a user-supplied malloc function. + * @param r Pointer to a user-supplied realloc function. + * @param f Pointer to a user-supplied free function. + * @param status Receives error values. + * @stable ICU 2.8 + * @system + */ +U_STABLE void U_EXPORT2 +u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f, + UErrorCode *status); +U_CDECL_END + +#ifndef U_HIDE_DEPRECATED_API +/********************************************************************************* + * + * Deprecated Functions + * + * The following functions for user supplied mutexes are no longer supported. + * Any attempt to use them will return a U_UNSUPPORTED_ERROR. + * + **********************************************************************************/ /** * An opaque pointer type that represents an ICU mutex. * For user-implemented mutexes, the value will typically point to a * struct or object that implements the mutex. - * @stable ICU 2.8 + * @deprecated ICU 52. This type is no longer supported. * @system */ typedef void *UMTX; +U_CDECL_BEGIN /** * Function Pointer type for a user supplied mutex initialization function. * The user-supplied function will be called by ICU whenever ICU needs to create a * new mutex. The function implementation should create a mutex, and store a pointer * to something that uniquely identifies the mutex into the UMTX that is supplied - * as a paramter. - * @param context user supplied value, obtained from from u_setMutexFunctions(). + * as a parameter. + * @param context user supplied value, obtained from u_setMutexFunctions(). * @param mutex Receives a pointer that identifies the new mutex. * The mutex init function must set the UMTX to a non-null value. * Subsequent calls by ICU to lock, unlock, or destroy a mutex will * identify the mutex by the UMTX value. * @param status Error status. Report errors back to ICU by setting this variable * with an error code. - * @stable ICU 2.8 + * @deprecated ICU 52. This function is no longer supported. * @system */ typedef void U_CALLCONV UMtxInitFn (const void *context, UMTX *mutex, UErrorCode* status); @@ -135,13 +197,13 @@ typedef void U_CALLCONV UMtxInitFn (const void *context, UMTX *mutex, UErrorCod * Function Pointer type for a user supplied mutex functions. * One of the user-supplied functions with this signature will be called by ICU * whenever ICU needs to lock, unlock, or destroy a mutex. - * @param context user supplied value, obtained from from u_setMutexFunctions(). + * @param context user supplied value, obtained from u_setMutexFunctions(). * @param mutex specify the mutex on which to operate. - * @stable ICU 2.8 + * @deprecated ICU 52. This function is no longer supported. * @system */ typedef void U_CALLCONV UMtxFn (const void *context, UMTX *mutex); - +U_CDECL_END /** * Set the functions that ICU will use for mutex operations @@ -149,8 +211,6 @@ typedef void U_CALLCONV UMtxFn (const void *context, UMTX *mutex); * directly access system functions for mutex operations * This function can only be used when ICU is in an initial, unused state, before * u_init() has been called. - * This function may be used even when ICU has been built without multi-threaded - * support (see ICU_USE_THREADS pre-processor variable, umutex.h) * @param context This pointer value will be saved, and then (later) passed as * a parameter to the user-supplied mutex functions each time they * are called. @@ -159,20 +219,20 @@ typedef void U_CALLCONV UMtxFn (const void *context, UMTX *mutex); * @param lock pointer to the mutex lock function. Must be non-null. * @param unlock Pointer to the mutex unlock function. Must be non-null. * @param status Receives error values. - * @stable ICU 2.8 + * @deprecated ICU 52. This function is no longer supported. * @system */ -U_STABLE void U_EXPORT2 +U_DEPRECATED void U_EXPORT2 u_setMutexFunctions(const void *context, UMtxInitFn *init, UMtxFn *destroy, UMtxFn *lock, UMtxFn *unlock, UErrorCode *status); /** * Pointer type for a user supplied atomic increment or decrement function. - * @param context user supplied value, obtained from from u_setAtomicIncDecFunctions(). + * @param context user supplied value, obtained from u_setAtomicIncDecFunctions(). * @param p Pointer to a 32 bit int to be incremented or decremented * @return The value of the variable after the inc or dec operation. - * @stable ICU 2.8 + * @deprecated ICU 52. This function is no longer supported. * @system */ typedef int32_t U_CALLCONV UMtxAtomicFn(const void *context, int32_t *p); @@ -189,63 +249,14 @@ typedef int32_t U_CALLCONV UMtxAtomicFn(const void *context, int32_t *p); * @param inc Pointer to a function to do an atomic increment operation. Must be non-null. * @param dec Pointer to a function to do an atomic decrement operation. Must be non-null. * @param status Receives error values. - * @stable ICU 2.8 + * @deprecated ICU 52. This function is no longer supported. * @system */ -U_STABLE void U_EXPORT2 +U_DEPRECATED void U_EXPORT2 u_setAtomicIncDecFunctions(const void *context, UMtxAtomicFn *inc, UMtxAtomicFn *dec, UErrorCode *status); - - -/** - * Pointer type for a user supplied memory allocation function. - * @param context user supplied value, obtained from from u_setMemoryFunctions(). - * @param size The number of bytes to be allocated - * @return Pointer to the newly allocated memory, or NULL if the allocation failed. - * @stable ICU 2.8 - * @system - */ -typedef void *U_CALLCONV UMemAllocFn(const void *context, size_t size); -/** - * Pointer type for a user supplied memory re-allocation function. - * @param context user supplied value, obtained from from u_setMemoryFunctions(). - * @param size The number of bytes to be allocated - * @return Pointer to the newly allocated memory, or NULL if the allocation failed. - * @stable ICU 2.8 - * @system - */ -typedef void *U_CALLCONV UMemReallocFn(const void *context, void *mem, size_t size); -/** - * Pointer type for a user supplied memory free function. Behavior should be - * similar the standard C library free(). - * @param context user supplied value, obtained from from u_setMemoryFunctions(). - * @param mem Pointer to the memory block to be resized - * @param size The new size for the block - * @return Pointer to the resized memory block, or NULL if the resizing failed. - * @stable ICU 2.8 - * @system - */ -typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem); - -/** - * Set the functions that ICU will use for memory allocation. - * Use of this function is optional; by default (without this function), ICU will - * use the standard C library malloc() and free() functions. - * This function can only be used when ICU is in an initial, unused state, before - * u_init() has been called. - * @param context This pointer value will be saved, and then (later) passed as - * a parameter to the memory functions each time they - * are called. - * @param a Pointer to a user-supplied malloc function. - * @param r Pointer to a user-supplied realloc function. - * @param f Pointer to a user-supplied free function. - * @param status Receives error values. - * @stable ICU 2.8 - * @system - */ -U_STABLE void U_EXPORT2 -u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMemFreeFn *f, - UErrorCode *status); +#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_SYSTEM_API */ #endif