Put autorelease pools in place

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3019 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1998-10-03 05:11:05 +00:00
parent f9ea6ad12e
commit 1561ce4134
21 changed files with 63 additions and 0 deletions

View file

@ -15,6 +15,7 @@
#include <Foundation/NSException.h>
#include <Foundation/NSRange.h>
#include <Foundation/NSSerialization.h>
#include <Foundation/NSAutoreleasePool.h>
/* Data for stuffing into *Data objects. I like printable data, as it
* gives a quick visual check mechanism, but it has the disadvantage
@ -381,10 +382,13 @@ int
main(int argc,
char **argv)
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
/* Test NSMutableData. */
TestNSMutableData();
/* Test NSData. */
TestNSData();
[arp release];
return 0;
}

View file

@ -5,6 +5,7 @@
#include <Foundation/NSString.h>
#include <Foundation/NSRunLoop.h>
#include <Foundation/NSDate.h>
#include <Foundation/NSAutoreleasePool.h>
#include <gnustep/base/Coder.h>
#include <gnustep/base/BinaryCStream.h>
#include <assert.h>
@ -33,6 +34,7 @@ int main(int argc, char *argv[])
small_struct small = {12};
BOOL b;
const char *type;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
[Coder setDebugging:YES];
[BinaryCStream setDebugging:YES];
@ -171,5 +173,6 @@ int main(int argc, char *argv[])
[NSRunLoop runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 20 * 60]];
[c invalidate];
[arp release];
exit(0);
}

View file

@ -31,6 +31,7 @@
#include <Foundation/NSLock.h>
#include <Foundation/NSThread.h>
#include <Foundation/NSAutoreleasePool.h>
// Conditions
#define NO_FOOD 1
@ -111,6 +112,7 @@ id forks[5];
//
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
int i;
id p[5];

View file

@ -5,6 +5,7 @@
#include <gnustep/base/Archiver.h>
#include <Foundation/NSValue.h>
#include <gnustep/base/TextCStream.h>
#include <Foundation/NSAutoreleasePool.h>
@interface NSNumber (printing)
- (void) print;
@ -30,6 +31,7 @@ int main()
id array;
int i;
BOOL b;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
/* Create a simple invocation, and get it's return value. */
obj = [NSObject new];
@ -99,6 +101,7 @@ int main()
[inv invoke];
}
[arp release];
exit(0);
}

View file

@ -32,6 +32,7 @@
#include <Foundation/NSArray.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSAttributedString.h>
#include <Foundation/NSAutoreleasePool.h>
#include <stdio.h>
// These are normally defined in the AppKit
@ -122,6 +123,8 @@ void testAttributedString(void)
int
main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
testAttributedString();
[arp release];
exit(0);
}

View file

@ -13,6 +13,7 @@
#include "Foundation/NSBundle.h"
#include "Foundation/NSException.h"
#include "Foundation/NSString.h"
#include <Foundation/NSAutoreleasePool.h>
#include "LoadMe.h"
#include "SecondClass.h"
#include "MyCategory.h"
@ -24,6 +25,7 @@ main(int ac, char *av[])
NSBundle *bundle;
NSString *path;
id object;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
main = [NSBundle mainBundle];
printf("Looking for main bundle...\n");
@ -82,5 +84,6 @@ main(int ac, char *av[])
[object printMyName];
[object release];
[arp release];
return 0;
}

View file

@ -1,7 +1,9 @@
#include <Foundation/NSCharacterSet.h>
#include <Foundation/NSAutoreleasePool.h>
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSCharacterSet *alpha = [NSCharacterSet alphanumericCharacterSet];
if (alpha)
@ -9,5 +11,6 @@ int main()
else
printf("unable to obtain alphanumeric character set\n");
[arp release];
exit(0);
}

View file

@ -1,6 +1,7 @@
#include <stdio.h>
#include <Foundation/NSHashTable.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSAutoreleasePool.h>
int main ()
{
@ -8,6 +9,7 @@ int main ()
NSHashEnumerator he;
int i;
void *v;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
/* Test with ints */
@ -55,5 +57,6 @@ int main ()
NSFreeHashTable (mt);
#endif
[arp release];
exit (0);
}

View file

@ -1,6 +1,7 @@
#include <Foundation/NSArray.h>
#include <Foundation/NSString.h>
#include <Foundation/NSHost.h>
#include <Foundation/NSAutoreleasePool.h>
void
displayHost(NSHost* h)
@ -23,6 +24,7 @@ main ()
NSHost* a;
NSHost* c;
NSHost* n;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
c = [NSHost currentHost];
displayHost(c);
@ -40,5 +42,6 @@ main ()
displayHost(n);
printf("c:%lx, n:%lx, a:%lx\n", c, n, a);
[arp release];
exit (0);
}

View file

@ -1,6 +1,7 @@
#include <Foundation/NSMethodSignature.h>
#include <Foundation/NSInvocation.h>
#include <Foundation/NSString.h>
#include <Foundation/NSAutoreleasePool.h>
typedef struct {
char c;
@ -178,6 +179,7 @@ main ()
NSMethodSignature *sig;
Target *t;
id p;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
t = [Target new];
p = [[MyProxy alloc] initWithTarget: t];
@ -392,6 +394,7 @@ main ()
la = [p loopLargePtr: laptr];
printf("forward: {%d,%s,%.2f}\n", la.i, la.s, la.f);
[arp release];
return 0;
}

View file

