ObjIRC  Check-in [3e008e2964]

Overview
Comment:Don't use private ObjFW functions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3e008e29646a6eaeccbc4560352d3444691e9bee4da9ef70be30408df6ecb4b1
User & Date: js on 2024-08-17 00:19:23
Other Links: manifest | tags
Context
2024-08-17
00:20
More consistent naming check-in: 58b8dc229f user: js tags: trunk
00:19
Don't use private ObjFW functions check-in: 3e008e2964 user: js tags: trunk
2024-05-04
21:35
Add "make check" check-in: 685fcf4c95 user: js tags: trunk
Changes

Modified src/IRCUser.m from [9205d72fe3] to [9f27229e45].

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

58
59
60

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
+ (instancetype)IRCUserWithString: (OFString *)string
{
	return [[[self alloc] initWithString: string] autorelease];
}

- (instancetype)initWithString: (OFString *)string
{
	char *tmp2 = NULL;

	self = [super init];

	@try {
		char *tmp;

		tmp2 = OFStrDup(string.UTF8String);

		if ((tmp = strchr(tmp2, '@')) == NULL)
			@throw [OFInvalidFormatException exception];


		*tmp = '\0';
		_hostname = [[OFString alloc] initWithUTF8String: tmp + 1];


		if ((tmp = strchr(tmp2, '!')) == NULL)
			@throw [OFInvalidFormatException exception];

		*tmp = '\0';
		_username = [[OFString alloc] initWithUTF8String: tmp + 1];

		_nickname = [[OFString alloc] initWithUTF8String: tmp2];
	} @catch (id e) {
		[self release];
		@throw e;
	} @finally {
		if (tmp2 != NULL)
			free(tmp2);
	}

	return self;
}

- (void)dealloc
{







<
<



|

|
|
<


>
|
|

>
|


<
<
|
|



<
<
<







39
40
41
42
43
44
45


46
47
48
49
50
51
52

53
54
55
56
57
58
59
60
61
62


63
64
65
66
67



68
69
70
71
72
73
74
+ (instancetype)IRCUserWithString: (OFString *)string
{
	return [[[self alloc] initWithString: string] autorelease];
}

- (instancetype)initWithString: (OFString *)string
{


	self = [super init];

	@try {
		size_t pos;

		pos = [string rangeOfString: @"@"].location;
		if (pos == OFNotFound)

			@throw [OFInvalidFormatException exception];

		_hostname = [[string substringFromIndex: pos + 1] copy];

		string = [string substringToIndex: pos];

		pos = [string rangeOfString: @"!"].location;
		if (pos == OFNotFound)
			@throw [OFInvalidFormatException exception];



		_username = [[string substringFromIndex: pos + 1] copy];
		_nickname = [[string substringToIndex: pos] copy];
	} @catch (id e) {
		[self release];
		@throw e;



	}

	return self;
}

- (void)dealloc
{