From 352581a203d9d83238273d4a0ce2511e28cd6df5 Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Sat, 3 Oct 1998 05:11:05 +0000 Subject: [PATCH] Put autorelease pools in place git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3019 72102866-910b-0410-8b05-ffd578937521 --- Testing/NSData-test.m | 4 ++++ Testing/client.m | 3 +++ Testing/diningPhilosophers.m | 2 ++ Testing/invocation.m | 3 +++ Testing/nsattributedstring.m | 3 +++ Testing/nsbundle.m | 3 +++ Testing/nscharacterset.m | 3 +++ Testing/nshashtable.m | 3 +++ Testing/nshost.m | 3 +++ Testing/nsinvocation.m | 3 +++ Testing/nsmaptable.m | 3 +++ Testing/nsprocessinfo.m | 3 +++ Testing/nsscanner.m | 3 +++ Testing/nsset.m | 3 +++ Testing/nstimer.m | 3 +++ Testing/nstimezone.m | 3 +++ Testing/server.m | 3 +++ Testing/string.m | 3 +++ Testing/test01.m | 3 +++ Testing/test02.m | 3 +++ Testing/values.m | 3 +++ 21 files changed, 63 insertions(+) diff --git a/Testing/NSData-test.m b/Testing/NSData-test.m index 5700185e5..cba247fcd 100644 --- a/Testing/NSData-test.m +++ b/Testing/NSData-test.m @@ -15,6 +15,7 @@ #include #include #include +#include /* 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; } diff --git a/Testing/client.m b/Testing/client.m index a7a239ae6..d86d86e5f 100644 --- a/Testing/client.m +++ b/Testing/client.m @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -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); } diff --git a/Testing/diningPhilosophers.m b/Testing/diningPhilosophers.m index bc7b49556..b9ccac472 100644 --- a/Testing/diningPhilosophers.m +++ b/Testing/diningPhilosophers.m @@ -31,6 +31,7 @@ #include #include +#include // Conditions #define NO_FOOD 1 @@ -111,6 +112,7 @@ id forks[5]; // int main() { + NSAutoreleasePool *arp = [NSAutoreleasePool new]; int i; id p[5]; diff --git a/Testing/invocation.m b/Testing/invocation.m index 9c7829fb8..93ca7f308 100644 --- a/Testing/invocation.m +++ b/Testing/invocation.m @@ -5,6 +5,7 @@ #include #include #include +#include @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); } diff --git a/Testing/nsattributedstring.m b/Testing/nsattributedstring.m index 614e787dd..7a2d84617 100644 --- a/Testing/nsattributedstring.m +++ b/Testing/nsattributedstring.m @@ -32,6 +32,7 @@ #include #include #include +#include #include // 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); } diff --git a/Testing/nsbundle.m b/Testing/nsbundle.m index 49000e457..bf3434219 100644 --- a/Testing/nsbundle.m +++ b/Testing/nsbundle.m @@ -13,6 +13,7 @@ #include "Foundation/NSBundle.h" #include "Foundation/NSException.h" #include "Foundation/NSString.h" +#include #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; } diff --git a/Testing/nscharacterset.m b/Testing/nscharacterset.m index c6180c2e7..b0937d3d2 100644 --- a/Testing/nscharacterset.m +++ b/Testing/nscharacterset.m @@ -1,7 +1,9 @@ #include +#include 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); } diff --git a/Testing/nshashtable.m b/Testing/nshashtable.m index bd8872f97..f160eae08 100644 --- a/Testing/nshashtable.m +++ b/Testing/nshashtable.m @@ -1,6 +1,7 @@ #include #include #include +#include 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); } diff --git a/Testing/nshost.m b/Testing/nshost.m index 8e7c73eab..b326603f9 100644 --- a/Testing/nshost.m +++ b/Testing/nshost.m @@ -1,6 +1,7 @@ #include #include #include +#include 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); } diff --git a/Testing/nsinvocation.m b/Testing/nsinvocation.m index 0781abf12..e0abb52e6 100644 --- a/Testing/nsinvocation.m +++ b/Testing/nsinvocation.m @@ -1,6 +1,7 @@ #include #include #include +#include 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; } diff --git a/Testing/nsmaptable.m b/Testing/nsmaptable.m index 5eeccecaf..739ce4786 100644 --- a/Testing/nsmaptable.m +++ b/Testing/nsmaptable.m @@ -1,6 +1,7 @@ #include #include #include +#include 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); } diff --git a/Testing/nsprocessinfo.m b/Testing/nsprocessinfo.m index b040677f1..3e55366ce 100644 --- a/Testing/nsprocessinfo.m +++ b/Testing/nsprocessinfo.m @@ -3,9 +3,11 @@ #include #include #include +#include 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); } diff --git a/Testing/nsscanner.m b/Testing/nsscanner.m index b7dd85e84..24cd14a57 100644 --- a/Testing/nsscanner.m +++ b/Testing/nsscanner.m @@ -12,6 +12,7 @@ */ #include +#include #include #include #include @@ -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; } diff --git a/Testing/nsset.m b/Testing/nsset.m index e88231b11..b4807ecc9 100644 --- a/Testing/nsset.m +++ b/Testing/nsset.m @@ -1,6 +1,7 @@ #include #include #include +#include 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); } diff --git a/Testing/nstimer.m b/Testing/nstimer.m index 5d60c22bb..82a2bd2d5 100644 --- a/Testing/nstimer.m +++ b/Testing/nstimer.m @@ -1,6 +1,7 @@ #include #include #include +#include @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); } diff --git a/Testing/nstimezone.m b/Testing/nstimezone.m index b18543f7b..00a75c43b 100644 --- a/Testing/nstimezone.m +++ b/Testing/nstimezone.m @@ -4,15 +4,18 @@ #include #include #include +#include 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; } diff --git a/Testing/server.m b/Testing/server.m index 524f1623a..b69d0ce8b 100644 --- a/Testing/server.m +++ b/Testing/server.m @@ -8,6 +8,7 @@ #include #include #include +#include #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); } diff --git a/Testing/string.m b/Testing/string.m index 7cbe2dbcb..63f998a4d 100644 --- a/Testing/string.m +++ b/Testing/string.m @@ -2,6 +2,7 @@ /* For demo of Strings as Collections of char's. */ #include +#include 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); } diff --git a/Testing/test01.m b/Testing/test01.m index 9e087c762..e3c48b85d 100644 --- a/Testing/test01.m +++ b/Testing/test01.m @@ -1,6 +1,7 @@ #include #include #include +#include @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); } diff --git a/Testing/test02.m b/Testing/test02.m index 7d01a57b7..f2851091b 100644 --- a/Testing/test02.m +++ b/Testing/test02.m @@ -1,7 +1,9 @@ #include +#include 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); } diff --git a/Testing/values.m b/Testing/values.m index e9575926f..e8e477283 100644 --- a/Testing/values.m +++ b/Testing/values.m @@ -8,6 +8,7 @@ #include #include #include +#include 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; }