ICU-5 need to use icu_malloc() etc.

replace stdlib function calls by icu_...

X-SVN-Rev: 17
This commit is contained in:
Markus Scherer 1999-10-06 00:05:42 +00:00
parent 1ccc7d153f
commit 80a098923f
10 changed files with 94 additions and 68 deletions

View file

@ -66,7 +66,7 @@ DEPS = $(OBJECTS:.o=.d)
HEADERS = utypes.h uloc.h ures.h ustring.h uchar.h chariter.h \
uchriter.h locid.h resbund.h unicode.h putil.h platform.h unistr.h \
schriter.h normlzr.h ucnv_err.h ucnv.h ucnv_bld.h convert.h \
ubidi.h bidi.h
ubidi.h bidi.h cmemory.h
## List of phony targets
.PHONY : all all-local install install-local clean clean-local \

View file

@ -267,7 +267,7 @@ SOURCE=.\bidi.h
InputPath=.\bidi.h
"..\..\include\bidi.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy bidi.h ..\..\include\
copy bidi.h ..\..\include\
# End Custom Build
@ -277,7 +277,7 @@ InputPath=.\bidi.h
InputPath=.\bidi.h
"..\..\include\bidi.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy bidi.h ..\..\include\
copy bidi.h ..\..\include\
# End Custom Build
@ -294,7 +294,7 @@ SOURCE=.\chariter.h
InputPath=.\chariter.h
"..\..\include\chariter.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy chariter.h ..\..\include\
copy chariter.h ..\..\include\
# End Custom Build
@ -304,7 +304,7 @@ InputPath=.\chariter.h
InputPath=.\chariter.h
"..\..\include\chariter.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy chariter.h ..\..\include\
copy chariter.h ..\..\include\
# End Custom Build
@ -314,6 +314,31 @@ InputPath=.\chariter.h
# Begin Source File
SOURCE=.\cmemory.h
!IF "$(CFG)" == "common - Win32 Release"
# Begin Custom Build
InputPath=.\cmemory.h
InputName=cmemory
"..\..\include\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputName).h ..\..\include\
# End Custom Build
!ELSEIF "$(CFG)" == "common - Win32 Debug"
# Begin Custom Build
InputPath=.\cmemory.h
InputName=cmemory
"..\..\include\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputName).h ..\..\include\
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
@ -333,7 +358,7 @@ SOURCE=.\convert.h
InputPath=.\convert.h
"..\..\include\convert.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy convert.h ..\..\include\
copy convert.h ..\..\include\
# End Custom Build
@ -343,7 +368,7 @@ InputPath=.\convert.h
InputPath=.\convert.h
"..\..\include\convert.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy convert.h ..\..\include\
copy convert.h ..\..\include\
# End Custom Build
@ -380,7 +405,7 @@ SOURCE=.\locid.h
InputPath=.\locid.h
"..\..\include\locid.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy locid.h ..\..\include\
copy locid.h ..\..\include\
# End Custom Build
@ -390,7 +415,7 @@ InputPath=.\locid.h
InputPath=.\locid.h
"..\..\include\locid.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy locid.h ..\..\include\
copy locid.h ..\..\include\
# End Custom Build
@ -415,7 +440,7 @@ SOURCE=.\normlzr.h
InputPath=.\normlzr.h
"..\..\include\normlzr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy normlzr.h ..\..\include\
copy normlzr.h ..\..\include\
# End Custom Build
@ -425,7 +450,7 @@ InputPath=.\normlzr.h
InputPath=.\normlzr.h
"..\..\include\normlzr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy normlzr.h ..\..\include\
copy normlzr.h ..\..\include\
# End Custom Build
@ -442,7 +467,7 @@ SOURCE=.\putil.h
InputPath=.\putil.h
"..\..\include\putil.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy putil.h ..\..\include\
copy putil.h ..\..\include\
# End Custom Build
@ -452,7 +477,7 @@ InputPath=.\putil.h
InputPath=.\putil.h
"..\..\include\putil.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy putil.h ..\..\include\
copy putil.h ..\..\include\
# End Custom Build
@ -469,7 +494,7 @@ SOURCE=.\pwin32.h
InputPath=.\pwin32.h
"..\..\include\pwin32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy pwin32.h ..\..\include\
copy pwin32.h ..\..\include\
# End Custom Build
@ -479,7 +504,7 @@ InputPath=.\pwin32.h
InputPath=.\pwin32.h
"..\..\include\pwin32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy pwin32.h ..\..\include\
copy pwin32.h ..\..\include\
# End Custom Build
@ -508,7 +533,7 @@ SOURCE=.\resbund.h
InputPath=.\resbund.h
"..\..\include\resbund.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy resbund.h ..\..\include\
copy resbund.h ..\..\include\
# End Custom Build
@ -518,7 +543,7 @@ InputPath=.\resbund.h
InputPath=.\resbund.h
"..\..\include\resbund.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy resbund.h ..\..\include\
copy resbund.h ..\..\include\
# End Custom Build
@ -535,7 +560,7 @@ SOURCE=.\schriter.h
InputPath=.\schriter.h
"..\..\include\schriter.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy schriter.h ..\..\include\
copy schriter.h ..\..\include\
# End Custom Build
@ -545,7 +570,7 @@ InputPath=.\schriter.h
InputPath=.\schriter.h
"..\..\include\schriter.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy schriter.h ..\..\include\
copy schriter.h ..\..\include\
# End Custom Build
@ -562,7 +587,7 @@ SOURCE=.\scsu.h
InputPath=.\scsu.h
"..\..\include\scsu.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy scsu.h ..\..\include\
copy scsu.h ..\..\include\
# End Custom Build
@ -572,7 +597,7 @@ InputPath=.\scsu.h
InputPath=.\scsu.h
"..\..\include\scsu.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy scsu.h ..\..\include\
copy scsu.h ..\..\include\
# End Custom Build
@ -589,7 +614,7 @@ SOURCE=.\ubidi.h
InputPath=.\ubidi.h
"..\..\include\ubidi.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy ubidi.h ..\..\include\
copy ubidi.h ..\..\include\
# End Custom Build
@ -599,7 +624,7 @@ InputPath=.\ubidi.h
InputPath=.\ubidi.h
"..\..\include\ubidi.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy ubidi.h ..\..\include\
copy ubidi.h ..\..\include\
# End Custom Build
@ -620,7 +645,7 @@ SOURCE=.\uchar.h
InputPath=.\uchar.h
"..\..\include\uchar.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy uchar.h ..\..\include\
copy uchar.h ..\..\include\
# End Custom Build
@ -630,7 +655,7 @@ InputPath=.\uchar.h
InputPath=.\uchar.h
"..\..\include\uchar.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy uchar.h ..\..\include\
copy uchar.h ..\..\include\
# End Custom Build
@ -647,7 +672,7 @@ SOURCE=.\uchriter.h
InputPath=.\uchriter.h
"..\..\include\uchriter.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy uchriter.h ..\..\include\
copy uchriter.h ..\..\include\
# End Custom Build
@ -657,7 +682,7 @@ InputPath=.\uchriter.h
InputPath=.\uchriter.h
"..\..\include\uchriter.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy uchriter.h ..\..\include\
copy uchriter.h ..\..\include\
# End Custom Build
@ -686,7 +711,7 @@ SOURCE=.\ucnv.h
InputPath=.\ucnv.h
"..\..\include\ucnv.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy ucnv.h ..\..\include\
copy ucnv.h ..\..\include\
# End Custom Build
@ -696,7 +721,7 @@ InputPath=.\ucnv.h
InputPath=.\ucnv.h
"..\..\include\ucnv.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy ucnv.h ..\..\include\
copy ucnv.h ..\..\include\
# End Custom Build
@ -713,7 +738,7 @@ SOURCE=.\ucnv_bld.h
InputPath=.\ucnv_bld.h
"..\..\include\ucnv_bld.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy ucnv_bld.h ..\..\include\
copy ucnv_bld.h ..\..\include\
# End Custom Build
@ -723,7 +748,7 @@ InputPath=.\ucnv_bld.h
InputPath=.\ucnv_bld.h
"..\..\include\ucnv_bld.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy ucnv_bld.h ..\..\include\
copy ucnv_bld.h ..\..\include\
# End Custom Build
@ -744,7 +769,7 @@ SOURCE=.\ucnv_err.h
InputPath=.\ucnv_err.h
"..\..\include\ucnv_err.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy ucnv_err.h ..\..\include\
copy ucnv_err.h ..\..\include\
# End Custom Build
@ -754,7 +779,7 @@ InputPath=.\ucnv_err.h
InputPath=.\ucnv_err.h
"..\..\include\ucnv_err.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy ucnv_err.h ..\..\include\
copy ucnv_err.h ..\..\include\
# End Custom Build
@ -779,7 +804,7 @@ SOURCE=.\uloc.h
InputPath=.\uloc.h
"..\..\include\uloc.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy uloc.h ..\..\include\
copy uloc.h ..\..\include\
# End Custom Build
@ -789,7 +814,7 @@ InputPath=.\uloc.h
InputPath=.\uloc.h
"..\..\include\uloc.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy uloc.h ..\..\include\
copy uloc.h ..\..\include\
# End Custom Build
@ -810,7 +835,7 @@ SOURCE=.\unicode.h
InputPath=.\unicode.h
"..\..\include\unicode.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy unicode.h ..\..\include\
copy unicode.h ..\..\include\
# End Custom Build
@ -820,7 +845,7 @@ InputPath=.\unicode.h
InputPath=.\unicode.h
"..\..\include\unicode.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy unicode.h ..\..\include\
copy unicode.h ..\..\include\
# End Custom Build
@ -837,7 +862,7 @@ SOURCE=.\unistr.h
InputPath=.\unistr.h
"..\..\include\unistr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy unistr.h ..\..\include\
copy unistr.h ..\..\include\
# End Custom Build
@ -847,7 +872,7 @@ InputPath=.\unistr.h
InputPath=.\unistr.h
"..\..\include\unistr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy unistr.h ..\..\include\
copy unistr.h ..\..\include\
# End Custom Build
@ -868,7 +893,7 @@ SOURCE=.\ures.h
InputPath=.\ures.h
"..\..\include\ures.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy ures.h ..\..\include\
copy ures.h ..\..\include\
# End Custom Build
@ -878,7 +903,7 @@ InputPath=.\ures.h
InputPath=.\ures.h
"..\..\include\ures.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy ures.h ..\..\include\
copy ures.h ..\..\include\
# End Custom Build
@ -895,7 +920,7 @@ SOURCE=.\ustring.h
InputPath=.\ustring.h
"..\..\include\ustring.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy ustring.h ..\..\include\
copy ustring.h ..\..\include\
# End Custom Build
@ -905,7 +930,7 @@ InputPath=.\ustring.h
InputPath=.\ustring.h
"..\..\include\ustring.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy ustring.h ..\..\include\
copy ustring.h ..\..\include\
# End Custom Build
@ -922,7 +947,7 @@ SOURCE=.\utypes.h
InputPath=.\utypes.h
"..\..\include\utypes.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy utypes.h ..\..\include\
copy utypes.h ..\..\include\
# End Custom Build
@ -932,7 +957,7 @@ InputPath=.\utypes.h
InputPath=.\utypes.h
"..\..\include\utypes.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy utypes.h ..\..\include\
copy utypes.h ..\..\include\
# End Custom Build

