ObjFW  Check-in [1a6dbb19bc]

Overview
Comment:Rename hostname() to avoid shadowing
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1a6dbb19bc49a049ffbf5c8311dff1c002a46d9706666ea51e01676c91d48a93
User & Date: js on 2020-12-22 18:25:04
Other Links: manifest | tags
Context
2020-12-22
20:09
Correctly handle componentsSeparatedByString: @"" check-in: 1b2efa1f5d user: js tags: trunk
18:25
Rename hostname() to avoid shadowing check-in: 1a6dbb19bc user: js tags: trunk
16:43
Obtain DNS settings from NetStack on MorphOS check-in: 79a7da1105 user: js tags: trunk
Changes

Modified src/OFDNSResolverSettings.m from [edf3853107] to [d77fb49b97].

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

		return [hostname substringFromIndex: pos + 1];
	}
}

#if !defined(OF_WII) && !defined(OF_MORPHOS)
static OFString *
hostname(void)
{
	char hostname[256];

	if (gethostname(hostname, 256) != 0)
		return nil;

	return [OFString stringWithCString: hostname







|







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

		return [hostname substringFromIndex: pos + 1];
	}
}

#if !defined(OF_WII) && !defined(OF_MORPHOS)
static OFString *
obtainHostname(void)
{
	char hostname[256];

	if (gethostname(hostname, 256) != 0)
		return nil;

	return [OFString stringWithCString: hostname
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
		    initWithObjects: @"127.0.0.1", @"::1", nil];
#else
		_nameServers = [[OFArray alloc] initWithObject: @"127.0.0.1"];
#endif

#if !defined(OF_WII) && !defined(OF_MORPHOS)
	if (_localDomain == nil)
		_localDomain = [domainFromHostname(hostname()) copy];
#endif

	if (_searchDomains == nil) {
		if (_localDomain != nil)
			_searchDomains = [[OFArray alloc]
			    initWithObject: _localDomain];
		else
			_searchDomains = [[OFArray alloc] init];
	}

	objc_autoreleasePoolPop(pool);
}
@end







|













661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
		    initWithObjects: @"127.0.0.1", @"::1", nil];
#else
		_nameServers = [[OFArray alloc] initWithObject: @"127.0.0.1"];
#endif

#if !defined(OF_WII) && !defined(OF_MORPHOS)
	if (_localDomain == nil)
		_localDomain = [domainFromHostname(obtainHostname()) copy];
#endif

	if (_searchDomains == nil) {
		if (_localDomain != nil)
			_searchDomains = [[OFArray alloc]
			    initWithObject: _localDomain];
		else
			_searchDomains = [[OFArray alloc] init];
	}

	objc_autoreleasePoolPop(pool);
}
@end