From e40074f3dbfcff312f8ce3c38babfb6f6798bd58 Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Wed, 24 May 2006 08:27:39 +0000 Subject: [PATCH] Tidied up git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22977 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 24 ++++++++++++++- Source/Additions/GSNextRuntime.m | 7 +++-- Source/Additions/GSXML.m | 8 ++--- Source/Additions/Unicode.m | 6 ++-- Source/NSBundle.m | 10 +++--- Source/NSCallBacks.m | 2 +- Source/NSConnection.m | 4 --- Source/NSException.m | 6 ++-- Source/NSFileManager.m | 4 +-- Source/NSPage.m | 11 +++---- Source/NSProcessInfo.m | 52 +++++++++++++++++--------------- Source/NSPropertyList.m | 15 ++++----- Source/NSSortDescriptor.m | 15 ++++----- Source/NSString.m | 2 +- Source/NSTimeZone.m | 4 +-- Source/callframe.m | 7 ++--- Source/cifframe.m | 15 ++++----- Source/mframe.m | 5 ++- Source/objc-load.m | 9 +++--- 19 files changed, 111 insertions(+), 95 deletions(-) diff --git a/ChangeLog b/ChangeLog index f2348630b..7e39186c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,26 @@ -2006-05-2 Richard Frith-Macdonald +2006-05-24 Richard Frith-Macdonald + + * Source/NSTimeZone.m: + * Source/NSBundle.m: + * Source/NSPropertyList.m: + * Source/NSProcessInfo.m: + * Source/NSPage.m: + * Source/NSCallBacks.m: + * Source/NSSortDescriptor.m: + * Source/NSFileManager.m: + * Source/objc-load.m: + * Source/NSException.m: + * Source/NSString.m: + * Source/mframe.m: + * Source/cifframe.m: + * Source/Additions/Unicode.m: + * Source/Additions/GSXML.m: + * Source/Additions/GSNextRuntime.m: + * Source/NSConnection.m: + * Source/callframe.m: + Tidy up uses of malloc etc to all go through objc_malloc and friends. + +2006-05-23 Richard Frith-Macdonald * Source/Additions/GSMime.m: Fix some cases where parse was saying it needed more data even though it had actually completed. diff --git a/Source/Additions/GSNextRuntime.m b/Source/Additions/GSNextRuntime.m index a8b70033b..6e9a47170 100644 --- a/Source/Additions/GSNextRuntime.m +++ b/Source/Additions/GSNextRuntime.m @@ -19,7 +19,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. */ #include "config.h" @@ -607,7 +608,7 @@ objc_mutex_t objc_mutex_allocate(void) { pthread_mutex_t *p; - p = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); + p = (pthread_mutex_t *)objc_calloc(1, sizeof(pthread_mutex_t)); if (pthread_mutex_init(p, NULL) != 0) { abort(); @@ -623,7 +624,7 @@ objc_mutex_deallocate(objc_mutex_t mutex) ret = pthread_mutex_destroy(p); if (ret == 0) { - free(p); + objc_free(p); } return ret; } diff --git a/Source/Additions/GSXML.m b/Source/Additions/GSXML.m index 529ac1cd9..42ad5e2ba 100644 --- a/Source/Additions/GSXML.m +++ b/Source/Additions/GSXML.m @@ -2957,7 +2957,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) { if (lib != NULL) { - free(lib); + objc_free(lib); } [super dealloc]; } @@ -3259,7 +3259,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) */ - (BOOL) _initLibXML { - lib = (xmlSAXHandler*)malloc(sizeof(xmlSAXHandler)); + lib = (xmlSAXHandler*)objc_malloc(sizeof(xmlSAXHandler)); if (lib == NULL) { return NO; @@ -3380,7 +3380,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) - (BOOL) _initLibXML { - lib = (xmlSAXHandler*)malloc(sizeof(xmlSAXHandler)); + lib = (xmlSAXHandler*)objc_malloc(sizeof(xmlSAXHandler)); if (lib == NULL) { return NO; @@ -3446,7 +3446,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) - (BOOL) _initLibXML { isHtmlHandler = YES; - lib = (xmlSAXHandler*)malloc(sizeof(htmlSAXHandler)); + lib = (xmlSAXHandler*)objc_malloc(sizeof(htmlSAXHandler)); if (lib == NULL) { return NO; diff --git a/Source/Additions/Unicode.m b/Source/Additions/Unicode.m index 9f9154ae7..e68bebbe3 100644 --- a/Source/Additions/Unicode.m +++ b/Source/Additions/Unicode.m @@ -284,7 +284,7 @@ static void GSSetupEncodingTable(void) encTableSize = tmp; } } - encTable = malloc((encTableSize+1)*sizeof(struct _strenc_ *)); + encTable = objc_malloc((encTableSize+1)*sizeof(struct _strenc_ *)); memset(encTable, 0, (encTableSize+1)*sizeof(struct _strenc_ *)); /* @@ -306,13 +306,13 @@ static void GSSetupEncodingTable(void) /* * See if we can do a lossy conversion. */ - lossy = malloc(strlen(encTable[tmp]->iconv) + 12); + lossy = objc_malloc(strlen(encTable[tmp]->iconv) + 12); strcpy(lossy, encTable[tmp]->iconv); strcat(lossy, "//TRANSLIT"); c = iconv_open(UNICODE_ENC, encTable[tmp]->iconv); if (c == (iconv_t)-1) { - free(lossy); + objc_free(lossy); } else { diff --git a/Source/NSBundle.m b/Source/NSBundle.m index 3855d56a9..801fdccb3 100644 --- a/Source/NSBundle.m +++ b/Source/NSBundle.m @@ -761,21 +761,21 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory) Class *classes = NULL; while (numClasses < newNumClasses) { numClasses = newNumClasses; - classes = realloc(classes, sizeof(Class) * numClasses); + classes = objc_realloc(classes, sizeof(Class) * numClasses); newNumClasses = objc_getClassList(classes, numClasses); } for (i = 0; i < numClasses; i++) { [self _addFrameworkFromClass: classes[i]]; } - free(classes); + objc_free(classes); } #else { int i, numBufClasses = 10, numClasses = 0; Class *classes; - classes = malloc(sizeof(Class) * numBufClasses); + classes = objc_malloc(sizeof(Class) * numBufClasses); while ((class = objc_next_class(&state))) { @@ -791,7 +791,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory) Class *ptr; numClasses += 10; - ptr = realloc(classes, sizeof(Class) * numClasses); + ptr = objc_realloc(classes, sizeof(Class) * numClasses); if (!ptr) break; @@ -804,7 +804,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory) { [self _addFrameworkFromClass: classes[i]]; } - free(classes); + objc_free(classes); } #endif #if 0 diff --git a/Source/NSCallBacks.m b/Source/NSCallBacks.m index be4b19f5b..dd8ea6d9e 100644 --- a/Source/NSCallBacks.m +++ b/Source/NSCallBacks.m @@ -95,7 +95,7 @@ void _NS_owned_void_p_release(void *table, void *p) { if (p != 0) - free(p); + objc_free(p); return; } diff --git a/Source/NSConnection.m b/Source/NSConnection.m index c4f4a36d8..58a67e0e9 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -79,10 +79,6 @@ #include "GSInvocation.h" #include "GSPortPrivate.h" -#ifdef HAVE_MALLOC_H -#include -#endif - @interface NSPortCoder (Private) - (NSMutableArray*) _components; @end diff --git a/Source/NSException.m b/Source/NSException.m index 938c8ad99..5160a9aab 100644 --- a/Source/NSException.m +++ b/Source/NSException.m @@ -225,7 +225,7 @@ } if (_symbols) { - free (_symbols); + objc_free (_symbols); _symbols = NULL; } [super dealloc]; @@ -291,10 +291,10 @@ [self release]; return nil; } - _symbols = malloc (neededSpace); + _symbols = objc_malloc (neededSpace); if (!_symbols) { - NSLog (@"GSBinaryFileInfo: Can't malloc buffer"); + NSLog (@"GSBinaryFileInfo: Can't allocate buffer"); [self release]; return nil; } diff --git a/Source/NSFileManager.m b/Source/NSFileManager.m index cb1578aa1..72dc3ad0c 100644 --- a/Source/NSFileManager.m +++ b/Source/NSFileManager.m @@ -892,7 +892,7 @@ static NSStringEncoding defaultEncoding; int len = GetCurrentDirectoryW(0, 0); if (len > 0) { - _CHAR *lpath = (_CHAR*)calloc(len+10,sizeof(_CHAR)); + _CHAR *lpath = (_CHAR*)objc_calloc(len+10,sizeof(_CHAR)); if (lpath != 0) { @@ -905,7 +905,7 @@ static NSStringEncoding defaultEncoding; path = [NSString stringWithCharacters: lpath length: len]; currentDir = path; } - free(lpath); + objc_free(lpath); } } #else diff --git a/Source/NSPage.m b/Source/NSPage.m index abdc4fc10..06c526e0f 100644 --- a/Source/NSPage.m +++ b/Source/NSPage.m @@ -18,7 +18,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. NSPage class reference $Date$ $Revision$ @@ -175,11 +176,7 @@ NSAllocateMemoryPages (unsigned bytes) return NULL; return where; #else -#ifdef HAVE_VALLOC - where = valloc (bytes); -#else - where = malloc (bytes); -#endif + where = objc_valloc (bytes); if (where == NULL) return NULL; memset (where, 0, bytes); @@ -197,7 +194,7 @@ NSDeallocateMemoryPages (void *ptr, unsigned bytes) #if __mach__ vm_deallocate (mach_task_self (), ptr, bytes); #else - free (ptr); + objc_free (ptr); #endif } diff --git a/Source/NSProcessInfo.m b/Source/NSProcessInfo.m index 9ac095dea..9b38aaa6a 100644 --- a/Source/NSProcessInfo.m +++ b/Source/NSProcessInfo.m @@ -212,12 +212,12 @@ _gnu_process_args(int argc, char *argv[], char *env[]) if (_gnu_arg_zero != 0) { - free(_gnu_arg_zero); + objc_free(_gnu_arg_zero); } if (argv != 0 && argv[0] != 0) { - _gnu_arg_zero = (char*)malloc(strlen(argv[0]) + 1); + _gnu_arg_zero = (char*)objc_malloc(strlen(argv[0]) + 1); strcpy(_gnu_arg_zero, argv[0]); arg0 = [[NSString alloc] initWithCString: _gnu_arg_zero]; } @@ -232,7 +232,7 @@ _gnu_process_args(int argc, char *argv[], char *env[]) while (needed_size == buffer_size) { buffer_size = buffer_size + 256; - buffer = (unichar*)malloc(buffer_size * sizeof(unichar)); + buffer = (unichar*)objc_malloc(buffer_size * sizeof(unichar)); needed_size = GetModuleFileNameW(NULL, buffer, buffer_size); if (needed_size < buffer_size) { @@ -249,11 +249,11 @@ _gnu_process_args(int argc, char *argv[], char *env[]) } else { - free(buffer); + objc_free(buffer); } } tmp = [arg0 UTF8String]; - _gnu_arg_zero = (char*)malloc(strlen(tmp) + 1); + _gnu_arg_zero = (char*)objc_malloc(strlen(tmp) + 1); strcpy(_gnu_arg_zero, tmp); #else fprintf(stderr, "Error: for some reason, argv not properly set up " @@ -481,7 +481,7 @@ static char **_gnu_noobjc_env = NULL; /* copy the environment strings */ for (count = 0; vectors[count]; count++) ; - _gnu_noobjc_env = (char**)malloc(sizeof(char*) * (count + 1)); + _gnu_noobjc_env = (char**)objc_malloc(sizeof(char*) * (count + 1)); if (!_gnu_noobjc_env) goto malloc_error; for (i = 0; i < count; i++) @@ -503,7 +503,8 @@ static char **_gnu_noobjc_env = NULL; /* copy the argument strings */ for (_gnu_noobjc_argc = 0; vectors[_gnu_noobjc_argc]; _gnu_noobjc_argc++) ; - _gnu_noobjc_argv = (char**)malloc(sizeof(char*) * (_gnu_noobjc_argc + 1)); + _gnu_noobjc_argv + = (char**)objc_malloc(sizeof(char*) * (_gnu_noobjc_argc + 1)); if (!_gnu_noobjc_argv) goto malloc_error; for (i = 0; i < _gnu_noobjc_argc; i++) @@ -523,7 +524,7 @@ static char **_gnu_noobjc_env = NULL; int i, count; // Read commandline - proc_file_name = (char*)malloc(sizeof(char) * 2048); + proc_file_name = (char*)objc_malloc(sizeof(char) * 2048); sprintf(proc_file_name, "/proc/%d/psinfo", (int) getpid()); ifp = fopen(proc_file_name, "r"); @@ -549,7 +550,7 @@ static char **_gnu_noobjc_env = NULL; /* copy the environment strings */ for (count = 0; vectors[count]; count++) ; - _gnu_noobjc_env = (char**)malloc(sizeof(char*) * (count + 1)); + _gnu_noobjc_env = (char**)objc_malloc(sizeof(char*) * (count + 1)); if (!_gnu_noobjc_env) goto malloc_error; for (i = 0; i < count; i++) @@ -570,7 +571,8 @@ static char **_gnu_noobjc_env = NULL; /* copy the argument strings */ for (_gnu_noobjc_argc = 0; vectors[_gnu_noobjc_argc]; _gnu_noobjc_argc++) ; - _gnu_noobjc_argv = (char**)malloc(sizeof(char*) * (_gnu_noobjc_argc + 1)); + _gnu_noobjc_argv + = (char**)objc_malloc(sizeof(char*) * (_gnu_noobjc_argc + 1)); if (!_gnu_noobjc_argv) goto malloc_error; for (i = 0; i < _gnu_noobjc_argc; i++) @@ -619,7 +621,7 @@ static char **_gnu_noobjc_env = NULL; while (environ[c] != NULL) c++; env_terms = c; - _gnu_noobjc_env = (char**)malloc(sizeof(char*) * (env_terms + 1)); + _gnu_noobjc_env = (char**)objc_malloc(sizeof(char*) * (env_terms + 1)); if (_gnu_noobjc_env == NULL) goto malloc_error; for (c = 0; c < env_terms; c++) @@ -631,7 +633,7 @@ static char **_gnu_noobjc_env = NULL; _gnu_noobjc_env[c] = NULL; // Read commandline - proc_file_name = (char *)malloc(sizeof(char) * 2048); + proc_file_name = (char *)objc_malloc(sizeof(char) * 2048); sprintf(proc_file_name, "/proc/%d/cmdline", (int) getpid()); /* @@ -664,7 +666,8 @@ static char **_gnu_noobjc_env = NULL; * Now _gnu_noobcj_argc is the number of arguments; * allocate memory accordingly. */ - _gnu_noobjc_argv = (char **)malloc((sizeof(char *)) * (_gnu_noobjc_argc + 1)); + _gnu_noobjc_argv + = (char **)objc_malloc((sizeof(char *)) * (_gnu_noobjc_argc + 1)); if (_gnu_noobjc_argv == NULL) goto malloc_error; @@ -673,7 +676,7 @@ static char **_gnu_noobjc_env = NULL; //freopen(proc_file_name, "r", ifp); if (ifp == NULL) { - free(_gnu_noobjc_argv); + objc_free(_gnu_noobjc_argv); goto proc_fs_error; } argument = 0; @@ -684,7 +687,8 @@ static char **_gnu_noobjc_env = NULL; length++; if ((c == EOF) || (c == 0)) // End of a parameter { - _gnu_noobjc_argv[argument] = (char*)malloc((sizeof(char))*length); + _gnu_noobjc_argv[argument] + = (char*)objc_malloc((sizeof(char))*length); if (_gnu_noobjc_argv[argument] == NULL) goto malloc_error; argument++; @@ -699,8 +703,8 @@ static char **_gnu_noobjc_env = NULL; if (ifp == NULL) { for (c = 0; c < _gnu_noobjc_argc; c++) - free(_gnu_noobjc_argv[c]); - free(_gnu_noobjc_argv); + objc_free(_gnu_noobjc_argv[c]); + objc_free(_gnu_noobjc_argv); goto proc_fs_error; } argument = 0; @@ -732,7 +736,7 @@ static char **_gnu_noobjc_env = NULL; } _gnu_noobjc_argv[argument] = NULL; fclose(ifp); - free(proc_file_name); + objc_free(proc_file_name); return; proc_fs_error: @@ -748,7 +752,7 @@ static char **_gnu_noobjc_env = NULL; #ifdef HAVE_PROGRAM_INVOCATION_NAME fprintf(stderr, "We try to go on anyway; but the program will ignore any argument which were passed to it.\n"); _gnu_noobjc_argc = 1; - _gnu_noobjc_argv = malloc(sizeof(char *) * 2); + _gnu_noobjc_argv = objc_malloc(sizeof(char *) * 2); if (_gnu_noobjc_argv == NULL) goto malloc_error; _gnu_noobjc_argv[0] = strdup(program_invocation_name); @@ -766,7 +770,7 @@ static char **_gnu_noobjc_env = NULL; #endif /* HAVE_PROGRAM_INVOCATION_NAME */ #endif /* !HAVE_KVM_ENV (e.g. HAVE_PROCFS) */ malloc_error: - fprintf(stderr, "malloc() error when starting gnustep-base.\n"); + fprintf(stderr, "objc_malloc() error when starting gnustep-base.\n"); fprintf(stderr, "Free some memory and then re-run the program.\n"); abort(); } @@ -779,19 +783,19 @@ _gnu_noobjc_free_vars(void) p = _gnu_noobjc_argv; while (*p) { - free(*p); + objc_free(*p); p++; } - free(_gnu_noobjc_argv); + objc_free(_gnu_noobjc_argv); _gnu_noobjc_argv = 0; p = _gnu_noobjc_env; while (*p) { - free(*p); + objc_free(*p); p++; } - free(_gnu_noobjc_env); + objc_free(_gnu_noobjc_env); _gnu_noobjc_env = 0; } diff --git a/Source/NSPropertyList.m b/Source/NSPropertyList.m index 673cf0071..0013673f5 100644 --- a/Source/NSPropertyList.m +++ b/Source/NSPropertyList.m @@ -18,7 +18,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. */ @@ -3067,7 +3068,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml, table_size = UINT_MAX; } - table = malloc(table_size * sizeof(int)); + table = objc_malloc(table_size * sizeof(int)); objectsToDoList = [[NSMutableArray alloc] init]; objectList = [[NSMutableArray alloc] init]; @@ -3082,7 +3083,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml, DESTROY(objectList); if (table != NULL) { - free(table); + objc_free(table); table = NULL; } } @@ -3159,7 +3160,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml, len = [objectList count]; size = offset_size * len; - buffer = malloc(size); + buffer = objc_malloc(size); if (offset_size == 1) { @@ -3209,7 +3210,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml, } [dest appendBytes: buffer length: size]; - free(buffer); + objc_free(buffer); } - (void) writeMetaData @@ -3396,7 +3397,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml, code = 0x6F; [dest appendBytes: &code length: 1]; - buffer = malloc(sizeof(unichar)*(len + 1)); + buffer = objc_malloc(sizeof(unichar)*(len + 1)); [self storeCount: len]; [string getCharacters: buffer]; for (i = 0; i < len; i++) @@ -3404,7 +3405,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml, buffer[i] = NSSwapHostShortToBig(buffer[i]); } [dest appendBytes: buffer length: sizeof(unichar)*len]; - free(buffer); + objc_free(buffer); } } } diff --git a/Source/NSSortDescriptor.m b/Source/NSSortDescriptor.m index 22e8afa3f..8317d86a0 100644 --- a/Source/NSSortDescriptor.m +++ b/Source/NSSortDescriptor.m @@ -18,7 +18,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. */ #include "Foundation/NSSortDescriptor.h" @@ -242,7 +243,7 @@ FindEqualityRanges(id * objects, if (j - i > 1) { (*numRanges)++; - ranges = (NSRange *) realloc(ranges, (*numRanges) * + ranges = (NSRange *) objc_realloc(ranges, (*numRanges) * sizeof(NSRange)); ranges[(*numRanges)-1].location = i; ranges[(*numRanges)-1].length = j - i; @@ -296,10 +297,10 @@ FindEqualityRanges(id * objects, unsigned int i, n; count = [self count]; - objects = (id *) calloc(count, sizeof(id)); + objects = (id *) objc_calloc(count, sizeof(id)); [self getObjects: objects]; - equalityRanges = (NSRange *) calloc(1, sizeof(NSRange)); + equalityRanges = (NSRange *) objc_calloc(1, sizeof(NSRange)); equalityRanges[0].location = 0; equalityRanges[0].length = count; numEqualityRanges = 1; @@ -330,18 +331,18 @@ FindEqualityRanges(id * objects, sortDescriptor, newRanges, &newNumRanges); } - free(equalityRanges); + objc_free(equalityRanges); equalityRanges = newRanges; numEqualityRanges = newNumRanges; } } - free(equalityRanges); + objc_free(equalityRanges); // now, reconstruct our contents according to the sorted object buffer [self setArray: [NSArray arrayWithObjects: objects count: count]]; - free(objects); + objc_free(objects); } @end diff --git a/Source/NSString.m b/Source/NSString.m index 057cce323..1e16747f8 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -618,7 +618,7 @@ handle_printf_atsign (FILE *stream, { /* * As a special case, we can return a placeholder for a string - * in the default malloc zone extremely efficiently. + * in the default zone extremely efficiently. */ return defaultPlaceholderString; } diff --git a/Source/NSTimeZone.m b/Source/NSTimeZone.m index d473e76fa..47201ffb1 100644 --- a/Source/NSTimeZone.m +++ b/Source/NSTimeZone.m @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. NSTimeZone class reference - $Date$ $Revision: 22780 $ + $Date$ $Revision$ */ /* Use the system time zones if available. In other cases, use an @@ -1203,7 +1203,7 @@ static NSMapTable *absolutes = 0; { /* * As a special case, we can return a placeholder for a time zone - * in the default malloc zone extremely efficiently. + * in the default zone extremely efficiently. */ return defaultPlaceholderTimeZone; } diff --git a/Source/callframe.m b/Source/callframe.m index f2e9e40eb..dece3d5e5 100644 --- a/Source/callframe.m +++ b/Source/callframe.m @@ -19,7 +19,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. */ #include "config.h" @@ -29,10 +30,6 @@ #include "Foundation/NSData.h" #include "GSInvocation.h" -#ifdef HAVE_MALLOC_H -#include -#endif - #if defined(ALPHA) || (defined(MIPS) && (_MIPS_SIM == _ABIN32)) typedef long long smallret_t; #else diff --git a/Source/cifframe.m b/Source/cifframe.m index 9c84fbf31..d17b3d1ef 100644 --- a/Source/cifframe.m +++ b/Source/cifframe.m @@ -19,7 +19,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. */ #include "config.h" @@ -29,10 +30,6 @@ #include "Foundation/NSData.h" #include "GSInvocation.h" -#ifdef HAVE_MALLOC_H -#include -#endif - #if defined(ALPHA) || (defined(MIPS) && (_MIPS_SIM == _ABIN32)) typedef long long smallret_t; #else @@ -215,7 +212,7 @@ cifframe_from_info (NSArgumentInfo *info, int numargs, void **retval) if (ffi_prep_cif (&cframe->cif, FFI_DEFAULT_ABI, cframe->nargs, rtype, cframe->arg_types) != FFI_OK) { - free(cframe); + objc_free(cframe); cframe = NULL; } @@ -394,7 +391,7 @@ cifframe_type(const char *typePtr, const char **advance) { size += (align - (size % align)); } - ftype = malloc(size + maxtypes*sizeof(ffi_type)); + ftype = objc_malloc(size + maxtypes*sizeof(ffi_type)); ftype->size = 0; ftype->alignment = 0; ftype->type = FFI_TYPE_STRUCT; @@ -421,7 +418,7 @@ cifframe_type(const char *typePtr, const char **advance) if (types >= maxtypes) { maxtypes *=2; - ftype = realloc(ftype, size + maxtypes*sizeof(ffi_type)); + ftype = objc_realloc(ftype, size + maxtypes*sizeof(ffi_type)); } } ftype->elements[types] = NULL; @@ -455,7 +452,7 @@ cifframe_type(const char *typePtr, const char **advance) if (align > max_align) { if (ftype && ftype->type == FFI_TYPE_STRUCT) - free(ftype); + objc_free(ftype); ftype = local; max_align = align; } diff --git a/Source/mframe.m b/Source/mframe.m index 99f57aa06..00c708639 100644 --- a/Source/mframe.m +++ b/Source/mframe.m @@ -1305,9 +1305,8 @@ static retval_t apply_short(short data) ARGFRAME. This function returns a retframe pointer. In the function that calls this one, be careful about calling more - functions after this one. The memory for the retframe is - alloca()'ed, not malloc()'ed, and therefore is on the stack and can - be tromped-on by future function calls. + functions after this one. The memory for the retframe is alloca()'ed, + and therefore is on the stack and can be tromped-on by future function calls. The callback function is finally called with the 'type' set to a null pointer to tell it that the return value and all return parameters have been diff --git a/Source/objc-load.m b/Source/objc-load.m index 78f2437c9..cae18be69 100644 --- a/Source/objc-load.m +++ b/Source/objc-load.m @@ -18,7 +18,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. */ /* @@ -339,7 +340,7 @@ objc_get_symbol_path(Class theClass, Category *theCategory) { if (len + sizeof(char)*19 > sizeof(buf)) { - p = malloc(len + sizeof(char)*19); + p = objc_malloc(len + sizeof(char)*19); if (p == NULL) { @@ -358,7 +359,7 @@ objc_get_symbol_path(Class theClass, Category *theCategory) if (len + sizeof(char)*23 > sizeof(buf)) { - p = malloc(len + sizeof(char)*23); + p = objc_malloc(len + sizeof(char)*23); if (p == NULL) { @@ -379,7 +380,7 @@ objc_get_symbol_path(Class theClass, Category *theCategory) if (p != buf) { - free(p); + objc_free(p); } if (ret)