mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Tidied up
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22977 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0dfcfd4814
commit
e40074f3db
19 changed files with 111 additions and 95 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -95,7 +95,7 @@ void
|
|||
_NS_owned_void_p_release(void *table, void *p)
|
||||
{
|
||||
if (p != 0)
|
||||
free(p);
|
||||
objc_free(p);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,10 +79,6 @@
|
|||
#include "GSInvocation.h"
|
||||
#include "GSPortPrivate.h"
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
@interface NSPortCoder (Private)
|
||||
- (NSMutableArray*) _components;
|
||||
@end
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
||||
<title>NSPage class reference</title>
|
||||
$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
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
|
||||
<title>NSTimeZone class reference</title>
|
||||
$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;
|
||||
}
|
||||
|
|
|
@ -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 <malloc.h>
|
||||
#endif
|
||||
|
||||
#if defined(ALPHA) || (defined(MIPS) && (_MIPS_SIM == _ABIN32))
|
||||
typedef long long smallret_t;
|
||||
#else
|
||||
|
|
|
@ -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 <malloc.h>
|
||||
#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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue