ObjFW  Check-in [1e9a23441b]

Overview
Comment:OFString+JSONValue: Remove restrict

It makes no sense here.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1e9a23441b063a83c3592470cfc0409e85758df359d30f6affeaa3bbce6c206b
User & Date: js on 2016-05-29 14:34:35
Other Links: manifest | tags
Context
2016-05-29
14:41
OFDeflate64Stream: Fix window size check-in: 24338bc6c9 user: js tags: trunk
14:34
OFString+JSONValue: Remove restrict check-in: 1e9a23441b user: js tags: trunk
14:15
OFDeflateStream: Separate ivars by (de)compression check-in: e9e89aa4c0 user: js tags: trunk
Changes

Modified src/OFString+JSONValue.m from [0e3855dae5] to [eaa788e234].

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#import "OFNumber.h"
#import "OFNull.h"

#import "OFInvalidJSONException.h"

int _OFString_JSONValue_reference;

static id nextObject(const char *restrict *, const char*,
    size_t *restrict line, size_t depth, size_t depthLimit);

static void
skipWhitespaces(const char *restrict *pointer, const char *stop,
    size_t *restrict line)
{
	while (*pointer < stop && (**pointer == ' ' || **pointer == '\t' ||
	    **pointer == '\r' || **pointer == '\n')) {
		if (**pointer == '\n')
			(*line)++;

		(*pointer)++;
	}
}

static void
skipComment(const char *restrict *pointer, const char *stop,
    size_t *restrict line)
{
	if (**pointer != '/')
		return;

	if (*pointer + 1 >= stop)
		return;








|
|


|
<











|
<







29
30
31
32
33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
#import "OFNumber.h"
#import "OFNull.h"

#import "OFInvalidJSONException.h"

int _OFString_JSONValue_reference;

static id nextObject(const char **pointer, const char *stop, size_t *line,
    size_t depth, size_t depthLimit);

static void
skipWhitespaces(const char **pointer, const char *stop, size_t *line)

{
	while (*pointer < stop && (**pointer == ' ' || **pointer == '\t' ||
	    **pointer == '\r' || **pointer == '\n')) {
		if (**pointer == '\n')
			(*line)++;

		(*pointer)++;
	}
}

static void
skipComment(const char **pointer, const char *stop, size_t *line)

{
	if (**pointer != '/')
		return;

	if (*pointer + 1 >= stop)
		return;

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
			(*pointer)++;
		}
	} else
		(*pointer)--;
}

static void
skipWhitespacesAndComments(const char *restrict *pointer, const char *stop,
    size_t *restrict line)
{
	const char *old = NULL;

	while (old != *pointer) {
		old = *pointer;

		skipWhitespaces(pointer, stop, line);







|
<







90
91
92
93
94
95
96
97

98
99
100
101
102
103
104
			(*pointer)++;
		}
	} else
		(*pointer)--;
}

static void
skipWhitespacesAndComments(const char **pointer, const char *stop, size_t *line)

{
	const char *old = NULL;

	while (old != *pointer) {
		old = *pointer;

		skipWhitespaces(pointer, stop, line);
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
	if (ret == 0)
		return 0xFFFF;

	return ret;
}

static inline OFString*
parseString(const char *restrict *pointer, const char *stop,
    size_t *restrict line)
{
	char *buffer;
	size_t i = 0;
	char delimiter = **pointer;

	if (++(*pointer) + 1 >= stop)
		return nil;







|
<







134
135
136
137
138
139
140
141

142
143
144
145
146
147
148
	if (ret == 0)
		return 0xFFFF;

	return ret;
}

static inline OFString*
parseString(const char **pointer, const char *stop, size_t *line)

{
	char *buffer;
	size_t i = 0;
	char delimiter = **pointer;

	if (++(*pointer) + 1 >= stop)
		return nil;
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
	}

	free(buffer);
	return nil;
}

static inline OFString*
parseIdentifier(const char *restrict *pointer, const char *stop)
{
	char *buffer;
	size_t i = 0;

	if ((buffer = malloc(stop - *pointer)) == NULL)
		return nil;








|







285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
	}

	free(buffer);
	return nil;
}

static inline OFString*
parseIdentifier(const char **pointer, const char *stop)
{
	char *buffer;
	size_t i = 0;

	if ((buffer = malloc(stop - *pointer)) == NULL)
		return nil;

389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
	 * It is never possible to end with an identifier, thus we should never
	 * reach stop.
	 */
	return nil;
}

static inline OFMutableArray*
parseArray(const char *restrict *pointer, const char *stop,
    size_t *restrict line, size_t depth, size_t depthLimit)
{
	OFMutableArray *array = [OFMutableArray array];

	if (++(*pointer) >= stop)
		return nil;

	if (++depth > depthLimit)







|
|







385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
	 * It is never possible to end with an identifier, thus we should never
	 * reach stop.
	 */
	return nil;
}

static inline OFMutableArray*
parseArray(const char **pointer, const char *stop, size_t *line,
    size_t depth, size_t depthLimit)
{
	OFMutableArray *array = [OFMutableArray array];

	if (++(*pointer) >= stop)
		return nil;

	if (++depth > depthLimit)
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461

	(*pointer)++;

	return array;
}

static inline OFMutableDictionary*
parseDictionary(const char *restrict *pointer, const char *stop,
    size_t *restrict line, size_t depth, size_t depthLimit)
{
	OFMutableDictionary *dictionary = [OFMutableDictionary dictionary];

	if (++(*pointer) >= stop)
		return nil;

	if (++depth > depthLimit)







|
|







442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457

	(*pointer)++;

	return array;
}

static inline OFMutableDictionary*
parseDictionary(const char **pointer, const char *stop, size_t *line,
    size_t depth, size_t depthLimit)
{
	OFMutableDictionary *dictionary = [OFMutableDictionary dictionary];

	if (++(*pointer) >= stop)
		return nil;

	if (++depth > depthLimit)
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540

	(*pointer)++;

	return dictionary;
}

static inline OFNumber*
parseNumber(const char *restrict *pointer, const char *stop,
    size_t *restrict line)
{
	bool isHex = (*pointer + 1 < stop && (*pointer)[1] == 'x');
	bool hasDecimal = false;
	size_t i;
	OFString *string;
	OFNumber *number;








|
<







521
522
523
524
525
526
527
528

529
530
531
532
533
534
535

	(*pointer)++;

	return dictionary;
}

static inline OFNumber*
parseNumber(const char **pointer, const char *stop, size_t *line)

{
	bool isHex = (*pointer + 1 < stop && (*pointer)[1] == 'x');
	bool hasDecimal = false;
	size_t i;
	OFString *string;
	OFNumber *number;

575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
		[string release];
	}

	return number;
}

static id
nextObject(const char *restrict *pointer, const char *stop,
    size_t *restrict line, size_t depth, size_t depthLimit)
{
	skipWhitespacesAndComments(pointer, stop, line);

	if (*pointer >= stop)
		return nil;

	switch (**pointer) {







|
|







570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
		[string release];
	}

	return number;
}

static id
nextObject(const char **pointer, const char *stop, size_t *line,
    size_t depth, size_t depthLimit)
{
	skipWhitespacesAndComments(pointer, stop, line);

	if (*pointer >= stop)
		return nil;

	switch (**pointer) {