Bug Summary

File:Source/externs.m
Location:line 295, column 7
Description:Potential leak of an object allocated on line 295
Code is compiled to use reference counts

Annotated Source Code

1/** All of the external data
2 Copyright (C) 1997 Free Software Foundation, Inc.
3
4 Written by: Scott Christley <scottc@net-community.com>
5 Date: August 1997
6
7 This file is part of the GNUstep Base Library.
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free
21 Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02111 USA.
23 */
24
25#import "common.h"
26
27#import "Foundation/NSArray.h"
28#import "Foundation/NSException.h"
29#import "GNUstepBase/NSObject+GNUstepBase.h"
30
31#import "GSPrivate.h"
32
33/*
34 PENDING some string constants are scattered about in the class impl
35 files and should be moved here
36 furthermore, the test for this in Testing/exported-strings.m
37 needs to be updated
38*/
39
40
41/*
42 * NSConnection Notification Strings.
43 */
44NSString *NSConnectionDidDieNotification = @"NSConnectionDidDieNotification";
45
46NSString *NSConnectionDidInitializeNotification = @"NSConnectionDidInitializeNotification";
47
48
49/*
50 * NSDistributedNotificationCenter types.
51 */
52NSString *NSLocalNotificationCenterType = @"NSLocalNotificationCenterType";
53NSString *GSNetworkNotificationCenterType = @"GSNetworkNotificationCenterType";
54NSString *GSPublicNotificationCenterType = @"GSPublicNotificationCenterType";
55
56/*
57 * NSThread Notifications
58 */
59NSString *NSWillBecomeMultiThreadedNotification = @"NSWillBecomeMultiThreadedNotification";
60
61NSString *NSThreadDidStartNotification = @"NSThreadDidStartNotification";
62
63NSString *NSThreadWillExitNotification = @"NSThreadWillExitNotification";
64
65
66/*
67 * Port Notifications
68 */
69
70NSString *NSPortDidBecomeInvalidNotification = @"NSPortDidBecomeInvalidNotification";
71
72/* NSTask notifications */
73NSString *NSTaskDidTerminateNotification = @"NSTaskDidTerminateNotification";
74
75/* NSUndoManager notifications */
76NSString *NSUndoManagerCheckpointNotification = @"NSUndoManagerCheckpointNotification";
77
78NSString *NSUndoManagerDidOpenUndoGroupNotification = @"NSUndoManagerDidOpenUndoGroupNotification";
79
80NSString *NSUndoManagerDidRedoChangeNotification = @"NSUndoManagerDidRedoChangeNotification";
81
82NSString *NSUndoManagerDidUndoChangeNotification = @"NSUndoManagerDidUndoChangeNotification";
83
84NSString *NSUndoManagerWillCloseUndoGroupNotification = @"NSUndoManagerWillCloseUndoGroupNotification";
85
86NSString *NSUndoManagerWillRedoChangeNotification = @"NSUndoManagerWillRedoChangeNotification";
87
88NSString *NSUndoManagerWillUndoChangeNotification = @"NSUndoManagerWillUndoChangeNotification";
89
90
91/* NSURL constants */
92NSString *NSURLFileScheme = @"file";
93
94/* RunLoop modes */
95NSString *NSConnectionReplyMode = @"NSConnectionReplyMode";
96
97/* NSValueTransformer constants */
98NSString *const NSNegateBooleanTransformerName
99 = @"NSNegateBoolean";
100NSString *const NSIsNilTransformerName
101 = @"NSIsNil";
102NSString *const NSIsNotNilTransformerName
103 = @"NSIsNotNil";
104NSString *const NSUnarchiveFromDataTransformerName
105 = @"NSUnarchiveFromData";
106
107
108/* Standard domains */
109NSString *NSArgumentDomain = @"NSArgumentDomain";
110
111NSString *NSGlobalDomain = @"NSGlobalDomain";
112
113NSString *NSRegistrationDomain = @"NSRegistrationDomain";
114
115NSString *GSConfigDomain = @"GSConfigDomain";
116
117
118/* Public notification */
119NSString *NSUserDefaultsDidChangeNotification = @"NSUserDefaultsDidChangeNotification";
120
121
122/* Keys for language-dependent information */
123NSString *NSWeekDayNameArray = @"NSWeekDayNameArray";
124
125NSString *NSShortWeekDayNameArray = @"NSShortWeekDayNameArray";
126
127NSString *NSMonthNameArray = @"NSMonthNameArray";
128
129NSString *NSShortMonthNameArray = @"NSShortMonthNameArray";
130
131NSString *NSTimeFormatString = @"NSTimeFormatString";
132
133NSString *NSDateFormatString = @"NSDateFormatString";
134
135NSString *NSShortDateFormatString = @"NSShortDateFormatString";
136
137NSString *NSTimeDateFormatString = @"NSTimeDateFormatString";
138
139NSString *NSShortTimeDateFormatString = @"NSShortTimeDateFormatString";
140
141NSString *NSCurrencySymbol = @"NSCurrencySymbol";
142
143NSString *NSDecimalSeparator = @"NSDecimalSeparator";
144
145NSString *NSThousandsSeparator = @"NSThousandsSeparator";
146
147NSString *NSInternationalCurrencyString = @"NSInternationalCurrencyString";
148
149NSString *NSCurrencyString = @"NSCurrencyString";
150
151NSString *NSNegativeCurrencyFormatString = @"NSNegativeCurrencyFormatString";
152
153NSString *NSPositiveCurrencyFormatString = @"NSPositiveCurrencyFormatString";
154
155NSString *NSDecimalDigits = @"NSDecimalDigits";
156
157NSString *NSAMPMDesignation = @"NSAMPMDesignation";
158
159
160NSString *NSHourNameDesignations = @"NSHourNameDesignations";
161
162NSString *NSYearMonthWeekDesignations = @"NSYearMonthWeekDesignations";
163
164NSString *NSEarlierTimeDesignations = @"NSEarlierTimeDesignations";
165
166NSString *NSLaterTimeDesignations = @"NSLaterTimeDesignations";
167
168NSString *NSThisDayDesignations = @"NSThisDayDesignations";
169
170NSString *NSNextDayDesignations = @"NSNextDayDesignations";
171
172NSString *NSNextNextDayDesignations = @"NSNextNextDayDesignations";
173
174NSString *NSPriorDayDesignations = @"NSPriorDayDesignations";
175
176NSString *NSDateTimeOrdering = @"NSDateTimeOrdering";
177
178
179/* These are in OPENSTEP 4.2 */
180NSString *NSLanguageCode = @"NSLanguageCode";
181
182NSString *NSLanguageName = @"NSLanguageName";
183
184NSString *NSFormalName = @"NSFormalName";
185
186/* For GNUstep */
187NSString *GSLocale = @"GSLocale";
188
189
190/*
191 * Keys for the NSDictionary returned by [NSConnection -statistics]
192 */
193/* These in OPENSTEP 4.2 */
194NSString *NSConnectionRepliesReceived = @"NSConnectionRepliesReceived";
195
196NSString *NSConnectionRepliesSent = @"NSConnectionRepliesSent";
197
198NSString *NSConnectionRequestsReceived = @"NSConnectionRequestsReceived";
199
200NSString *NSConnectionRequestsSent = @"NSConnectionRequestsSent";
201
202/* These Are GNUstep extras */
203NSString *NSConnectionLocalCount = @"NSConnectionLocalCount";
204
205NSString *NSConnectionProxyCount = @"NSConnectionProxyCount";
206
207/* Class description notification */
208NSString *NSClassDescriptionNeededForClassNotification = @"NSClassDescriptionNeededForClassNotification";
209
210
211/*
212 * Optimization function called when NSObject is initialised.
213 * We replace all the constant strings so they can
214 * cache their hash values and be used much more efficiently as keys in
215 * dictionaries etc.
216 * We initialize with constant strings so that
217 * code executed before NSObject +initialize calls us,
218 * will have valid values.
219 */
220
221void
222GSPrivateBuildStrings()
223{
224 static Class NSStringClass = 0;
225
226 if (NSStringClass == 0)
1
Taking true branch
227 {
228 NSStringClass = [NSString class];
229
230 /*
231 * Ensure that NSString is initialized ... because we are called
232 * from [NSObject +initialize] which might be executing as a
233 * result of a call to [NSString +initialize] !
234 * Use performSelector: to avoid compiler warning about clash of
235 * return value types in two different versions of initialize.
236 */
237 [NSStringClass performSelector: @selector(initialize)];
238
239 GS_REPLACE_CONSTANT_STRING(GSNetworkNotificationCenterType)[(GSNetworkNotificationCenterType = [NSObject leak: [[NSString
alloc] initWithUTF8String: [GSNetworkNotificationCenterType UTF8String
]]]) release]
;
240 GS_REPLACE_CONSTANT_STRING(NSAMPMDesignation)[(NSAMPMDesignation = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSAMPMDesignation UTF8String]]]) release]
;
241 GS_REPLACE_CONSTANT_STRING(NSArgumentDomain)[(NSArgumentDomain = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSArgumentDomain UTF8String]]]) release]
;
242 GS_REPLACE_CONSTANT_STRING(NSClassDescriptionNeededForClassNotification)[(NSClassDescriptionNeededForClassNotification = [NSObject leak
: [[NSString alloc] initWithUTF8String: [NSClassDescriptionNeededForClassNotification
UTF8String]]]) release]
;
243 GS_REPLACE_CONSTANT_STRING(NSConnectionDidDieNotification)[(NSConnectionDidDieNotification = [NSObject leak: [[NSString
alloc] initWithUTF8String: [NSConnectionDidDieNotification UTF8String
]]]) release]
;
244 GS_REPLACE_CONSTANT_STRING(NSConnectionDidInitializeNotification)[(NSConnectionDidInitializeNotification = [NSObject leak: [[NSString
alloc] initWithUTF8String: [NSConnectionDidInitializeNotification
UTF8String]]]) release]
;
245 GS_REPLACE_CONSTANT_STRING(NSConnectionLocalCount)[(NSConnectionLocalCount = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSConnectionLocalCount UTF8String]]]) release]
;
246 GS_REPLACE_CONSTANT_STRING(NSConnectionProxyCount)[(NSConnectionProxyCount = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSConnectionProxyCount UTF8String]]]) release]
;
247 GS_REPLACE_CONSTANT_STRING(NSConnectionRepliesReceived)[(NSConnectionRepliesReceived = [NSObject leak: [[NSString alloc
] initWithUTF8String: [NSConnectionRepliesReceived UTF8String
]]]) release]
;
248 GS_REPLACE_CONSTANT_STRING(NSConnectionRepliesSent)[(NSConnectionRepliesSent = [NSObject leak: [[NSString alloc]
initWithUTF8String: [NSConnectionRepliesSent UTF8String]]]) release
]
;
249 GS_REPLACE_CONSTANT_STRING(NSConnectionReplyMode)[(NSConnectionReplyMode = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSConnectionReplyMode UTF8String]]]) release]
;
250 GS_REPLACE_CONSTANT_STRING(NSConnectionRequestsReceived)[(NSConnectionRequestsReceived = [NSObject leak: [[NSString alloc
] initWithUTF8String: [NSConnectionRequestsReceived UTF8String
]]]) release]
;
251 GS_REPLACE_CONSTANT_STRING(NSConnectionRequestsSent)[(NSConnectionRequestsSent = [NSObject leak: [[NSString alloc
] initWithUTF8String: [NSConnectionRequestsSent UTF8String]]]
) release]
;
252 GS_REPLACE_CONSTANT_STRING(NSCurrencyString)[(NSCurrencyString = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSCurrencyString UTF8String]]]) release]
;
253 GS_REPLACE_CONSTANT_STRING(NSCurrencySymbol)[(NSCurrencySymbol = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSCurrencySymbol UTF8String]]]) release]
;
254 GS_REPLACE_CONSTANT_STRING(NSDateFormatString)[(NSDateFormatString = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSDateFormatString UTF8String]]]) release]
;
255 GS_REPLACE_CONSTANT_STRING(NSDateTimeOrdering)[(NSDateTimeOrdering = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSDateTimeOrdering UTF8String]]]) release]
;
256 GS_REPLACE_CONSTANT_STRING(NSDecimalDigits)[(NSDecimalDigits = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSDecimalDigits UTF8String]]]) release]
;
257 GS_REPLACE_CONSTANT_STRING(NSDecimalSeparator)[(NSDecimalSeparator = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSDecimalSeparator UTF8String]]]) release]
;
258 GS_REPLACE_CONSTANT_STRING(NSEarlierTimeDesignations)[(NSEarlierTimeDesignations = [NSObject leak: [[NSString alloc
] initWithUTF8String: [NSEarlierTimeDesignations UTF8String]]
]) release]
;
259 GS_REPLACE_CONSTANT_STRING(NSFormalName)[(NSFormalName = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSFormalName UTF8String]]]) release]
;
260 GS_REPLACE_CONSTANT_STRING(NSGlobalDomain)[(NSGlobalDomain = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSGlobalDomain UTF8String]]]) release]
;
261 GS_REPLACE_CONSTANT_STRING(NSHourNameDesignations)[(NSHourNameDesignations = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSHourNameDesignations UTF8String]]]) release]
;
262 GS_REPLACE_CONSTANT_STRING(NSInternationalCurrencyString)[(NSInternationalCurrencyString = [NSObject leak: [[NSString alloc
] initWithUTF8String: [NSInternationalCurrencyString UTF8String
]]]) release]
;
263 GS_REPLACE_CONSTANT_STRING(NSLanguageCode)[(NSLanguageCode = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSLanguageCode UTF8String]]]) release]
;
264 GS_REPLACE_CONSTANT_STRING(NSLanguageName)[(NSLanguageName = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSLanguageName UTF8String]]]) release]
;
265 GS_REPLACE_CONSTANT_STRING(NSLaterTimeDesignations)[(NSLaterTimeDesignations = [NSObject leak: [[NSString alloc]
initWithUTF8String: [NSLaterTimeDesignations UTF8String]]]) release
]
;
266 GS_REPLACE_CONSTANT_STRING(GSLocale)[(GSLocale = [NSObject leak: [[NSString alloc] initWithUTF8String
: [GSLocale UTF8String]]]) release]
;
267 GS_REPLACE_CONSTANT_STRING(NSLocalNotificationCenterType)[(NSLocalNotificationCenterType = [NSObject leak: [[NSString alloc
] initWithUTF8String: [NSLocalNotificationCenterType UTF8String
]]]) release]
;
268 GS_REPLACE_CONSTANT_STRING(NSMonthNameArray)[(NSMonthNameArray = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSMonthNameArray UTF8String]]]) release]
;
269 GS_REPLACE_CONSTANT_STRING(NSNegativeCurrencyFormatString)[(NSNegativeCurrencyFormatString = [NSObject leak: [[NSString
alloc] initWithUTF8String: [NSNegativeCurrencyFormatString UTF8String
]]]) release]
;
270 GS_REPLACE_CONSTANT_STRING(NSNextDayDesignations)[(NSNextDayDesignations = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSNextDayDesignations UTF8String]]]) release]
;
271 GS_REPLACE_CONSTANT_STRING(NSNextNextDayDesignations)[(NSNextNextDayDesignations = [NSObject leak: [[NSString alloc
] initWithUTF8String: [NSNextNextDayDesignations UTF8String]]
]) release]
;
272 GS_REPLACE_CONSTANT_STRING(NSPortDidBecomeInvalidNotification)[(NSPortDidBecomeInvalidNotification = [NSObject leak: [[NSString
alloc] initWithUTF8String: [NSPortDidBecomeInvalidNotification
UTF8String]]]) release]
;
273 GS_REPLACE_CONSTANT_STRING(NSPositiveCurrencyFormatString)[(NSPositiveCurrencyFormatString = [NSObject leak: [[NSString
alloc] initWithUTF8String: [NSPositiveCurrencyFormatString UTF8String
]]]) release]
;
274 GS_REPLACE_CONSTANT_STRING(NSPriorDayDesignations)[(NSPriorDayDesignations = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSPriorDayDesignations UTF8String]]]) release]
;
275 GS_REPLACE_CONSTANT_STRING(NSRegistrationDomain)[(NSRegistrationDomain = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSRegistrationDomain UTF8String]]]) release]
;
276 GS_REPLACE_CONSTANT_STRING(NSShortDateFormatString)[(NSShortDateFormatString = [NSObject leak: [[NSString alloc]
initWithUTF8String: [NSShortDateFormatString UTF8String]]]) release
]
;
277 GS_REPLACE_CONSTANT_STRING(NSShortMonthNameArray)[(NSShortMonthNameArray = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSShortMonthNameArray UTF8String]]]) release]
;
278 GS_REPLACE_CONSTANT_STRING(NSShortTimeDateFormatString)[(NSShortTimeDateFormatString = [NSObject leak: [[NSString alloc
] initWithUTF8String: [NSShortTimeDateFormatString UTF8String
]]]) release]
;
279 GS_REPLACE_CONSTANT_STRING(NSShortWeekDayNameArray)[(NSShortWeekDayNameArray = [NSObject leak: [[NSString alloc]
initWithUTF8String: [NSShortWeekDayNameArray UTF8String]]]) release
]
;
280 GS_REPLACE_CONSTANT_STRING(NSTaskDidTerminateNotification)[(NSTaskDidTerminateNotification = [NSObject leak: [[NSString
alloc] initWithUTF8String: [NSTaskDidTerminateNotification UTF8String
]]]) release]
;
281 GS_REPLACE_CONSTANT_STRING(NSThisDayDesignations)[(NSThisDayDesignations = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSThisDayDesignations UTF8String]]]) release]
;
282 GS_REPLACE_CONSTANT_STRING(NSThousandsSeparator)[(NSThousandsSeparator = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSThousandsSeparator UTF8String]]]) release]
;
283 GS_REPLACE_CONSTANT_STRING(NSThreadDidStartNotification)[(NSThreadDidStartNotification = [NSObject leak: [[NSString alloc
] initWithUTF8String: [NSThreadDidStartNotification UTF8String
]]]) release]
;
284 GS_REPLACE_CONSTANT_STRING(NSThreadWillExitNotification)[(NSThreadWillExitNotification = [NSObject leak: [[NSString alloc
] initWithUTF8String: [NSThreadWillExitNotification UTF8String
]]]) release]
;
285 GS_REPLACE_CONSTANT_STRING(NSTimeDateFormatString)[(NSTimeDateFormatString = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSTimeDateFormatString UTF8String]]]) release]
;
286 GS_REPLACE_CONSTANT_STRING(NSTimeFormatString)[(NSTimeFormatString = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSTimeFormatString UTF8String]]]) release]
;
287 GS_REPLACE_CONSTANT_STRING(NSUndoManagerCheckpointNotification)[(NSUndoManagerCheckpointNotification = [NSObject leak: [[NSString
alloc] initWithUTF8String: [NSUndoManagerCheckpointNotification
UTF8String]]]) release]
;
288 GS_REPLACE_CONSTANT_STRING(NSUndoManagerDidOpenUndoGroupNotification)[(NSUndoManagerDidOpenUndoGroupNotification = [NSObject leak:
[[NSString alloc] initWithUTF8String: [NSUndoManagerDidOpenUndoGroupNotification
UTF8String]]]) release]
;
289 GS_REPLACE_CONSTANT_STRING(NSUndoManagerDidRedoChangeNotification)[(NSUndoManagerDidRedoChangeNotification = [NSObject leak: [[
NSString alloc] initWithUTF8String: [NSUndoManagerDidRedoChangeNotification
UTF8String]]]) release]
;
290 GS_REPLACE_CONSTANT_STRING(NSUndoManagerDidUndoChangeNotification)[(NSUndoManagerDidUndoChangeNotification = [NSObject leak: [[
NSString alloc] initWithUTF8String: [NSUndoManagerDidUndoChangeNotification
UTF8String]]]) release]
;
291 GS_REPLACE_CONSTANT_STRING(NSUndoManagerWillCloseUndoGroupNotification)[(NSUndoManagerWillCloseUndoGroupNotification = [NSObject leak
: [[NSString alloc] initWithUTF8String: [NSUndoManagerWillCloseUndoGroupNotification
UTF8String]]]) release]
;
292 GS_REPLACE_CONSTANT_STRING(NSUndoManagerWillRedoChangeNotification)[(NSUndoManagerWillRedoChangeNotification = [NSObject leak: [
[NSString alloc] initWithUTF8String: [NSUndoManagerWillRedoChangeNotification
UTF8String]]]) release]
;
293 GS_REPLACE_CONSTANT_STRING(NSUndoManagerWillUndoChangeNotification)[(NSUndoManagerWillUndoChangeNotification = [NSObject leak: [
[NSString alloc] initWithUTF8String: [NSUndoManagerWillUndoChangeNotification
UTF8String]]]) release]
;
294 GS_REPLACE_CONSTANT_STRING(NSURLFileScheme)[(NSURLFileScheme = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSURLFileScheme UTF8String]]]) release]
;
295 GS_REPLACE_CONSTANT_STRING(NSUserDefaultsDidChangeNotification)[(NSUserDefaultsDidChangeNotification = [NSObject leak: [[NSString
alloc] initWithUTF8String: [NSUserDefaultsDidChangeNotification
UTF8String]]]) release]
;
2
Within the expansion of the macro 'GS_REPLACE_CONSTANT_STRING':
a
Method returns an Objective-C object with a +1 retain count
b
Object leaked: allocated object is not referenced later in this execution path and has a retain count of +1
296 GS_REPLACE_CONSTANT_STRING(NSWeekDayNameArray)[(NSWeekDayNameArray = [NSObject leak: [[NSString alloc] initWithUTF8String
: [NSWeekDayNameArray UTF8String]]]) release]
;
297 GS_REPLACE_CONSTANT_STRING(NSWillBecomeMultiThreadedNotification)[(NSWillBecomeMultiThreadedNotification = [NSObject leak: [[NSString
alloc] initWithUTF8String: [NSWillBecomeMultiThreadedNotification
UTF8String]]]) release]
;
298 GS_REPLACE_CONSTANT_STRING(NSYearMonthWeekDesignations)[(NSYearMonthWeekDesignations = [NSObject leak: [[NSString alloc
] initWithUTF8String: [NSYearMonthWeekDesignations UTF8String
]]]) release]
;
299 }
300}
301
302
303
304/* For bug in gcc 3.1. See NSByteOrder.h */
305void _gcc3_1_hack(void){}