1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
|
From 408e7dfaf2eb735804f62728de679972867c30d5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 3 May 2021 13:53:10 -0700
Subject: [PATCH] replace __pure__ with compiler attribute 'pure'
Remove defining __deprecated__
Upstream-Status: OE-Specific [Untested with dietlibc]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
byte.h | 22 ++++++----
critbit.h | 12 ++++--
fmt.h | 100 +++++++++++++++++++++++---------------------
str.h | 22 ++++++----
stralloc.h | 20 +++++----
5 files changed, 103 insertions(+), 73 deletions(-)
--- a/byte.h
+++ b/byte.h
@@ -2,6 +2,16 @@
#ifndef BYTE_H
#define BYTE_H
+#ifndef __has_attribute
+ #define __has_attribute(x) 0
+#endif
+
+#if __has_attribute(pure)
+#define __PURE __attribute__ ((pure))
+#else
+#define __PURE
+#endif
+
/* for size_t: */
#include <stddef.h>
@@ -9,17 +19,13 @@
extern "C" {
#endif
-#ifndef __pure__
-#define __pure__
-#endif
-
/* byte_chr returns the smallest integer i between 0 and len-1
* inclusive such that one[i] equals needle, or len if not found. */
-size_t byte_chr(const void* haystack, size_t len, char needle) __pure__;
+size_t byte_chr(const void* haystack, size_t len, char needle) __PURE;
/* byte_rchr returns the largest integer i between 0 and len-1 inclusive
* such that one[i] equals needle, or len if not found. */
-size_t byte_rchr(const void* haystack,size_t len,char needle) __pure__;
+size_t byte_rchr(const void* haystack,size_t len,char needle) __PURE;
/* byte_copy copies in[0] to out[0], in[1] to out[1], ... and in[len-1]
* to out[len-1]. */
@@ -34,14 +40,14 @@ void byte_copyr(void* out, size_t len, c
* than, equal to, or greater than the string b[0], b[1], ...,
* b[len-1]. When the strings are different, byte_diff does not read
* bytes past the first difference. */
-int byte_diff(const void* a, size_t len, const void* b) __pure__;
+int byte_diff(const void* a, size_t len, const void* b) __PURE;
/* byte_zero sets the bytes out[0], out[1], ..., out[len-1] to 0 */
void byte_zero(void* out, size_t len);
#define byte_equal(s,n,t) (!byte_diff((s),(n),(t)))
-int byte_equal_notimingattack(const void* a, size_t len,const void* b) __pure__;
+int byte_equal_notimingattack(const void* a, size_t len,const void* b) __PURE;
#if defined(__i386__) || defined(__x86_64__)
#define UNALIGNED_ACCESS_OK
--- a/critbit.h
+++ b/critbit.h
@@ -8,15 +8,21 @@ extern "C" {
/* for __pure__ if we are compiling under dietlibc */
#include <stddef.h>
-#ifndef __pure__
-#define __pure__
+#ifndef __has_attribute
+ #define __has_attribute(x) 0
+#endif
+
+#if __has_attribute(pure)
+#define __PURE __attribute__ ((pure))
+#else
+#define __PURE
#endif
typedef struct {
void *root;
} critbit0_tree;
-int critbit0_contains(critbit0_tree *t, const char *u) __pure__;
+int critbit0_contains(critbit0_tree *t, const char *u) __PURE;
int critbit0_insert(critbit0_tree *t, const char *u);
int critbit0_delete(critbit0_tree *t, const char *u);
void critbit0_clear(critbit0_tree *t);
--- a/fmt.h
+++ b/fmt.h
@@ -2,6 +2,16 @@
#ifndef FMT_H
#define FMT_H
+#ifndef __has_attribute
+ #define __has_attribute(x) 0
+#endif
+
+#if __has_attribute(pure)
+#define __PURE __attribute__ ((pure))
+#else
+#define __PURE
+#endif
+
/* for size_t: */
#include <stddef.h>
/* for uint32_t */
@@ -15,10 +25,6 @@
extern "C" {
#endif
-#ifndef __pure__
-#define __pure__
-#endif
-
#define FMT_LONG 41 /* enough space to hold -2^127 in decimal, plus \0 */
#define FMT_ULONG 40 /* enough space to hold 2^128 - 1 in decimal, plus \0 */
#define FMT_8LONG 44 /* enough space to hold 2^128 - 1 in octal, plus \0 */
@@ -46,31 +52,31 @@ extern "C" {
/* convert signed src integer -23 to ASCII '-','2','3', return number of
* bytes of value in output format (3 in this example).
* If dest is not NULL, write result to dest */
-size_t fmt_long(char *dest,signed long src) __pure__;
+size_t fmt_long(char *dest,signed long src) __PURE;
/* convert unsigned src integer 23 to ASCII '2','3', return number of
* bytes of value in output format (2 in this example).
* If dest is not NULL, write result to dest */
-size_t fmt_ulong(char *dest,unsigned long src) __pure__;
+size_t fmt_ulong(char *dest,unsigned long src) __PURE;
/* convert unsigned src integer 0x23 to ASCII '2','3', return number of
* bytes of value in output format (2 in this example).
* If dest is not NULL, write result to dest */
-size_t fmt_xlong(char *dest,unsigned long src) __pure__;
+size_t fmt_xlong(char *dest,unsigned long src) __PURE;
/* convert unsigned src integer 023 to ASCII '2','3', return number of
* bytes of value in output format (2 in this example).
* If dest is not NULL, write result to dest */
-size_t fmt_8long(char *dest,unsigned long src) __pure__;
+size_t fmt_8long(char *dest,unsigned long src) __PURE;
/* like fmt_long but for long long */
-size_t fmt_longlong(char *dest,signed long long src) __pure__;
+size_t fmt_longlong(char *dest,signed long long src) __PURE;
/* like fmt_ulong but for unsigned long long */
-size_t fmt_ulonglong(char *dest,unsigned long long src) __pure__;
+size_t fmt_ulonglong(char *dest,unsigned long long src) __PURE;
/* like fmt_xlong but for unsigned long long */
-size_t fmt_xlonglong(char *dest,unsigned long long src) __pure__;
+size_t fmt_xlonglong(char *dest,unsigned long long src) __PURE;
#define fmt_uint(dest,src) fmt_ulong(dest,src)
#define fmt_int(dest,src) fmt_long(dest,src)
@@ -81,22 +87,22 @@ size_t fmt_xlonglong(char *dest,unsigned
* Does not truncate! */
/* fmt_ulong0(buf,23,4) -> '0','0','2','3' return 4 */
/* fmt_ulong0(buf,234,2) -> '2','3','4', return 3 */
-size_t fmt_ulong0(char *,unsigned long src,size_t padto) __pure__;
+size_t fmt_ulong0(char *,unsigned long src,size_t padto) __PURE;
#define fmt_uint0(buf,src,padto) fmt_ulong0(buf,src,padto)
/* convert src double 1.7 to ASCII '1','.','7', return length.
* If dest is not NULL, write result to dest */
-size_t fmt_double(char *dest, double d,int max,int prec) __pure__;
+size_t fmt_double(char *dest, double d,int max,int prec) __PURE;
/* if src is negative, write '-' and return 1.
* if src is positive, write '+' and return 1.
* otherwise return 0 */
-size_t fmt_plusminus(char *dest,int src) __pure__;
+size_t fmt_plusminus(char *dest,int src) __PURE;
/* if src is negative, write '-' and return 1.
* otherwise return 0. */
-size_t fmt_minus(char *dest,int src) __pure__;
+size_t fmt_minus(char *dest,int src) __PURE;
/* copy str to dest until \0 byte, return number of copied bytes. */
/* fmt_str(NULL,str) == strlen(str) */
@@ -108,11 +114,11 @@ size_t fmt_minus(char *dest,int src) __p
* This is more efficient because strcat needs to scan the string to
* find the end and append.
*/
-size_t fmt_str(char *dest,const char *src) __pure__;
+size_t fmt_str(char *dest,const char *src) __PURE;
/* copy str to dest until \0 byte or limit bytes copied.
* return number of copied bytes. */
-size_t fmt_strn(char *dest,const char *src,size_t limit) __pure__;
+size_t fmt_strn(char *dest,const char *src,size_t limit) __PURE;
/* copy n bytes from src to dest, return n */
static inline size_t fmt_copybytes(char* dest,const char* src,size_t n) {
@@ -124,56 +130,56 @@ static inline size_t fmt_copybytes(char*
* write padlen-srclen spaces, if that is >= 0. Then copy srclen
* characters from src. Truncate only if total length is larger than
* maxlen. Return number of characters written. */
-size_t fmt_pad(char* dest,const char* src,size_t srclen,size_t padlen,size_t maxlen) __pure__;
+size_t fmt_pad(char* dest,const char* src,size_t srclen,size_t padlen,size_t maxlen) __PURE;
/* "foo" -> "foo "
* append padlen-srclen spaces after dest, if that is >= 0. Truncate
* only if total length is larger than maxlen. Return number of
* characters written. */
-size_t fmt_fill(char* dest,size_t srclen,size_t padlen,size_t maxlen) __pure__;
+size_t fmt_fill(char* dest,size_t srclen,size_t padlen,size_t maxlen) __PURE;
/* 1 -> "1", 4900 -> "4.9k", 2300000 -> "2.3M" */
-size_t fmt_human(char* dest,unsigned long long l) __pure__;
+size_t fmt_human(char* dest,unsigned long long l) __PURE;
/* 1 -> "1", 4900 -> "4.8k", 2300000 -> "2.2M" */
-size_t fmt_humank(char* dest,unsigned long long l) __pure__;
+size_t fmt_humank(char* dest,unsigned long long l) __PURE;
/* "Sun, 06 Nov 1994 08:49:37 GMT" */
size_t fmt_httpdate(char* dest,time_t t); /* not marked pure because it calls gmtime */
/* "2014-05-27T19:22:16.247Z" */
-size_t fmt_iso8601(char* dest,time_t t) __pure__;
+size_t fmt_iso8601(char* dest,time_t t) __PURE;
#define FMT_UTF8 5
#define FMT_ASN1LENGTH 17 /* enough space to hold 2^128-1 */
#define FMT_ASN1TAG 19 /* enough space to hold 2^128-1 */
/* some variable length encodings for integers */
-size_t fmt_utf8(char* dest,uint32_t n) __pure__; /* can store 0-0x7fffffff */
-size_t fmt_asn1derlength(char* dest,unsigned long long l) __pure__; /* 0-0x7f: 1 byte, above that 1+bytes_needed bytes */
-size_t fmt_asn1dertag(char* dest,unsigned long long l) __pure__; /* 1 byte for each 7 bits; upper bit = more bytes coming */
+size_t fmt_utf8(char* dest,uint32_t n) __PURE; /* can store 0-0x7fffffff */
+size_t fmt_asn1derlength(char* dest,unsigned long long l) __PURE; /* 0-0x7f: 1 byte, above that 1+bytes_needed bytes */
+size_t fmt_asn1dertag(char* dest,unsigned long long l) __PURE; /* 1 byte for each 7 bits; upper bit = more bytes coming */
/* Google Protocol Buffers, https://developers.google.com/protocol-buffers/docs/encoding */
-size_t fmt_varint(char* dest,unsigned long long l) __pure__; /* protocol buffers encoding; like asn1dertag but little endian */
-size_t fmt_pb_tag(char* dest,size_t fieldno,unsigned char type) __pure__; /* protocol buffer tag */
-size_t fmt_pb_type0_int(char* dest,unsigned long long l) __pure__; /* protocol buffers encoding: type 0 bool/enum/int32/uint32/int64/uint64 */
-size_t fmt_pb_type0_sint(char* dest,signed long long l) __pure__;/* protocol buffers encoding: type 0 sint32/sint64 */
-size_t fmt_pb_type1_double(char* dest,double d) __pure__; /* protocol buffers encoding: double (64-bit little endian blob) */
-size_t fmt_pb_type1_fixed64(char* dest,uint64_t l) __pure__; /* protocol buffers encoding: 64-bit little endian blob */
+size_t fmt_varint(char* dest,unsigned long long l) __PURE; /* protocol buffers encoding; like asn1dertag but little endian */
+size_t fmt_pb_tag(char* dest,size_t fieldno,unsigned char type) __PURE; /* protocol buffer tag */
+size_t fmt_pb_type0_int(char* dest,unsigned long long l) __PURE; /* protocol buffers encoding: type 0 bool/enum/int32/uint32/int64/uint64 */
+size_t fmt_pb_type0_sint(char* dest,signed long long l) __PURE;/* protocol buffers encoding: type 0 sint32/sint64 */
+size_t fmt_pb_type1_double(char* dest,double d) __PURE; /* protocol buffers encoding: double (64-bit little endian blob) */
+size_t fmt_pb_type1_fixed64(char* dest,uint64_t l) __PURE; /* protocol buffers encoding: 64-bit little endian blob */
/* fmt_pb_type2_string can return 0 if (s,l) is clearly invalid */
-size_t fmt_pb_type2_string(char* dest,const char* s,size_t l) __pure__; /* protocol buffers encoding: varint length + blob */
-size_t fmt_pb_type5_float(char* dest,float f) __pure__; /* protocol buffers encoding: float (32-bit little endian blob) */
-size_t fmt_pb_type5_fixed32(char* dest,uint32_t l) __pure__; /* protocol buffers encoding: 32-bit little endian blob */
-
-size_t fmt_pb_int(char* dest,size_t fieldno,unsigned long long l) __pure__;
-size_t fmt_pb_sint(char* dest,size_t fieldno,signed long long l) __pure__;
-size_t fmt_pb_double(char* dest,size_t fieldno,double d) __pure__;
-size_t fmt_pb_float(char* dest,size_t fieldno,float f) __pure__;
-size_t fmt_pb_string(char* dest,size_t fieldno,const char* s,size_t l) __pure__;
+size_t fmt_pb_type2_string(char* dest,const char* s,size_t l) __PURE; /* protocol buffers encoding: varint length + blob */
+size_t fmt_pb_type5_float(char* dest,float f) __PURE; /* protocol buffers encoding: float (32-bit little endian blob) */
+size_t fmt_pb_type5_fixed32(char* dest,uint32_t l) __PURE; /* protocol buffers encoding: 32-bit little endian blob */
+
+size_t fmt_pb_int(char* dest,size_t fieldno,unsigned long long l) __PURE;
+size_t fmt_pb_sint(char* dest,size_t fieldno,signed long long l) __PURE;
+size_t fmt_pb_double(char* dest,size_t fieldno,double d) __PURE;
+size_t fmt_pb_float(char* dest,size_t fieldno,float f) __PURE;
+size_t fmt_pb_string(char* dest,size_t fieldno,const char* s,size_t l) __PURE;
/* fmt_netstring can return 0 if (src,len) is clearly invalid */
-size_t fmt_netstring(char* dest,const char* src,size_t len) __pure__;
+size_t fmt_netstring(char* dest,const char* src,size_t len) __PURE;
/* Marshaling helper functions.
* Escape one character, no matter if it needs escaping or not.
@@ -185,27 +191,27 @@ size_t fmt_netstring(char* dest,const ch
* unicode codepoint) may be limited to 0x7f, 0xff or 0x10ffff. */
/* XML escaping: '&' -> '&', '<' -> '<', 'ö' -> 'ö' */
-size_t fmt_escapecharxml(char* dest,uint32_t ch) __pure__;
+size_t fmt_escapecharxml(char* dest,uint32_t ch) __PURE;
/* HTML escaping is the same as XML escaping. */
-size_t fmt_escapecharhtml(char* dest,uint32_t ch) __pure__;
+size_t fmt_escapecharhtml(char* dest,uint32_t ch) __PURE;
/* JSON escaping: '\' -> '\\', '"' -> '\"', 'ö' -> '\u00f6' */
-size_t fmt_escapecharjson(char* dest,uint32_t ch) __pure__;
+size_t fmt_escapecharjson(char* dest,uint32_t ch) __PURE;
/* MIME quoted-printable escaping: 'ö' -> '=f6', characters > 0xff not supported */
-size_t fmt_escapecharquotedprintable(char* dest,uint32_t ch) __pure__;
+size_t fmt_escapecharquotedprintable(char* dest,uint32_t ch) __PURE;
/* MIME quoted-printable escaping with UTF-8: 'ö' -> '=c3=b6', characters > 0x7fffffff not supported */
-size_t fmt_escapecharquotedprintableutf8(char* dest,uint32_t ch) __pure__;
+size_t fmt_escapecharquotedprintableutf8(char* dest,uint32_t ch) __PURE;
/* C99 style escaping: '\' -> '\\', newline -> '\n', 0xc2 -> '\302' */
-size_t fmt_escapecharc(char* dest,uint32_t ch) __pure__;
+size_t fmt_escapecharc(char* dest,uint32_t ch) __PURE;
/* internal functions, may be independently useful */
char fmt_tohex(char c) __attribute__((__const__));
#define fmt_strm(b,...) fmt_strm_internal(b,__VA_ARGS__,(char*)0)
-size_t fmt_strm_internal(char* dest,...) __pure__;
+size_t fmt_strm_internal(char* dest,...) __PURE;
#ifndef MAX_ALLOCA
#define MAX_ALLOCA 100000
--- a/str.h
+++ b/str.h
@@ -8,8 +8,14 @@
extern "C" {
#endif
-#ifndef __pure__
-#define __pure__
+#ifndef __has_attribute
+ #define __has_attribute(x) 0
+#endif
+
+#if __has_attribute(pure)
+#define __PURE __attribute__ ((pure))
+#else
+#define __PURE
#endif
/* str_copy copies leading bytes from in to out until \0.
@@ -21,7 +27,7 @@ size_t str_copy(char *out,const char *in
* equal to, or greater than the string b[0], b[1], ..., b[m-1]=='\0'.
* If the strings are different, str_diff does not read bytes past the
* first difference. */
-int str_diff(const char *a,const char *b) __pure__;
+int str_diff(const char *a,const char *b) __PURE;
/* str_diffn returns negative, 0, or positive, depending on whether the
* string a[0], a[1], ..., a[n]=='\0' is lexicographically smaller than,
@@ -29,24 +35,24 @@ int str_diff(const char *a,const char *b
* If the strings are different, str_diffn does not read bytes past the
* first difference. The strings will be considered equal if the first
* limit characters match. */
-int str_diffn(const char *a,const char *b,size_t limit) __pure__;
+int str_diffn(const char *a,const char *b,size_t limit) __PURE;
#ifdef __dietlibc__
#include <string.h>
#define str_len(foo) strlen(foo)
#else
/* str_len returns the index of \0 in s */
-size_t str_len(const char *s) __pure__;
+size_t str_len(const char *s) __PURE;
#endif
/* str_chr returns the index of the first occurance of needle or \0 in haystack */
-size_t str_chr(const char *haystack,char needle) __pure__;
+size_t str_chr(const char *haystack,char needle) __PURE;
/* str_rchr returns the index of the last occurance of needle or \0 in haystack */
-size_t str_rchr(const char *haystack,char needle) __pure__;
+size_t str_rchr(const char *haystack,char needle) __PURE;
/* str_start returns 1 if the b is a prefix of a, 0 otherwise */
-int str_start(const char *a,const char *b) __pure__;
+int str_start(const char *a,const char *b) __PURE;
/* convenience shortcut to test for string equality */
#define str_equal(s,t) (!str_diff((s),(t)))
--- a/stralloc.h
+++ b/stralloc.h
@@ -2,16 +2,22 @@
#ifndef STRALLOC_H
#define STRALLOC_H
+#ifndef __has_attribute
+ #define __has_attribute(x) 0
+#endif
+
+#if __has_attribute(pure)
+#define __PURE __attribute__ ((pure))
+#else
+#define __PURE
+#endif
+
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef __pure__
-#define __pure__
-#endif
-
/* stralloc is the internal data structure all functions are working on.
* s is the string.
* len is the used length of the string.
@@ -101,17 +107,17 @@ static inline int stralloc_APPEND(strall
/* stralloc_starts returns 1 if the \0-terminated string in "in", without
* the terminating \0, is a prefix of the string stored in sa. Otherwise
* it returns 0. sa must already be allocated. */
-int stralloc_starts(stralloc* sa,const char* in) __pure__;
+int stralloc_starts(stralloc* sa,const char* in) __PURE;
/* stralloc_diff returns negative, 0, or positive, depending on whether
* a is lexicographically smaller than, equal to, or greater than the
* string b. */
-int stralloc_diff(const stralloc* a,const stralloc* b) __pure__;
+int stralloc_diff(const stralloc* a,const stralloc* b) __PURE;
/* stralloc_diffs returns negative, 0, or positive, depending on whether
* a is lexicographically smaller than, equal to, or greater than the
* string b[0], b[1], ..., b[n]=='\0'. */
-int stralloc_diffs(const stralloc* a,const char* b) __pure__;
+int stralloc_diffs(const stralloc* a,const char* b) __PURE;
#define stralloc_equal(a,b) (!stralloc_diff((a),(b)))
#define stralloc_equals(a,b) (!stralloc_diffs((a),(b)))
--- a/scan.h
+++ b/scan.h
@@ -15,8 +15,14 @@
extern "C" {
#endif
-#ifndef __pure__
-#define __pure__
+#ifndef __has_attribute
+ #define __has_attribute(x) 0
+#endif
+
+#if __has_attribute(pure)
+#define __PURE __attribute__ ((pure))
+#else
+#define __PURE
#endif
/* This file declared functions used to decode / scan / unmarshal
@@ -84,18 +90,18 @@ size_t scan_double(const char *in, doubl
size_t scan_plusminus(const char *src,signed int *dest);
/* return the highest integer n<=limit so that isspace(in[i]) for all 0<=i<=n */
-size_t scan_whitenskip(const char *in,size_t limit) __pure__;
+size_t scan_whitenskip(const char *in,size_t limit) __PURE;
/* return the highest integer n<=limit so that !isspace(in[i]) for all 0<=i<=n */
-size_t scan_nonwhitenskip(const char *in,size_t limit) __pure__;
+size_t scan_nonwhitenskip(const char *in,size_t limit) __PURE;
/* return the highest integer n<=limit so that in[i] is element of
* charset (ASCIIZ string) for all 0<=i<=n */
-size_t scan_charsetnskip(const char *in,const char *charset,size_t limit) __pure__;
+size_t scan_charsetnskip(const char *in,const char *charset,size_t limit) __PURE;
/* return the highest integer n<=limit so that in[i] is not element of
* charset (ASCIIZ string) for all 0<=i<=n */
-size_t scan_noncharsetnskip(const char *in,const char *charset,size_t limit) __pure__;
+size_t scan_noncharsetnskip(const char *in,const char *charset,size_t limit) __PURE;
/* try to parse ASCII GMT date; does not understand time zones. */
/* example dates:
@@ -103,17 +109,17 @@ size_t scan_noncharsetnskip(const char *
* "Sunday, 06-Nov-94 08:49:37 GMT"
* "Sun Nov 6 08:49:37 1994"
*/
-size_t scan_httpdate(const char *in,time_t *t) __pure__;
+size_t scan_httpdate(const char *in,time_t *t) __PURE;
/* try to parse ASCII ISO-8601 date; does not understand time zones. */
/* example date: "2014-05-27T19:22:16Z" */
-size_t scan_iso8601(const char* in,struct timespec* t) __pure__;
+size_t scan_iso8601(const char* in,struct timespec* t) __PURE;
/* some variable length encodings for integers */
-size_t scan_utf8(const char* in,size_t len,uint32_t* n) __pure__;
-size_t scan_utf8_sem(const char* in,size_t len,uint32_t* n) __pure__;
-size_t scan_asn1derlength(const char* in,size_t len,unsigned long long* n) __pure__;
-size_t scan_asn1dertag(const char* in,size_t len,unsigned long long* n) __pure__;
+size_t scan_utf8(const char* in,size_t len,uint32_t* n) __PURE;
+size_t scan_utf8_sem(const char* in,size_t len,uint32_t* n) __PURE;
+size_t scan_asn1derlength(const char* in,size_t len,unsigned long long* n) __PURE;
+size_t scan_asn1dertag(const char* in,size_t len,unsigned long long* n) __PURE;
/* Google protocol buffers */
/* A protocol buffer is a sequence of (tag,value).
@@ -121,16 +127,16 @@ size_t scan_asn1dertag(const char* in,si
* which field in your struct is being sent. Integers must have type
* 0, double type 1, strings type 2 and floats type 5. However, you
* have to check this yourself.
- */
-size_t scan_varint(const char* in,size_t len, unsigned long long* n) __pure__; /* internal */
-size_t scan_pb_tag(const char* in,size_t len, size_t* fieldno,unsigned char* type) __pure__;
+ */
+size_t scan_varint(const char* in,size_t len, unsigned long long* n) __PURE; /* internal */
+size_t scan_pb_tag(const char* in,size_t len, size_t* fieldno,unsigned char* type) __PURE;
/* Then, depending on the field number, validate the type and call the
* corresponding of these functions to parse the value */
-size_t scan_pb_type0_int(const char* in,size_t len,unsigned long long* l) __pure__;
-size_t scan_pb_type0_sint(const char* in,size_t len,signed long long* l) __pure__;
-size_t scan_pb_type1_double(const char* in,size_t len,double* d) __pure__;
-size_t scan_pb_type1_fixed64(const char* in,size_t len,uint64_t* b) __pure__;
+size_t scan_pb_type0_int(const char* in,size_t len,unsigned long long* l) __PURE;
+size_t scan_pb_type0_sint(const char* in,size_t len,signed long long* l) __PURE;
+size_t scan_pb_type1_double(const char* in,size_t len,double* d) __PURE;
+size_t scan_pb_type1_fixed64(const char* in,size_t len,uint64_t* b) __PURE;
/* NOTE: scan_pb_type2_stringlen only parses the length of the string,
* not the string itself. It will return the number of bytes parsed in
* the length, then set slen to the value of the length integer it just
@@ -141,9 +147,9 @@ size_t scan_pb_type1_fixed64(const char*
* parsing early without having to read and allocate memory for the rest
* (potentially gigabytes) of the data announced by one unreasonable
* string length value. */
-size_t scan_pb_type2_stringlen(const char* in,size_t len,const char** string, size_t* slen) __pure__;
-size_t scan_pb_type5_float(const char* in,size_t len,float* f) __pure__;
-size_t scan_pb_type5_fixed32(const char* in,size_t len,uint32_t* b) __pure__;
+size_t scan_pb_type2_stringlen(const char* in,size_t len,const char** string, size_t* slen) __PURE;
+size_t scan_pb_type5_float(const char* in,size_t len,float* f) __PURE;
+size_t scan_pb_type5_fixed32(const char* in,size_t len,uint32_t* b) __PURE;
/* parse a netstring, input buffer is in (len bytes).
* if parsing is successful:
@@ -153,7 +159,7 @@ size_t scan_pb_type5_fixed32(const char*
* return 0
* Note: *dest will point inside the input buffer!
*/
-size_t scan_netstring(const char* in,size_t len,char** dest,size_t* slen) __pure__;
+size_t scan_netstring(const char* in,size_t len,char** dest,size_t* slen) __PURE;
/* internal function that might be useful independently */
/* convert from hex ASCII, return 0 to 15 for success or -1 for failure */
--- a/scan/scan_httpdate.c
+++ b/scan/scan_httpdate.c
@@ -1,5 +1,4 @@
#define _GNU_SOURCE
-#define __deprecated__
#include "scan.h"
#include "byte.h"
#include "case.h"
--- a/scan/scan_iso8601.c
+++ b/scan/scan_iso8601.c
@@ -1,5 +1,4 @@
#define _GNU_SOURCE
-#define __deprecated__
#include "scan.h"
#include "byte.h"
#include "case.h"
|