View file

@ -63,8 +63,8 @@ T_FileStream_wopen(const wchar_t* filename, const wchar_t* mode)
md[mdMbsSize] = 0;
result = fopen(fn, md);
free(fn);
free(md);
icu_free(fn);
icu_free(md);
return (FileStream*)result;
#endif
}

View file

@ -68,7 +68,7 @@ read_ustring(FileStream *rb,
/* Read the next chunk of data */
readLen = icu_min(BUF_SIZE, remain);
memset(buf, 0, readLen*sizeof(UChar));
icu_memset(buf, 0, readLen*sizeof(UChar));
T_FileStream_read(rb, buf, sizeof(UChar) * readLen);
/* Append the chunk to the string */

View file

@ -5233,7 +5233,7 @@ createDirTables()
const char* u_getVersion()
{
int32_t len=strlen(UNICODE_VERSION) + strlen("Unicode Version ");
_ucdVersion=(char*)realloc(_ucdVersion, sizeof(char) * len );
_ucdVersion=(char*)icu_realloc(_ucdVersion, len + 1 );
strcpy(_ucdVersion, "Unicode Version ");
strcat(_ucdVersion, UNICODE_VERSION);
return _ucdVersion;

View file

@ -187,7 +187,7 @@ uhash_putKey(UHashtable *hash,
void * result = hash->values[index];
if (result != value) /*Make sure the same object isn't scheduled for a double deletion*/
{
hash->toBeDeleted = (void**) realloc(hash->toBeDeleted, sizeof(void*)*(++(hash->toBeDeletedCount)));
hash->toBeDeleted = (void**) icu_realloc(hash->toBeDeleted, sizeof(void*)*(++(hash->toBeDeletedCount)));
hash->toBeDeleted[(hash->toBeDeletedCount)-1] = result;
}
hash->values[index] = 0;
@ -237,7 +237,7 @@ uhash_put(UHashtable *hash,
void* result = hash->values[index];
if (result != value) /*Make sure the same object isn't scheduled for a double deletion*/
{
hash->toBeDeleted = (void**) realloc(hash->toBeDeleted,
hash->toBeDeleted = (void**) icu_realloc(hash->toBeDeleted,
sizeof(void*)*(++(hash->toBeDeletedCount)));
hash->toBeDeleted[(hash->toBeDeletedCount)-1] = result;
}

View file

@ -138,12 +138,12 @@ if( mutex == NULL ) /* initialize the global mutex */
return;
#if defined( _WIN32 )
*mutex = malloc(sizeof(CRITICAL_SECTION));
*mutex = icu_malloc(sizeof(CRITICAL_SECTION));
InitializeCriticalSection((CRITICAL_SECTION*)*mutex);
#elif defined( POSIX )
*mutex = malloc(sizeof(pthread_mutex_t));
*mutex = icu_malloc(sizeof(pthread_mutex_t));
#if defined(HPUX)
pthread_mutex_init((pthread_mutex_t*)*mutex, pthread_mutexattr_default);

View file

@ -79,7 +79,11 @@ u_arrayCompare(const UChar *src, int32_t srcStart,
inline void
us_arrayCopy(const UChar *src, int32_t srcStart,
UChar *dst, int32_t dstStart, int32_t count)
{icu_memmove(dst+dstStart, src+srcStart, (size_t)(count*sizeof(*src)));}
{
if(count>0) {
icu_memmove(dst+dstStart, src+srcStart, (size_t)(count*sizeof(*src)));
}
}
// static initialization
const UChar UnicodeString::fgInvalidUChar = 0xFFFF;
@ -980,8 +984,6 @@ UnicodeString::pinIndices(UTextOffset& start,
if(length < 0 || start < 0)
start = length = 0;
else {
if(start < 0)
start = 0;
if(length > (fLength - start))
length = (fLength - start);
}

View file

@ -39,9 +39,8 @@
#include <memory.h>
#include <wchar.h>
#include <stdlib.h>
#include "cmemory.h"
/*===========================================================================*/
/* Include platform-dependent definitions */
@ -254,37 +253,37 @@ inline bool_t FAILURE(UErrorCode code) { return (bool_t)(code>ZERO_ERROR); }
#ifdef XP_CPLUSPLUS
inline void icu_arrayCopy(const double* src, double* dst, int32_t count)
{ memcpy(dst, src, (size_t)(count * sizeof(*src))); }
{ icu_memcpy(dst, src, (size_t)(count * sizeof(*src))); }
inline void icu_arrayCopy(const double* src, int32_t srcStart,
double* dst, int32_t dstStart, int32_t count)
{ memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
{ icu_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
inline void icu_arrayCopy(const int8_t* src, int8_t* dst, int32_t count)
{ memcpy(dst, src, (size_t)(count * sizeof(*src))); }
{ icu_memcpy(dst, src, (size_t)(count * sizeof(*src))); }
inline void icu_arrayCopy(const int8_t* src, int32_t srcStart,
int8_t* dst, int32_t dstStart, int32_t count)
{ memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
{ icu_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
inline void icu_arrayCopy(const int16_t* src, int16_t* dst, int32_t count)
{ memcpy(dst, src, (size_t)(count * sizeof(*src))); }
{ icu_memcpy(dst, src, (size_t)(count * sizeof(*src))); }
inline void icu_arrayCopy(const int16_t* src, int32_t srcStart,
int16_t* dst, int32_t dstStart, int32_t count)
{ memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
{ icu_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
inline void icu_arrayCopy(const int32_t* src, int32_t* dst, int32_t count)
{ memcpy(dst, src, (size_t)(count * sizeof(*src))); }
{ icu_memcpy(dst, src, (size_t)(count * sizeof(*src))); }
inline void icu_arrayCopy(const int32_t* src, int32_t srcStart,
int32_t* dst, int32_t dstStart, int32_t count)
{ memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
{ icu_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
inline void
icu_arrayCopy(const UChar *src, int32_t srcStart,
UChar *dst, int32_t dstStart, int32_t count)
{ memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
{ icu_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
#endif

View file

@ -242,7 +242,7 @@ testReordering(UBiDi *pBiDi, int testNumber) {
ubidi_invertMap(visualMap1, logicalMap2, length);
/* get them from the levels array, too */
memcpy(levels, ubidi_getLevels(pBiDi, &errorCode), length);
icu_memcpy(levels, ubidi_getLevels(pBiDi, &errorCode), length);
if(FAILURE(errorCode)) {
log_err("ubidi_getLevels(tests[%d]): error %s\n", testNumber, myErrorName(errorCode));
return;