@ -1,6 +1,7 @@
#include <stdio.h>
#include <Foundation/NSMapTable.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSAutoreleasePool.h>
int main ()
{
@ -10,6 +11,7 @@ int main ()
void *k;
void *v;
id o;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
/* Test with ints */
@ -65,5 +67,6 @@ int main ()
NSFreeMapTable (mt);
[arp release];
exit (0);
}

View file

@ -3,9 +3,11 @@
#include <Foundation/NSArray.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSDate.h>
#include <Foundation/NSAutoreleasePool.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSProcessInfo *pi = [NSProcessInfo processInfo];
NSString* aString;
NSString* aKey;
@ -28,5 +30,6 @@ int main(int argc, char *argv[])
printf("++>%s=%s\n",[aKey cString],[[[pi environment]
objectForKey:aKey] cString]);
[arp release];
exit(0);
}

View file

@ -12,6 +12,7 @@
*/
#include <Foundation/NSScanner.h>
#include <Foundation/NSAutoreleasePool.h>
#include <limits.h>
#include <float.h>
#include <math.h>
@ -858,6 +859,7 @@ main (int argc, char **argv)
{
extern char *optarg;
int c;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
while ((c = getopt (argc, argv, "e:")) != EOF) {
switch (c) {
@ -877,5 +879,6 @@ main (int argc, char **argv)
testScanUpToString ();
testScanCharactersFromSet ();
testScanUpToCharactersFromSet ();
[arp release];
return 0;
}

View file

@ -1,6 +1,7 @@
#include <Foundation/NSSet.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSString.h>
#include <Foundation/NSAutoreleasePool.h>
void original_test ();
void intersects_set_test();
@ -9,11 +10,13 @@ void is_subset_of_set_test ();
int
main ()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
original_test ();
intersects_set_test ();
is_subset_of_set_test ();
printf("Test passed\n");
[arp release];
exit (0);
}

View file

@ -1,6 +1,7 @@
#include <Foundation/NSRunLoop.h>
#include <gnustep/base/Invocation.h>
#include <Foundation/NSTimer.h>
#include <Foundation/NSAutoreleasePool.h>
@interface TestDouble : NSObject
+ (double) testDouble;
@ -30,6 +31,7 @@ void say_count ()
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
volatile double foo, bar;
id inv = [[VoidFunctionInvocation alloc] initWithVoidFunction: say_count];
id o;
@ -53,5 +55,6 @@ int main()
invocation: inv
repeats: YES];
[NSRunLoop run];
[arp release];
exit (0);
}

View file

@ -4,15 +4,18 @@
#include <Foundation/NSArray.h>
#include <Foundation/NSDate.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSAutoreleasePool.h>
int
main ()
{
id detail;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
printf("time zones for PST:\n%@\n",
[[[NSTimeZone abbreviationMap] objectForKey: @"PST"] description]);
printf("time zones:\n%@\n", [[NSTimeZone timeZoneArray] description]);
printf("local time zone:\n%@\n", [[NSTimeZone localTimeZone] description]);
[arp release];
return 0;
}

View file

@ -8,6 +8,7 @@
#include <Foundation/NSRunLoop.h>
#include <gnustep/base/Coder.h>
#include <gnustep/base/BinaryCStream.h>
#include <Foundation/NSAutoreleasePool.h>
#include "server.h"
@implementation Server
@ -244,6 +245,7 @@ int main(int argc, char *argv[])
id o = [[NSObject alloc] init];
double d;
NSConnection *c;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
[BinaryCStream setDebugging:YES];
@ -271,5 +273,6 @@ int main(int argc, char *argv[])
[NSRunLoop run];
[arp release];
exit(0);
}

View file

@ -2,6 +2,7 @@
/* For demo of Strings as Collections of char's. */
#include <Foundation/NSString.h>
#include <Foundation/NSAutoreleasePool.h>
void
print_string(NSString* s)
@ -14,6 +15,7 @@ print_string(NSString* s)
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
id s = @"This is a test string";
id s2, s3;
@ -59,5 +61,6 @@ int main()
}
#endif
[arp release];
exit(0);
}

View file

@ -1,6 +1,7 @@
#include <gnustep/base/all.h>
#include <Foundation/NSValue.h>
#include <gnustep/base/Invocation.h>
#include <Foundation/NSAutoreleasePool.h>
@interface ConstantCollection (TestingExtras)
- printCount;
@ -27,6 +28,7 @@ void checkSameContents(id objectslist)
int main()
{
int i;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
id array = [Array new];
// id bag = [Bag new];
@ -84,6 +86,7 @@ int main()
[collections release];
[arp release];
exit(0);
}

View file

@ -1,7 +1,9 @@
#include <gnustep/base/all.h>
#include <Foundation/NSAutoreleasePool.h>
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
id dict = [Dictionary new];
id translator = [Dictionary new];
@ -31,6 +33,7 @@ int main()
[dict release];
[translator release];
[arp release];
exit(0);
}

View file

@ -8,6 +8,7 @@
#include <Foundation/NSString.h>
#include <Foundation/NSGeometry.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSAutoreleasePool.h>
int main()
@ -17,6 +18,7 @@ int main()
NSValue *v1, *v2;
NSNumber *n1, *n2, *n3, *n4, *n5;
NSArray *a1, *a2;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
// Numbers
n1 = [NSNumber numberWithUnsignedShort:30];
@ -75,5 +77,6 @@ int main()
printf("Try getting a null NSValue, should get a NSLog error message:\n");
v2 = [NSValue value:NULL withObjCType:@encode(int)];
[arp release];
return 0;
}