ObjFW  Diff

Differences From Artifact [29fca6defb]:

To Artifact [8a22d63aae]:


120
121
122
123
124
125
126




127
128
129
130
131
132
133
typedef unsigned int NSSearchPathEnumerationState;

extern NSSearchPathEnumerationState NSStartSearchPathEnumeration(
    NSSearchPathDirectory, NSSearchPathDomainMask);
extern NSSearchPathEnumerationState NSGetNextSearchPathEnumeration(
    NSSearchPathEnumerationState, char *);
#endif





#if defined(OF_AMD64) || defined(OF_X86)
struct X86Regs {
	uint32_t eax, ebx, ecx, edx;
};
#endif








>
>
>
>







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
typedef unsigned int NSSearchPathEnumerationState;

extern NSSearchPathEnumerationState NSStartSearchPathEnumeration(
    NSSearchPathDirectory, NSSearchPathDomainMask);
extern NSSearchPathEnumerationState NSGetNextSearchPathEnumeration(
    NSSearchPathEnumerationState, char *);
#endif

#ifdef OF_HAVE_SOCKETS
OFNetworkInterfaceKey OFNetworkInterfaceIndex = @"OFNetworkInterfaceIndex";
#endif

#if defined(OF_AMD64) || defined(OF_X86)
struct X86Regs {
	uint32_t eax, ebx, ecx, edx;
};
#endif

835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859








860
861
862
863
864
865
866
+ (bool)isWindowsNT
{
	return !(GetVersion() & 0x80000000);
}
#endif

#ifdef OF_HAVE_SOCKETS
+ (OFArray OF_GENERIC(OFString *) *)networkInterfaces
{
# ifdef HAVE_IF_NAMEINDEX
	OFMutableArray *ret = [OFMutableArray array];
	void *pool = objc_autoreleasePoolPush();
	OFStringEncoding encoding = [OFLocale encoding];
	struct if_nameindex *nameindex = if_nameindex();

	if (nameindex == NULL) {
		objc_autoreleasePoolPop(pool);
		return nil;
	}

	@try {
		for (size_t i = 0; nameindex[i].if_index != 0; i++)
			[ret addObject: [OFString
			    stringWithCString: nameindex[i].if_name
				     encoding: encoding]];








	} @finally {
		if_freenameindex(nameindex);
	}

	[ret makeImmutable];

	objc_autoreleasePoolPop(pool);







|


|










|
|

|
>
>
>
>
>
>
>
>







839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
+ (bool)isWindowsNT
{
	return !(GetVersion() & 0x80000000);
}
#endif

#ifdef OF_HAVE_SOCKETS
+ (OFDictionary OF_GENERIC(OFString *, OFNetworkInterface) *)networkInterfaces
{
# ifdef HAVE_IF_NAMEINDEX
	OFMutableDictionary *ret = [OFMutableDictionary dictionary];
	void *pool = objc_autoreleasePoolPush();
	OFStringEncoding encoding = [OFLocale encoding];
	struct if_nameindex *nameindex = if_nameindex();

	if (nameindex == NULL) {
		objc_autoreleasePoolPop(pool);
		return nil;
	}

	@try {
		for (size_t i = 0; nameindex[i].if_index != 0; i++) {
			OFString *name = [OFString
			    stringWithCString: nameindex[i].if_name
				     encoding: encoding];
			OFNumber *index = [OFNumber
			    numberWithUnsignedInt: nameindex[i].if_index];
			OFDictionary *interface = [OFDictionary
			    dictionaryWithObject: index
					  forKey: OFNetworkInterfaceIndex];

			[ret setObject: interface forKey: name];
		}
	} @finally {
		if_freenameindex(nameindex);
	}

	[ret makeImmutable];

	objc_autoreleasePoolPop(pool);