mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +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
7cf503e096
commit
6d7eae6095
19 changed files with 111 additions and 95 deletions
24
ChangeLog
24
ChangeLog
|
@ -1,4 +1,26 @@
|
||||||
2006-05-2 Richard Frith-Macdonald <rfm@gnu.org>
|
2006-05-24 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* 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 <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/Additions/GSMime.m: Fix some cases where parse was saying
|
* Source/Additions/GSMime.m: Fix some cases where parse was saying
|
||||||
it needed more data even though it had actually completed.
|
it needed more data even though it had actually completed.
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
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"
|
#include "config.h"
|
||||||
|
@ -607,7 +608,7 @@ objc_mutex_t
|
||||||
objc_mutex_allocate(void)
|
objc_mutex_allocate(void)
|
||||||
{
|
{
|
||||||
pthread_mutex_t *p;
|
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)
|
if (pthread_mutex_init(p, NULL) != 0)
|
||||||
{
|
{
|
||||||
abort();
|
abort();
|
||||||
|
@ -623,7 +624,7 @@ objc_mutex_deallocate(objc_mutex_t mutex)
|
||||||
ret = pthread_mutex_destroy(p);
|
ret = pthread_mutex_destroy(p);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
free(p);
|
objc_free(p);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2957,7 +2957,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
|
||||||
{
|
{
|
||||||
if (lib != NULL)
|
if (lib != NULL)
|
||||||
{
|
{
|
||||||
free(lib);
|
objc_free(lib);
|
||||||
}
|
}
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
@ -3259,7 +3259,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
|
||||||
*/
|
*/
|
||||||
- (BOOL) _initLibXML
|
- (BOOL) _initLibXML
|
||||||
{
|
{
|
||||||
lib = (xmlSAXHandler*)malloc(sizeof(xmlSAXHandler));
|
lib = (xmlSAXHandler*)objc_malloc(sizeof(xmlSAXHandler));
|
||||||
if (lib == NULL)
|
if (lib == NULL)
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -3380,7 +3380,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
|
||||||
|
|
||||||
- (BOOL) _initLibXML
|
- (BOOL) _initLibXML
|
||||||
{
|
{
|
||||||
lib = (xmlSAXHandler*)malloc(sizeof(xmlSAXHandler));
|
lib = (xmlSAXHandler*)objc_malloc(sizeof(xmlSAXHandler));
|
||||||
if (lib == NULL)
|
if (lib == NULL)
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -3446,7 +3446,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
|
||||||
- (BOOL) _initLibXML
|
- (BOOL) _initLibXML
|
||||||
{
|
{
|
||||||
isHtmlHandler = YES;
|
isHtmlHandler = YES;
|
||||||
lib = (xmlSAXHandler*)malloc(sizeof(htmlSAXHandler));
|
lib = (xmlSAXHandler*)objc_malloc(sizeof(htmlSAXHandler));
|
||||||
if (lib == NULL)
|
if (lib == NULL)
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
|
|
|
@ -284,7 +284,7 @@ static void GSSetupEncodingTable(void)
|
||||||
encTableSize = tmp;
|
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_ *));
|
memset(encTable, 0, (encTableSize+1)*sizeof(struct _strenc_ *));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -306,13 +306,13 @@ static void GSSetupEncodingTable(void)
|
||||||
/*
|
/*
|
||||||
* See if we can do a lossy conversion.
|
* 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);
|
strcpy(lossy, encTable[tmp]->iconv);
|
||||||
strcat(lossy, "//TRANSLIT");
|
strcat(lossy, "//TRANSLIT");
|
||||||
c = iconv_open(UNICODE_ENC, encTable[tmp]->iconv);
|
c = iconv_open(UNICODE_ENC, encTable[tmp]->iconv);
|
||||||
if (c == (iconv_t)-1)
|
if (c == (iconv_t)-1)
|
||||||
{
|
{
|
||||||
free(lossy);
|
objc_free(lossy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -761,21 +761,21 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
||||||
Class *classes = NULL;
|
Class *classes = NULL;
|
||||||
while (numClasses < newNumClasses) {
|
while (numClasses < newNumClasses) {
|
||||||
numClasses = newNumClasses;
|
numClasses = newNumClasses;
|
||||||
classes = realloc(classes, sizeof(Class) * numClasses);
|
classes = objc_realloc(classes, sizeof(Class) * numClasses);
|
||||||
newNumClasses = objc_getClassList(classes, numClasses);
|
newNumClasses = objc_getClassList(classes, numClasses);
|
||||||
}
|
}
|
||||||
for (i = 0; i < numClasses; i++)
|
for (i = 0; i < numClasses; i++)
|
||||||
{
|
{
|
||||||
[self _addFrameworkFromClass: classes[i]];
|
[self _addFrameworkFromClass: classes[i]];
|
||||||
}
|
}
|
||||||
free(classes);
|
objc_free(classes);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
int i, numBufClasses = 10, numClasses = 0;
|
int i, numBufClasses = 10, numClasses = 0;
|
||||||
Class *classes;
|
Class *classes;
|
||||||
|
|
||||||
classes = malloc(sizeof(Class) * numBufClasses);
|
classes = objc_malloc(sizeof(Class) * numBufClasses);
|
||||||
|
|
||||||
while ((class = objc_next_class(&state)))
|
while ((class = objc_next_class(&state)))
|
||||||
{
|
{
|
||||||
|
@ -791,7 +791,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
||||||
Class *ptr;
|
Class *ptr;
|
||||||
|
|
||||||
numClasses += 10;
|
numClasses += 10;
|
||||||
ptr = realloc(classes, sizeof(Class) * numClasses);
|
ptr = objc_realloc(classes, sizeof(Class) * numClasses);
|
||||||
|
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
break;
|
break;
|
||||||
|
@ -804,7 +804,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
||||||
{
|
{
|
||||||
[self _addFrameworkFromClass: classes[i]];
|
[self _addFrameworkFromClass: classes[i]];
|
||||||
}
|
}
|
||||||
free(classes);
|
objc_free(classes);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -95,7 +95,7 @@ void
|
||||||
_NS_owned_void_p_release(void *table, void *p)
|
_NS_owned_void_p_release(void *table, void *p)
|
||||||
{
|
{
|
||||||
if (p != 0)
|
if (p != 0)
|
||||||
free(p);
|
objc_free(p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,10 +79,6 @@
|
||||||
#include "GSInvocation.h"
|
#include "GSInvocation.h"
|
||||||
#include "GSPortPrivate.h"
|
#include "GSPortPrivate.h"
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@interface NSPortCoder (Private)
|
@interface NSPortCoder (Private)
|
||||||
- (NSMutableArray*) _components;
|
- (NSMutableArray*) _components;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -225,7 +225,7 @@
|
||||||
}
|
}
|
||||||
if (_symbols)
|
if (_symbols)
|
||||||
{
|
{
|
||||||
free (_symbols);
|
objc_free (_symbols);
|
||||||
_symbols = NULL;
|
_symbols = NULL;
|
||||||
}
|
}
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
|
@ -291,10 +291,10 @@
|
||||||
[self release];
|
[self release];
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
_symbols = malloc (neededSpace);
|
_symbols = objc_malloc (neededSpace);
|
||||||
if (!_symbols)
|
if (!_symbols)
|
||||||
{
|
{
|
||||||
NSLog (@"GSBinaryFileInfo: Can't malloc buffer");
|
NSLog (@"GSBinaryFileInfo: Can't allocate buffer");
|
||||||
[self release];
|
[self release];
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -892,7 +892,7 @@ static NSStringEncoding defaultEncoding;
|
||||||
int len = GetCurrentDirectoryW(0, 0);
|
int len = GetCurrentDirectoryW(0, 0);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
_CHAR *lpath = (_CHAR*)calloc(len+10,sizeof(_CHAR));
|
_CHAR *lpath = (_CHAR*)objc_calloc(len+10,sizeof(_CHAR));
|
||||||
|
|
||||||
if (lpath != 0)
|
if (lpath != 0)
|
||||||
{
|
{
|
||||||
|
@ -905,7 +905,7 @@ static NSStringEncoding defaultEncoding;
|
||||||
path = [NSString stringWithCharacters: lpath length: len];
|
path = [NSString stringWithCharacters: lpath length: len];
|
||||||
currentDir = path;
|
currentDir = path;
|
||||||
}
|
}
|
||||||
free(lpath);
|
objc_free(lpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
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>
|
<title>NSPage class reference</title>
|
||||||
$Date$ $Revision$
|
$Date$ $Revision$
|
||||||
|
@ -175,11 +176,7 @@ NSAllocateMemoryPages (unsigned bytes)
|
||||||
return NULL;
|
return NULL;
|
||||||
return where;
|
return where;
|
||||||
#else
|
#else
|
||||||
#ifdef HAVE_VALLOC
|
where = objc_valloc (bytes);
|
||||||
where = valloc (bytes);
|
|
||||||
#else
|
|
||||||
where = malloc (bytes);
|
|
||||||
#endif
|
|
||||||
if (where == NULL)
|
if (where == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
memset (where, 0, bytes);
|
memset (where, 0, bytes);
|
||||||
|
@ -197,7 +194,7 @@ NSDeallocateMemoryPages (void *ptr, unsigned bytes)
|
||||||
#if __mach__
|
#if __mach__
|
||||||
vm_deallocate (mach_task_self (), ptr, bytes);
|
vm_deallocate (mach_task_self (), ptr, bytes);
|
||||||
#else
|
#else
|
||||||
free (ptr);
|
objc_free (ptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,12 +212,12 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
||||||
|
|
||||||
if (_gnu_arg_zero != 0)
|
if (_gnu_arg_zero != 0)
|
||||||
{
|
{
|
||||||
free(_gnu_arg_zero);
|
objc_free(_gnu_arg_zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv != 0 && argv[0] != 0)
|
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]);
|
strcpy(_gnu_arg_zero, argv[0]);
|
||||||
arg0 = [[NSString alloc] initWithCString: _gnu_arg_zero];
|
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)
|
while (needed_size == buffer_size)
|
||||||
{
|
{
|
||||||
buffer_size = buffer_size + 256;
|
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);
|
needed_size = GetModuleFileNameW(NULL, buffer, buffer_size);
|
||||||
if (needed_size < buffer_size)
|
if (needed_size < buffer_size)
|
||||||
{
|
{
|
||||||
|
@ -249,11 +249,11 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
free(buffer);
|
objc_free(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmp = [arg0 UTF8String];
|
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);
|
strcpy(_gnu_arg_zero, tmp);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "Error: for some reason, argv not properly set up "
|
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 */
|
/* copy the environment strings */
|
||||||
for (count = 0; vectors[count]; count++)
|
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)
|
if (!_gnu_noobjc_env)
|
||||||
goto malloc_error;
|
goto malloc_error;
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
|
@ -503,7 +503,8 @@ static char **_gnu_noobjc_env = NULL;
|
||||||
/* copy the argument strings */
|
/* copy the argument strings */
|
||||||
for (_gnu_noobjc_argc = 0; vectors[_gnu_noobjc_argc]; _gnu_noobjc_argc++)
|
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)
|
if (!_gnu_noobjc_argv)
|
||||||
goto malloc_error;
|
goto malloc_error;
|
||||||
for (i = 0; i < _gnu_noobjc_argc; i++)
|
for (i = 0; i < _gnu_noobjc_argc; i++)
|
||||||
|
@ -523,7 +524,7 @@ static char **_gnu_noobjc_env = NULL;
|
||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
// Read commandline
|
// 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());
|
sprintf(proc_file_name, "/proc/%d/psinfo", (int) getpid());
|
||||||
|
|
||||||
ifp = fopen(proc_file_name, "r");
|
ifp = fopen(proc_file_name, "r");
|
||||||
|
@ -549,7 +550,7 @@ static char **_gnu_noobjc_env = NULL;
|
||||||
/* copy the environment strings */
|
/* copy the environment strings */
|
||||||
for (count = 0; vectors[count]; count++)
|
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)
|
if (!_gnu_noobjc_env)
|
||||||
goto malloc_error;
|
goto malloc_error;
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
|
@ -570,7 +571,8 @@ static char **_gnu_noobjc_env = NULL;
|
||||||
/* copy the argument strings */
|
/* copy the argument strings */
|
||||||
for (_gnu_noobjc_argc = 0; vectors[_gnu_noobjc_argc]; _gnu_noobjc_argc++)
|
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)
|
if (!_gnu_noobjc_argv)
|
||||||
goto malloc_error;
|
goto malloc_error;
|
||||||
for (i = 0; i < _gnu_noobjc_argc; i++)
|
for (i = 0; i < _gnu_noobjc_argc; i++)
|
||||||
|
@ -619,7 +621,7 @@ static char **_gnu_noobjc_env = NULL;
|
||||||
while (environ[c] != NULL)
|
while (environ[c] != NULL)
|
||||||
c++;
|
c++;
|
||||||
env_terms = 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)
|
if (_gnu_noobjc_env == NULL)
|
||||||
goto malloc_error;
|
goto malloc_error;
|
||||||
for (c = 0; c < env_terms; c++)
|
for (c = 0; c < env_terms; c++)
|
||||||
|
@ -631,7 +633,7 @@ static char **_gnu_noobjc_env = NULL;
|
||||||
_gnu_noobjc_env[c] = NULL;
|
_gnu_noobjc_env[c] = NULL;
|
||||||
|
|
||||||
// Read commandline
|
// 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());
|
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;
|
* Now _gnu_noobcj_argc is the number of arguments;
|
||||||
* allocate memory accordingly.
|
* 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)
|
if (_gnu_noobjc_argv == NULL)
|
||||||
goto malloc_error;
|
goto malloc_error;
|
||||||
|
|
||||||
|
@ -673,7 +676,7 @@ static char **_gnu_noobjc_env = NULL;
|
||||||
//freopen(proc_file_name, "r", ifp);
|
//freopen(proc_file_name, "r", ifp);
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
{
|
{
|
||||||
free(_gnu_noobjc_argv);
|
objc_free(_gnu_noobjc_argv);
|
||||||
goto proc_fs_error;
|
goto proc_fs_error;
|
||||||
}
|
}
|
||||||
argument = 0;
|
argument = 0;
|
||||||
|
@ -684,7 +687,8 @@ static char **_gnu_noobjc_env = NULL;
|
||||||
length++;
|
length++;
|
||||||
if ((c == EOF) || (c == 0)) // End of a parameter
|
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)
|
if (_gnu_noobjc_argv[argument] == NULL)
|
||||||
goto malloc_error;
|
goto malloc_error;
|
||||||
argument++;
|
argument++;
|
||||||
|
@ -699,8 +703,8 @@ static char **_gnu_noobjc_env = NULL;
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
{
|
{
|
||||||
for (c = 0; c < _gnu_noobjc_argc; c++)
|
for (c = 0; c < _gnu_noobjc_argc; c++)
|
||||||
free(_gnu_noobjc_argv[c]);
|
objc_free(_gnu_noobjc_argv[c]);
|
||||||
free(_gnu_noobjc_argv);
|
objc_free(_gnu_noobjc_argv);
|
||||||
goto proc_fs_error;
|
goto proc_fs_error;
|
||||||
}
|
}
|
||||||
argument = 0;
|
argument = 0;
|
||||||
|
@ -732,7 +736,7 @@ static char **_gnu_noobjc_env = NULL;
|
||||||
}
|
}
|
||||||
_gnu_noobjc_argv[argument] = NULL;
|
_gnu_noobjc_argv[argument] = NULL;
|
||||||
fclose(ifp);
|
fclose(ifp);
|
||||||
free(proc_file_name);
|
objc_free(proc_file_name);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
proc_fs_error:
|
proc_fs_error:
|
||||||
|
@ -748,7 +752,7 @@ static char **_gnu_noobjc_env = NULL;
|
||||||
#ifdef HAVE_PROGRAM_INVOCATION_NAME
|
#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");
|
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_argc = 1;
|
||||||
_gnu_noobjc_argv = malloc(sizeof(char *) * 2);
|
_gnu_noobjc_argv = objc_malloc(sizeof(char *) * 2);
|
||||||
if (_gnu_noobjc_argv == NULL)
|
if (_gnu_noobjc_argv == NULL)
|
||||||
goto malloc_error;
|
goto malloc_error;
|
||||||
_gnu_noobjc_argv[0] = strdup(program_invocation_name);
|
_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_PROGRAM_INVOCATION_NAME */
|
||||||
#endif /* !HAVE_KVM_ENV (e.g. HAVE_PROCFS) */
|
#endif /* !HAVE_KVM_ENV (e.g. HAVE_PROCFS) */
|
||||||
malloc_error:
|
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");
|
fprintf(stderr, "Free some memory and then re-run the program.\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
@ -779,19 +783,19 @@ _gnu_noobjc_free_vars(void)
|
||||||
p = _gnu_noobjc_argv;
|
p = _gnu_noobjc_argv;
|
||||||
while (*p)
|
while (*p)
|
||||||
{
|
{
|
||||||
free(*p);
|
objc_free(*p);
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
free(_gnu_noobjc_argv);
|
objc_free(_gnu_noobjc_argv);
|
||||||
_gnu_noobjc_argv = 0;
|
_gnu_noobjc_argv = 0;
|
||||||
|
|
||||||
p = _gnu_noobjc_env;
|
p = _gnu_noobjc_env;
|
||||||
while (*p)
|
while (*p)
|
||||||
{
|
{
|
||||||
free(*p);
|
objc_free(*p);
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
free(_gnu_noobjc_env);
|
objc_free(_gnu_noobjc_env);
|
||||||
_gnu_noobjc_env = 0;
|
_gnu_noobjc_env = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
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_size = UINT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
table = malloc(table_size * sizeof(int));
|
table = objc_malloc(table_size * sizeof(int));
|
||||||
|
|
||||||
objectsToDoList = [[NSMutableArray alloc] init];
|
objectsToDoList = [[NSMutableArray alloc] init];
|
||||||
objectList = [[NSMutableArray alloc] init];
|
objectList = [[NSMutableArray alloc] init];
|
||||||
|
@ -3082,7 +3083,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
||||||
DESTROY(objectList);
|
DESTROY(objectList);
|
||||||
if (table != NULL)
|
if (table != NULL)
|
||||||
{
|
{
|
||||||
free(table);
|
objc_free(table);
|
||||||
table = NULL;
|
table = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3159,7 +3160,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
||||||
len = [objectList count];
|
len = [objectList count];
|
||||||
size = offset_size * len;
|
size = offset_size * len;
|
||||||
|
|
||||||
buffer = malloc(size);
|
buffer = objc_malloc(size);
|
||||||
|
|
||||||
if (offset_size == 1)
|
if (offset_size == 1)
|
||||||
{
|
{
|
||||||
|
@ -3209,7 +3210,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
||||||
}
|
}
|
||||||
|
|
||||||
[dest appendBytes: buffer length: size];
|
[dest appendBytes: buffer length: size];
|
||||||
free(buffer);
|
objc_free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) writeMetaData
|
- (void) writeMetaData
|
||||||
|
@ -3396,7 +3397,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
||||||
|
|
||||||
code = 0x6F;
|
code = 0x6F;
|
||||||
[dest appendBytes: &code length: 1];
|
[dest appendBytes: &code length: 1];
|
||||||
buffer = malloc(sizeof(unichar)*(len + 1));
|
buffer = objc_malloc(sizeof(unichar)*(len + 1));
|
||||||
[self storeCount: len];
|
[self storeCount: len];
|
||||||
[string getCharacters: buffer];
|
[string getCharacters: buffer];
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
|
@ -3404,7 +3405,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
||||||
buffer[i] = NSSwapHostShortToBig(buffer[i]);
|
buffer[i] = NSSwapHostShortToBig(buffer[i]);
|
||||||
}
|
}
|
||||||
[dest appendBytes: buffer length: sizeof(unichar)*len];
|
[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
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
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"
|
#include "Foundation/NSSortDescriptor.h"
|
||||||
|
@ -242,7 +243,7 @@ FindEqualityRanges(id * objects,
|
||||||
if (j - i > 1)
|
if (j - i > 1)
|
||||||
{
|
{
|
||||||
(*numRanges)++;
|
(*numRanges)++;
|
||||||
ranges = (NSRange *) realloc(ranges, (*numRanges) *
|
ranges = (NSRange *) objc_realloc(ranges, (*numRanges) *
|
||||||
sizeof(NSRange));
|
sizeof(NSRange));
|
||||||
ranges[(*numRanges)-1].location = i;
|
ranges[(*numRanges)-1].location = i;
|
||||||
ranges[(*numRanges)-1].length = j - i;
|
ranges[(*numRanges)-1].length = j - i;
|
||||||
|
@ -296,10 +297,10 @@ FindEqualityRanges(id * objects,
|
||||||
unsigned int i, n;
|
unsigned int i, n;
|
||||||
|
|
||||||
count = [self count];
|
count = [self count];
|
||||||
objects = (id *) calloc(count, sizeof(id));
|
objects = (id *) objc_calloc(count, sizeof(id));
|
||||||
[self getObjects: objects];
|
[self getObjects: objects];
|
||||||
|
|
||||||
equalityRanges = (NSRange *) calloc(1, sizeof(NSRange));
|
equalityRanges = (NSRange *) objc_calloc(1, sizeof(NSRange));
|
||||||
equalityRanges[0].location = 0;
|
equalityRanges[0].location = 0;
|
||||||
equalityRanges[0].length = count;
|
equalityRanges[0].length = count;
|
||||||
numEqualityRanges = 1;
|
numEqualityRanges = 1;
|
||||||
|
@ -330,18 +331,18 @@ FindEqualityRanges(id * objects,
|
||||||
sortDescriptor, newRanges, &newNumRanges);
|
sortDescriptor, newRanges, &newNumRanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(equalityRanges);
|
objc_free(equalityRanges);
|
||||||
equalityRanges = newRanges;
|
equalityRanges = newRanges;
|
||||||
numEqualityRanges = newNumRanges;
|
numEqualityRanges = newNumRanges;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(equalityRanges);
|
objc_free(equalityRanges);
|
||||||
|
|
||||||
// now, reconstruct our contents according to the sorted object buffer
|
// now, reconstruct our contents according to the sorted object buffer
|
||||||
[self setArray: [NSArray arrayWithObjects: objects count: count]];
|
[self setArray: [NSArray arrayWithObjects: objects count: count]];
|
||||||
|
|
||||||
free(objects);
|
objc_free(objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -618,7 +618,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* As a special case, we can return a placeholder for a string
|
* 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;
|
return defaultPlaceholderString;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||||
|
|
||||||
<title>NSTimeZone class reference</title>
|
<title>NSTimeZone class reference</title>
|
||||||
$Date$ $Revision: 22780 $
|
$Date$ $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Use the system time zones if available. In other cases, use an
|
/* 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
|
* 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;
|
return defaultPlaceholderTimeZone;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
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"
|
#include "config.h"
|
||||||
|
@ -29,10 +30,6 @@
|
||||||
#include "Foundation/NSData.h"
|
#include "Foundation/NSData.h"
|
||||||
#include "GSInvocation.h"
|
#include "GSInvocation.h"
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ALPHA) || (defined(MIPS) && (_MIPS_SIM == _ABIN32))
|
#if defined(ALPHA) || (defined(MIPS) && (_MIPS_SIM == _ABIN32))
|
||||||
typedef long long smallret_t;
|
typedef long long smallret_t;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
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"
|
#include "config.h"
|
||||||
|
@ -29,10 +30,6 @@
|
||||||
#include "Foundation/NSData.h"
|
#include "Foundation/NSData.h"
|
||||||
#include "GSInvocation.h"
|
#include "GSInvocation.h"
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ALPHA) || (defined(MIPS) && (_MIPS_SIM == _ABIN32))
|
#if defined(ALPHA) || (defined(MIPS) && (_MIPS_SIM == _ABIN32))
|
||||||
typedef long long smallret_t;
|
typedef long long smallret_t;
|
||||||
#else
|
#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,
|
if (ffi_prep_cif (&cframe->cif, FFI_DEFAULT_ABI, cframe->nargs,
|
||||||
rtype, cframe->arg_types) != FFI_OK)
|
rtype, cframe->arg_types) != FFI_OK)
|
||||||
{
|
{
|
||||||
free(cframe);
|
objc_free(cframe);
|
||||||
cframe = NULL;
|
cframe = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +391,7 @@ cifframe_type(const char *typePtr, const char **advance)
|
||||||
{
|
{
|
||||||
size += (align - (size % align));
|
size += (align - (size % align));
|
||||||
}
|
}
|
||||||
ftype = malloc(size + maxtypes*sizeof(ffi_type));
|
ftype = objc_malloc(size + maxtypes*sizeof(ffi_type));
|
||||||
ftype->size = 0;
|
ftype->size = 0;
|
||||||
ftype->alignment = 0;
|
ftype->alignment = 0;
|
||||||
ftype->type = FFI_TYPE_STRUCT;
|
ftype->type = FFI_TYPE_STRUCT;
|
||||||
|
@ -421,7 +418,7 @@ cifframe_type(const char *typePtr, const char **advance)
|
||||||
if (types >= maxtypes)
|
if (types >= maxtypes)
|
||||||
{
|
{
|
||||||
maxtypes *=2;
|
maxtypes *=2;
|
||||||
ftype = realloc(ftype, size + maxtypes*sizeof(ffi_type));
|
ftype = objc_realloc(ftype, size + maxtypes*sizeof(ffi_type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ftype->elements[types] = NULL;
|
ftype->elements[types] = NULL;
|
||||||
|
@ -455,7 +452,7 @@ cifframe_type(const char *typePtr, const char **advance)
|
||||||
if (align > max_align)
|
if (align > max_align)
|
||||||
{
|
{
|
||||||
if (ftype && ftype->type == FFI_TYPE_STRUCT)
|
if (ftype && ftype->type == FFI_TYPE_STRUCT)
|
||||||
free(ftype);
|
objc_free(ftype);
|
||||||
ftype = local;
|
ftype = local;
|
||||||
max_align = align;
|
max_align = align;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1305,9 +1305,8 @@ static retval_t apply_short(short data)
|
||||||
ARGFRAME. This function returns a retframe pointer.
|
ARGFRAME. This function returns a retframe pointer.
|
||||||
|
|
||||||
In the function that calls this one, be careful about calling more
|
In the function that calls this one, be careful about calling more
|
||||||
functions after this one. The memory for the retframe is
|
functions after this one. The memory for the retframe is alloca()'ed,
|
||||||
alloca()'ed, not malloc()'ed, and therefore is on the stack and can
|
and therefore is on the stack and can be tromped-on by future function calls.
|
||||||
be tromped-on by future function calls.
|
|
||||||
|
|
||||||
The callback function is finally called with the 'type' set to a null pointer
|
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
|
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
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
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))
|
if (len + sizeof(char)*19 > sizeof(buf))
|
||||||
{
|
{
|
||||||
p = malloc(len + sizeof(char)*19);
|
p = objc_malloc(len + sizeof(char)*19);
|
||||||
|
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
{
|
{
|
||||||
|
@ -358,7 +359,7 @@ objc_get_symbol_path(Class theClass, Category *theCategory)
|
||||||
|
|
||||||
if (len + sizeof(char)*23 > sizeof(buf))
|
if (len + sizeof(char)*23 > sizeof(buf))
|
||||||
{
|
{
|
||||||
p = malloc(len + sizeof(char)*23);
|
p = objc_malloc(len + sizeof(char)*23);
|
||||||
|
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
{
|
{
|
||||||
|
@ -379,7 +380,7 @@ objc_get_symbol_path(Class theClass, Category *theCategory)
|
||||||
|
|
||||||
if (p != buf)
|
if (p != buf)
|
||||||
{
|
{
|
||||||
free(p);
|
objc_free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue