Skip to content

Commit

Permalink
Tidyups
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Dec 4, 2024
1 parent 7ac6931 commit 815a0d7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
22 changes: 11 additions & 11 deletions Source/NSProcessInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ @implementation NSProcessInfo
static void
_gnu_process_args(int argc, char *argv[], char *env[])
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
ENTER_POOL
NSString *arg0 = nil;
int i;
int i;

if (_gnu_arg_zero != 0)
{
Expand Down Expand Up @@ -330,7 +330,7 @@ @implementation NSProcessInfo
}

/* Getting the process name */
IF_NO_ARC(RELEASE(_gnu_processName);)
IF_NO_ARC([_gnu_processName release];)
_gnu_processName = [arg0 lastPathComponent];
#if defined(_WIN32)
/* On windows we remove any .exe extension for consistency with app names
Expand Down Expand Up @@ -373,9 +373,9 @@ @implementation NSProcessInfo
}
}

IF_NO_ARC(RELEASE(_gnu_arguments);)
IF_NO_ARC([_gnu_arguments release];)
_gnu_arguments = [[NSArray alloc] initWithObjects: obj_argv count: added];
RELEASE(arg0);
IF_NO_ARC([arg0 release];)
}
#else
if (argv)
Expand All @@ -400,9 +400,9 @@ @implementation NSProcessInfo
obj_argv[added++] = str;
}

IF_NO_ARC(RELEASE(_gnu_arguments);)
IF_NO_ARC([_gnu_arguments release];)
_gnu_arguments = [[NSArray alloc] initWithObjects: obj_argv count: added];
RELEASE(arg0);
IF_NO_ARC([arg0 release];)
}
#endif

Expand Down Expand Up @@ -482,13 +482,13 @@ @implementation NSProcessInfo
i++;
}
}
IF_NO_ARC(RELEASE(_gnu_environment);)
IF_NO_ARC([_gnu_environment release];)
_gnu_environment = [[NSDictionary alloc] initWithObjects: values
forKeys: keys];
IF_NO_ARC(RELEASE(keys);)
IF_NO_ARC(RELEASE(values);)
IF_NO_ARC([keys release];)
IF_NO_ARC([values release];)
}
[arp drain];
LEAVE_POOL
}

#if !GS_FAKE_MAIN && ((defined(HAVE_PROCFS) || defined(HAVE_KVM_ENV) || defined(HAVE_PROCFS_PSINFO) || defined(__APPLE__)) && (defined(HAVE_LOAD_METHOD)))
Expand Down
14 changes: 8 additions & 6 deletions Source/NSUserDefaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ + (void) initialize
* the +_createArgumentDictionary: method.
*/
args = [[NSProcessInfo processInfo] arguments];
enumerator = [[[NSProcessInfo processInfo] arguments] objectEnumerator];
enumerator = [args objectEnumerator];
[enumerator nextObject]; // Skip process name.
while (nil != (key = [enumerator nextObject]))
{
Expand Down Expand Up @@ -1543,14 +1543,16 @@ - (void) removeObjectForKey: (NSString*)defaultName
[_lock lock];
NS_DURING
{
GSPersistentDomain *pd = [_persDomains objectForKey: bundleIdentifier];
id old = [self objectForKey: defaultName];
GSPersistentDomain *pd;

if (nil != pd)
if (nil != (pd = [_persDomains objectForKey: bundleIdentifier]))
{
if ([pd setObject: nil forKey: defaultName])
{
id new;
id old;
id new;

old = [self objectForKey: defaultName];
[self _changePersistentDomain: bundleIdentifier];
new = [self objectForKey: defaultName];
/* Emit only a KVO notification when the value has actually
Expand Down Expand Up @@ -2093,7 +2095,7 @@ - (BOOL) synchronize
_lastSync = saved;
}
// Check and if not existent add the Application and the Global domains
if ([_persDomains objectForKey: bundleIdentifier] == nil)
if (bundleIdentifier && [_persDomains objectForKey: bundleIdentifier] == nil)
{
GSPersistentDomain *pd;

Expand Down

0 comments on commit 815a0d7

Please sign in to comment.