ObjFW  Check-in [b34c78251b]

Overview
Comment:Add of_ascii_isdigit()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b34c78251ba94656f6696a21068a65d0a0473f21c136f8b6b0485870705a679c
User & Date: js on 2018-02-16 23:58:54
Other Links: manifest | tags
Context
2018-02-17
00:06
configure: Do not enable -Wshadow for Nintendo DS check-in: 8a2f1b9dfb user: js tags: trunk
2018-02-16
23:58
Add of_ascii_isdigit() check-in: b34c78251b user: js tags: trunk
23:25
TestsAppDelegate: Fix #ifdef check-in: 248fd739a5 user: js tags: trunk
Changes

Modified src/OFMethodSignature.m from [c051dfe1af] to [dd63fb02de].

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	size_t align;

	assert(*length > 0);

	(*type)++;
	(*length)--;

	while (*length > 0 && isdigit(**type)) {
		(*type)++;
		(*length)--;
	}

	align = alignofEncoding(type, length, true);

	if (*length == 0 || **type != ']')







|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	size_t align;

	assert(*length > 0);

	(*type)++;
	(*length)--;

	while (*length > 0 && of_ascii_isdigit(**type)) {
		(*type)++;
		(*length)--;
	}

	align = alignofEncoding(type, length, true);

	if (*length == 0 || **type != ']')
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
	size_t size;

	assert(*length > 0);

	(*type)++;
	(*length)--;

	while (*length > 0 && isdigit(**type)) {
		count = count * 10 + **type - '0';

		(*type)++;
		(*length)--;
	}

	if (count == 0)







|







290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
	size_t size;

	assert(*length > 0);

	(*type)++;
	(*length)--;

	while (*length > 0 && of_ascii_isdigit(**type)) {
		count = count * 10 + **type - '0';

		(*type)++;
		(*length)--;
	}

	if (count == 0)
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621

622
623
624
625
626
627
628
		_typesPointers = [[OFMutableData alloc]
		    initWithItemSize: sizeof(char *)];
		_offsets = [[OFMutableData alloc]
		    initWithItemSize: sizeof(size_t)];

		last = _types;
		for (size_t i = 0; i < length; i++) {
			if (isdigit(_types[i])) {
				size_t offset = _types[i] - '0';

				if (last == _types + i)
					@throw [OFInvalidFormatException
					    exception];

				_types[i] = '\0';
				[_typesPointers addItem: &last];

				i++;
				for (; i < length && isdigit(_types[i]); i++)

					offset = offset * 10 + _types[i] - '0';

				[_offsets addItem: &offset];

				last = _types + i;
				i--;
			} else if (_types[i] == '{') {







|










|
>







603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
		_typesPointers = [[OFMutableData alloc]
		    initWithItemSize: sizeof(char *)];
		_offsets = [[OFMutableData alloc]
		    initWithItemSize: sizeof(size_t)];

		last = _types;
		for (size_t i = 0; i < length; i++) {
			if (of_ascii_isdigit(_types[i])) {
				size_t offset = _types[i] - '0';

				if (last == _types + i)
					@throw [OFInvalidFormatException
					    exception];

				_types[i] = '\0';
				[_typesPointers addItem: &last];

				i++;
				for (; i < length &&
				    of_ascii_isdigit(_types[i]); i++)
					offset = offset * 10 + _types[i] - '0';

				[_offsets addItem: &offset];

				last = _types + i;
				i--;
			} else if (_types[i] == '{') {

Modified src/macros.h from [579cf46e72] to [0a54ffbbce].

826
827
828
829
830
831
832






833
834
835
836
837
838
839
840
841
842
843
844
}

static OF_INLINE bool
of_ascii_isalpha(char c)
{
	return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
}







static OF_INLINE bool
of_ascii_isalnum(char c)
{
	return (of_ascii_isalpha(c) || (c >= '0' && c <= '9'));
}

static OF_INLINE bool
of_ascii_isspace(char c)
{
	return (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' ||
	    c == '\v');







>
>
>
>
>
>




|







826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
}

static OF_INLINE bool
of_ascii_isalpha(char c)
{
	return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
}

static OF_INLINE bool
of_ascii_isdigit(char c)
{
	return (c >= '0' && c <= '9');
}

static OF_INLINE bool
of_ascii_isalnum(char c)
{
	return (of_ascii_isalpha(c) || of_ascii_isdigit(c));
}

static OF_INLINE bool
of_ascii_isspace(char c)
{
	return (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' ||
	    c == '\v');