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 Frith-MacDonald 1998-10-03 05:11:05 +00:00
parent 8efe9b06d5
commit 352581a203
21 changed files with 63 additions and 0 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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