1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ******************************************************************************
5 *
6 * Copyright (C) 1997-2016, International Business Machines
7 * Corporation and others. All Rights Reserved.
8 *
9 ******************************************************************************
10 *
11 * FILE NAME : putilimp.h
12 *
13 * Date Name Description
14 * 10/17/04 grhoten Move internal functions from putil.h to this file.
15 ******************************************************************************
16 */
17
18 #ifndef PUTILIMP_H
19 #define PUTILIMP_H
20
21 #include "unicode/utypes.h"
22 #include "unicode/putil.h"
23
24 /**
25 * \def U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC
26 * Nearly all CPUs and compilers implement a right-shift of a signed integer
27 * as an Arithmetic Shift Right which copies the sign bit (the Most Significant Bit (MSB))
28 * into the vacated bits (sign extension).
29 * For example, (int32_t)0xfff5fff3>>4 becomes 0xffff5fff and -1>>1=-1.
30 *
31 * This can be useful for storing a signed value in the upper bits
32 * and another bit field in the lower bits.
33 * The signed value can be retrieved by simple right-shifting.
34 *
35 * This is consistent with the Java language.
36 *
37 * However, the C standard allows compilers to implement a right-shift of a signed integer
38 * as a Logical Shift Right which copies a 0 into the vacated bits.
39 * For example, (int32_t)0xfff5fff3>>4 becomes 0x0fff5fff and -1>>1=0x7fffffff.
40 *
41 * Code that depends on the natural behavior should be guarded with this macro,
42 * with an alternate path for unusual platforms.
43 * @internal
44 */
45 #ifdef U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC
46 /* Use the predefined value. */
47 #else
48 /*
49 * Nearly all CPUs & compilers implement a right-shift of a signed integer
50 * as an Arithmetic Shift Right (with sign extension).
51 */
52 # define U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC 1
53 #endif
54
55 /** Define this to 1 if your platform supports IEEE 754 floating point,
56 to 0 if it does not. */
57 #ifndef IEEE_754
58 # define IEEE_754 1
59 #endif
60
61 /**
62 * uintptr_t is an optional part of the standard definitions in stdint.h.
63 * The opengroup.org documentation for stdint.h says
64 * "On XSI-conformant systems, the intptr_t and uintptr_t types are required;
65 * otherwise, they are optional."
66 * We assume that when uintptr_t is defined, UINTPTR_MAX is defined as well.
67 *
68 * Do not use ptrdiff_t since it is signed. size_t is unsigned.
69 */
70 /* TODO: This check fails on some z environments. Filed a ticket #9357 for this. */
71 #if !defined(__intptr_t_defined) && !defined(UINTPTR_MAX) && (U_PLATFORM != U_PF_OS390)
72 typedef size_t uintptr_t;
73 #endif
74
75 /*===========================================================================*/
76 /** @{ Information about POSIX support */
77 /*===========================================================================*/
78
79 #ifdef U_HAVE_NL_LANGINFO_CODESET
80 /* Use the predefined value. */
81 #elif U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_ANDROID || U_PLATFORM == U_PF_QNX
82 # define U_HAVE_NL_LANGINFO_CODESET 0
83 #else
84 # define U_HAVE_NL_LANGINFO_CODESET 1
85 #endif
86
87 #ifdef U_NL_LANGINFO_CODESET
88 /* Use the predefined value. */
89 #elif !U_HAVE_NL_LANGINFO_CODESET
90 # define U_NL_LANGINFO_CODESET -1
91 #elif U_PLATFORM == U_PF_OS400
92 /* not defined */
93 #else
94 # define U_NL_LANGINFO_CODESET CODESET
95 #endif
96
97 #if defined(U_TZSET) || defined(U_HAVE_TZSET)
98 /* Use the predefined value. */
99 #elif U_PLATFORM_USES_ONLY_WIN32_API
100 // UWP doesn't support tzset or environment variables for tz
101 #if U_PLATFORM_HAS_WINUWP_API == 0
102 # define U_TZSET _tzset
103 #endif
104 #elif U_PLATFORM == U_PF_OS400
105 /* not defined */
106 #else
107 # define U_TZSET tzset
108 #endif
109
110 #if defined(U_TIMEZONE) || defined(U_HAVE_TIMEZONE)
111 /* Use the predefined value. */
112 #elif U_PLATFORM == U_PF_ANDROID
113 # define U_TIMEZONE timezone
114 #elif defined(__UCLIBC__)
115 // uClibc does not have __timezone or _timezone.
116 #elif defined(_NEWLIB_VERSION)
117 # define U_TIMEZONE _timezone
118 #elif defined(__GLIBC__)
119 // glibc
120 # define U_TIMEZONE __timezone
121 #elif U_PLATFORM_IS_LINUX_BASED
122 // not defined
123 #elif U_PLATFORM_USES_ONLY_WIN32_API
124 # define U_TIMEZONE _timezone
125 #elif U_PLATFORM == U_PF_BSD && !defined(__NetBSD__)
126 /* not defined */
127 #elif U_PLATFORM == U_PF_OS400
128 /* not defined */
129 #elif U_PLATFORM == U_PF_IPHONE
130 /* not defined */
131 #else
132 # define U_TIMEZONE timezone
133 #endif
134
135 #if defined(U_TZNAME) || defined(U_HAVE_TZNAME)
136 /* Use the predefined value. */
137 #elif U_PLATFORM_USES_ONLY_WIN32_API
138 /* not usable on all windows platforms */
139 #if U_PLATFORM_HAS_WINUWP_API == 0
140 # define U_TZNAME _tzname
141 #endif
142 #elif U_PLATFORM == U_PF_OS400
143 /* not defined */
144 #else
145 # define U_TZNAME tzname
146 #endif
147
148 #ifdef U_HAVE_MMAP
149 /* Use the predefined value. */
150 #elif U_PLATFORM_USES_ONLY_WIN32_API
151 # define U_HAVE_MMAP 0
152 #else
153 # define U_HAVE_MMAP 1
154 #endif
155
156 #ifdef U_HAVE_POPEN
157 /* Use the predefined value. */
158 #elif U_PLATFORM_USES_ONLY_WIN32_API
159 # define U_HAVE_POPEN 0
160 #elif U_PLATFORM == U_PF_OS400
161 # define U_HAVE_POPEN 0
162 #else
163 # define U_HAVE_POPEN 1
164 #endif
165
166 /**
167 * \def U_HAVE_DIRENT_H
168 * Defines whether dirent.h is available.
169 * @internal
170 */
171 #ifdef U_HAVE_DIRENT_H
172 /* Use the predefined value. */
173 #elif U_PLATFORM_USES_ONLY_WIN32_API
174 # define U_HAVE_DIRENT_H 0
175 #else
176 # define U_HAVE_DIRENT_H 1
177 #endif
178
179 /** @} */
180
181 /*===========================================================================*/
182 /** @{ GCC built in functions for atomic memory operations */
183 /*===========================================================================*/
184
185 /**
186 * \def U_HAVE_GCC_ATOMICS
187 * @internal
188 */
189 #ifdef U_HAVE_GCC_ATOMICS
190 /* Use the predefined value. */
191 #elif U_PLATFORM == U_PF_MINGW
192 #define U_HAVE_GCC_ATOMICS 0
193 #elif U_GCC_MAJOR_MINOR >= 404 || defined(__clang__)
194 /* TODO: Intel icc and IBM xlc on AIX also support gcc atomics. (Intel originated them.)
195 * Add them for these compilers.
196 * Note: Clang sets __GNUC__ defines for version 4.2, so misses the 4.4 test here.
197 */
198 # define U_HAVE_GCC_ATOMICS 1
199 #else
200 # define U_HAVE_GCC_ATOMICS 0
201 #endif
202
203 /** @} */
204
205 /**
206 * \def U_HAVE_STD_ATOMICS
207 * Defines whether to use the standard C++11 <atomic> functions
208 * If false, ICU will fall back to compiler or platform specific alternatives.
209 * Note: support for these fall back options for atomics will be removed in a future version
210 * of ICU, and the use of C++ 11 atomics will be required.
211 * @internal
212 */
213 #ifdef U_HAVE_STD_ATOMICS
214 /* Use the predefined value. */
215 #else
216 # define U_HAVE_STD_ATOMICS 1
217 #endif
218
219 /**
220 * \def U_HAVE_CLANG_ATOMICS
221 * Defines whether Clang c11 style built-in atomics are available.
222 * These are used in preference to gcc atomics when both are available.
223 */
224 #ifdef U_HAVE_CLANG_ATOMICS
225 /* Use the predefined value. */
226 #elif __has_builtin(__c11_atomic_load) && \
227 __has_builtin(__c11_atomic_store) && \
228 __has_builtin(__c11_atomic_fetch_add) && \
229 __has_builtin(__c11_atomic_fetch_sub)
230 # define U_HAVE_CLANG_ATOMICS 1
231 #else
232 # define U_HAVE_CLANG_ATOMICS 0
233 #endif
234
235 /*===========================================================================*/
236 /** @{ Programs used by ICU code */
237 /*===========================================================================*/
238
239 /**
240 * \def U_MAKE_IS_NMAKE
241 * Defines whether the "make" program is Windows nmake.
242 */
243 #ifdef U_MAKE_IS_NMAKE
244 /* Use the predefined value. */
245 #elif U_PLATFORM == U_PF_WINDOWS
246 # define U_MAKE_IS_NMAKE 1
247 #else
248 # define U_MAKE_IS_NMAKE 0
249 #endif
250
251 /** @} */
252
253 /*==========================================================================*/
254 /* Platform utilities */
255 /*==========================================================================*/
256
257 /**
258 * Platform utilities isolates the platform dependencies of the
259 * library. For each platform which this code is ported to, these
260 * functions may have to be re-implemented.
261 */
262
263 /**
264 * Floating point utility to determine if a double is Not a Number (NaN).
265 * @internal
266 */
267 U_INTERNAL UBool U_EXPORT2 uprv_isNaN(double d);
268 /**
269 * Floating point utility to determine if a double has an infinite value.
270 * @internal
271 */
272 U_INTERNAL UBool U_EXPORT2 uprv_isInfinite(double d);
273 /**
274 * Floating point utility to determine if a double has a positive infinite value.
275 * @internal
276 */
277 U_INTERNAL UBool U_EXPORT2 uprv_isPositiveInfinity(double d);
278 /**
279 * Floating point utility to determine if a double has a negative infinite value.
280 * @internal
281 */
282 U_INTERNAL UBool U_EXPORT2 uprv_isNegativeInfinity(double d);
283 /**
284 * Floating point utility that returns a Not a Number (NaN) value.
285 * @internal
286 */
287 U_INTERNAL double U_EXPORT2 uprv_getNaN(void);
288 /**
289 * Floating point utility that returns an infinite value.
290 * @internal
291 */
292 U_INTERNAL double U_EXPORT2 uprv_getInfinity(void);
293
294 /**
295 * Floating point utility to truncate a double.
296 * @internal
297 */
298 U_INTERNAL double U_EXPORT2 uprv_trunc(double d);
299 /**
300 * Floating point utility to calculate the floor of a double.
301 * @internal
302 */
303 U_INTERNAL double U_EXPORT2 uprv_floor(double d);
304 /**
305 * Floating point utility to calculate the ceiling of a double.
306 * @internal
307 */
308 U_INTERNAL double U_EXPORT2 uprv_ceil(double d);
309 /**
310 * Floating point utility to calculate the absolute value of a double.
311 * @internal
312 */
313 U_INTERNAL double U_EXPORT2 uprv_fabs(double d);
314 /**
315 * Floating point utility to calculate the fractional and integer parts of a double.
316 * @internal
317 */
318 U_INTERNAL double U_EXPORT2 uprv_modf(double d, double* pinteger);
319 /**
320 * Floating point utility to calculate the remainder of a double divided by another double.
321 * @internal
322 */
323 U_INTERNAL double U_EXPORT2 uprv_fmod(double d, double y);
324 /**
325 * Floating point utility to calculate d to the power of exponent (d^exponent).
326 * @internal
327 */
328 U_INTERNAL double U_EXPORT2 uprv_pow(double d, double exponent);
329 /**
330 * Floating point utility to calculate 10 to the power of exponent (10^exponent).
331 * @internal
332 */
333 U_INTERNAL double U_EXPORT2 uprv_pow10(int32_t exponent);
334 /**
335 * Floating point utility to calculate the maximum value of two doubles.
336 * @internal
337 */
338 U_INTERNAL double U_EXPORT2 uprv_fmax(double d, double y);
339 /**
340 * Floating point utility to calculate the minimum value of two doubles.
341 * @internal
342 */
343 U_INTERNAL double U_EXPORT2 uprv_fmin(double d, double y);
344 /**
345 * Private utility to calculate the maximum value of two integers.
346 * @internal
347 */
348 U_INTERNAL int32_t U_EXPORT2 uprv_max(int32_t d, int32_t y);
349 /**
350 * Private utility to calculate the minimum value of two integers.
351 * @internal
352 */
353 U_INTERNAL int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y);
354
355 #if U_IS_BIG_ENDIAN
356 # define uprv_isNegative(number) (*((signed char *)&(number))<0)
357 #else
358 # define uprv_isNegative(number) (*((signed char *)&(number)+sizeof(number)-1)<0)
359 #endif
360
361 /**
362 * Return the largest positive number that can be represented by an integer
363 * type of arbitrary bit length.
364 * @internal
365 */
366 U_INTERNAL double U_EXPORT2 uprv_maxMantissa(void);
367
368 /**
369 * Floating point utility to calculate the logarithm of a double.
370 * @internal
371 */
372 U_INTERNAL double U_EXPORT2 uprv_log(double d);
373
374 /**
375 * Does common notion of rounding e.g. uprv_floor(x + 0.5);
376 * @param x the double number
377 * @return the rounded double
378 * @internal
379 */
380 U_INTERNAL double U_EXPORT2 uprv_round(double x);
381
382 /**
383 * Adds the signed integers a and b, storing the result in res.
384 * Checks for signed integer overflow.
385 * Similar to the GCC/Clang extension __builtin_add_overflow
386 *
387 * @param a The first operand.
388 * @param b The second operand.
389 * @param res a + b
390 * @return true if overflow occurred; false if no overflow occurred.
391 * @internal
392 */
393 U_INTERNAL UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* res);
394
395 /**
396 * Multiplies the signed integers a and b, storing the result in res.
397 * Checks for signed integer overflow.
398 * Similar to the GCC/Clang extension __builtin_mul_overflow
399 *
400 * @param a The first multiplicand.
401 * @param b The second multiplicand.
402 * @param res a * b
403 * @return true if overflow occurred; false if no overflow occurred.
404 * @internal
405 */
406 U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res);
407
408 #if 0
409 /**
410 * Returns the number of digits after the decimal point in a double number x.
411 *
412 * @param x the double number
413 * @return the number of digits after the decimal point in a double number x.
414 * @internal
415 */
416 /*U_INTERNAL int32_t U_EXPORT2 uprv_digitsAfterDecimal(double x);*/
417 #endif
418
419 #if !U_CHARSET_IS_UTF8
420 /**
421 * Please use ucnv_getDefaultName() instead.
422 * Return the default codepage for this platform and locale.
423 * This function can call setlocale() on Unix platforms. Please read the
424 * platform documentation on setlocale() before calling this function.
425 * @return the default codepage for this platform
426 * @internal
427 */
428 U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
429 #endif
430
431 /**
432 * Please use uloc_getDefault() instead.
433 * Return the default locale ID string by querying the system, or
434 * zero if one cannot be found.
435 * This function can call setlocale() on Unix platforms. Please read the
436 * platform documentation on setlocale() before calling this function.
437 * @return the default locale ID string
438 * @internal
439 */
440 U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void);
441
442 /**
443 * Time zone utilities
444 *
445 * Wrappers for C runtime library functions relating to timezones.
446 * The t_tzset() function (similar to tzset) uses the current setting
447 * of the environment variable TZ to assign values to three global
448 * variables: daylight, timezone, and tzname. These variables have the
449 * following meanings, and are declared in <time.h>.
450 *
451 * daylight Nonzero if daylight-saving-time zone (DST) is specified
452 * in TZ; otherwise, 0. Default value is 1.
453 * timezone Difference in seconds between coordinated universal
454 * time and local time. E.g., -28,800 for PST (GMT-8hrs)
455 * tzname(0) Three-letter time-zone name derived from TZ environment
456 * variable. E.g., "PST".
457 * tzname(1) Three-letter DST zone name derived from TZ environment
458 * variable. E.g., "PDT". If DST zone is omitted from TZ,
459 * tzname(1) is an empty string.
460 *
461 * Notes: For example, to set the TZ environment variable to correspond
462 * to the current time zone in Germany, you can use one of the
463 * following statements:
464 *
465 * set TZ=GST1GDT
466 * set TZ=GST+1GDT
467 *
468 * If the TZ value is not set, t_tzset() attempts to use the time zone
469 * information specified by the operating system. Under Windows NT
470 * and Windows 95, this information is specified in the Control Panel's
471 * Date/Time application.
472 * @internal
473 */
474 U_INTERNAL void U_EXPORT2 uprv_tzset(void);
475
476 /**
477 * Difference in seconds between coordinated universal
478 * time and local time. E.g., -28,800 for PST (GMT-8hrs)
479 * @return the difference in seconds between coordinated universal time and local time.
480 * @internal
481 */
482 U_INTERNAL int32_t U_EXPORT2 uprv_timezone(void);
483
484 /**
485 * tzname(0) Three-letter time-zone name derived from TZ environment
486 * variable. E.g., "PST".
487 * tzname(1) Three-letter DST zone name derived from TZ environment
488 * variable. E.g., "PDT". If DST zone is omitted from TZ,
489 * tzname(1) is an empty string.
490 * @internal
491 */
492 U_INTERNAL const char* U_EXPORT2 uprv_tzname(int n);
493
494 /**
495 * Reset the global tzname cache.
496 * @internal
497 */
498 U_INTERNAL void uprv_tzname_clear_cache();
499
500 /**
501 * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
502 * This function is affected by 'faketime' and should be the bottleneck for all user-visible ICU time functions.
503 * @return the UTC time measured in milliseconds
504 * @internal
505 */
506 U_INTERNAL UDate U_EXPORT2 uprv_getUTCtime(void);
507
508 /**
509 * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
510 * This function is not affected by 'faketime', so it should only be used by low level test functions- not by anything that
511 * exposes time to the end user.
512 * @return the UTC time measured in milliseconds
513 * @internal
514 */
515 U_INTERNAL UDate U_EXPORT2 uprv_getRawUTCtime(void);
516
517 /**
518 * Determine whether a pathname is absolute or not, as defined by the platform.
519 * @param path Pathname to test
520 * @return TRUE if the path is absolute
521 * @internal (ICU 3.0)
522 */
523 U_INTERNAL UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path);
524
525 /**
526 * Use U_MAX_PTR instead of this function.
527 * @param void pointer to test
528 * @return the largest possible pointer greater than the base
529 * @internal (ICU 3.8)
530 */
531 U_INTERNAL void * U_EXPORT2 uprv_maximumPtr(void *base);
532
533 /**
534 * Maximum value of a (void*) - use to indicate the limit of an 'infinite' buffer.
535 * In fact, buffer sizes must not exceed 2GB so that the difference between
536 * the buffer limit and the buffer start can be expressed in an int32_t.
537 *
538 * The definition of U_MAX_PTR must fulfill the following conditions:
539 * - return the largest possible pointer greater than base
540 * - return a valid pointer according to the machine architecture (AS/400, 64-bit, etc.)
541 * - avoid wrapping around at high addresses
542 * - make sure that the returned pointer is not farther from base than 0x7fffffff bytes
543 *
544 * @param base The beginning of a buffer to find the maximum offset from
545 * @internal
546 */
547 #ifndef U_MAX_PTR
548 # if U_PLATFORM == U_PF_OS390 && !defined(_LP64)
549 /* We have 31-bit pointers. */
550 # define U_MAX_PTR(base) ((void *)0x7fffffff)
551 # elif U_PLATFORM == U_PF_OS400
552 # define U_MAX_PTR(base) uprv_maximumPtr((void *)base)
553 # elif 0
554 /*
555 * For platforms where pointers are scalar values (which is normal, but unlike i5/OS)
556 * but that do not define uintptr_t.
557 *
558 * However, this does not work on modern compilers:
559 * The C++ standard does not define pointer overflow, and allows compilers to
560 * assume that p+u>p for any pointer p and any integer u>0.
561 * Thus, modern compilers optimize away the ">" comparison.
562 * (See ICU tickets #7187 and #8096.)
563 */
564 # define U_MAX_PTR(base) \
565 ((void *)(((char *)(base)+0x7fffffffu) > (char *)(base) \
566 ? ((char *)(base)+0x7fffffffu) \
567 : (char *)-1))
568 # else
569 /* Default version. C++ standard compliant for scalar pointers. */
570 # define U_MAX_PTR(base) \
571 ((void *)(((uintptr_t)(base)+0x7fffffffu) > (uintptr_t)(base) \
572 ? ((uintptr_t)(base)+0x7fffffffu) \
573 : (uintptr_t)-1))
574 # endif
575 #endif
576
577
578 #ifdef __cplusplus
579 /**
580 * Pin a buffer capacity such that doing pointer arithmetic
581 * on the destination pointer and capacity cannot overflow.
582 *
583 * The pinned capacity must fulfill the following conditions (for positive capacities):
584 * - dest + capacity is a valid pointer according to the machine arcitecture (AS/400, 64-bit, etc.)
585 * - (dest + capacity) >= dest
586 * - The size (in bytes) of T[capacity] does not exceed 0x7fffffff
587 *
588 * @param dest the destination buffer pointer.
589 * @param capacity the requested buffer capacity, in units of type T.
590 * @return the pinned capacity.
591 * @internal
592 */
593 template <typename T>
pinCapacity(T * dest,int32_t capacity)594 inline int32_t pinCapacity(T *dest, int32_t capacity) {
595 if (capacity <= 0) { return capacity; }
596
597 uintptr_t destInt = (uintptr_t)dest;
598 uintptr_t maxInt;
599
600 # if U_PLATFORM == U_PF_OS390 && !defined(_LP64)
601 // We have 31-bit pointers.
602 maxInt = 0x7fffffff;
603 # elif U_PLATFORM == U_PF_OS400
604 maxInt = (uintptr_t)uprv_maximumPtr((void *)dest);
605 # else
606 maxInt = destInt + 0x7fffffffu;
607 if (maxInt < destInt) {
608 // Less than 2GB to the end of the address space.
609 // Pin to that to prevent address overflow.
610 maxInt = (uintptr_t)-1;
611 }
612 # endif
613
614 uintptr_t maxBytes = maxInt - destInt; // max. 2GB
615 int32_t maxCapacity = (int32_t)(maxBytes / sizeof(T));
616 return capacity <= maxCapacity ? capacity : maxCapacity;
617 }
618 #endif // __cplusplus
619
620 /* Dynamic Library Functions */
621
622 typedef void (UVoidFunction)(void);
623
624 #if U_ENABLE_DYLOAD
625 /**
626 * Load a library
627 * @internal (ICU 4.4)
628 */
629 U_INTERNAL void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status);
630
631 /**
632 * Close a library
633 * @internal (ICU 4.4)
634 */
635 U_INTERNAL void U_EXPORT2 uprv_dl_close( void *lib, UErrorCode *status);
636
637 /**
638 * Extract a symbol from a library (function)
639 * @internal (ICU 4.8)
640 */
641 U_INTERNAL UVoidFunction* U_EXPORT2 uprv_dlsym_func( void *lib, const char *symbolName, UErrorCode *status);
642
643 /**
644 * Extract a symbol from a library (function)
645 * Not implemented, no clients.
646 * @internal
647 */
648 /* U_INTERNAL void * U_EXPORT2 uprv_dlsym_data( void *lib, const char *symbolName, UErrorCode *status); */
649
650 #endif
651
652 /**
653 * Define malloc and related functions
654 * @internal
655 */
656 #if U_PLATFORM == U_PF_OS400
657 # define uprv_default_malloc(x) _C_TS_malloc(x)
658 # define uprv_default_realloc(x,y) _C_TS_realloc(x,y)
659 # define uprv_default_free(x) _C_TS_free(x)
660 /* also _C_TS_calloc(x) */
661 #else
662 /* C defaults */
663 # define uprv_default_malloc(x) malloc(x)
664 # define uprv_default_realloc(x,y) realloc(x,y)
665 # define uprv_default_free(x) free(x)
666 #endif
667
668
669 #endif
670