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
|
From: Bastian Germann <bage@debian.org>
Date: Thu, 10 Nov 2022 14:49:00 +0000
Subject: Prevent __pure__ identifier from conflicting with glibc
---
byte.h | 12 +++-----
critbit.h | 7 +----
fmt.h | 90 ++++++++++++++++++++++++++----------------------------
scan.h | 44 ++++++++++++--------------
str.h | 16 ++++------
stralloc.h | 10 ++----
6 files changed, 77 insertions(+), 102 deletions(-)
diff --git a/byte.h b/byte.h
index 0568164..6acce52 100644
--- a/byte.h
+++ b/byte.h
@@ -9,17 +9,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) __attribute__ ((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) __attribute__((pure));
/* byte_copy copies in[0] to out[0], in[1] to out[1], ... and in[len-1]
* to out[len-1]. */
@@ -34,14 +30,14 @@ void byte_copyr(void* out, size_t len, const void* in);
* 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) __attribute__((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) __attribute__((pure));
#if defined(__i386__) || defined(__x86_64__)
#define UNALIGNED_ACCESS_OK
diff --git a/critbit.h b/critbit.h
index f9ceb3c..783190c 100644
--- a/critbit.h
+++ b/critbit.h
@@ -5,18 +5,13 @@
extern "C" {
#endif
-/* for __pure__ if we are compiling under dietlibc */
#include <stddef.h>
-#ifndef __pure__
-#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) __attribute__((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);
diff --git a/fmt.h b/fmt.h
index 4ca896d..63b2e0d 100644
--- a/fmt.h
+++ b/fmt.h
@@ -15,10 +15,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 +42,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) __attribute__((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) __attribute__((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) __attribute__((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) __attribute__((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) __attribute__((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) __attribute__((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) __attribute__((pure));
#define fmt_uint(dest,src) fmt_ulong(dest,src)
#define fmt_int(dest,src) fmt_long(dest,src)
@@ -81,22 +77,22 @@ size_t fmt_xlonglong(char *dest,unsigned long long src) __pure__;
* 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) __attribute__((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) __attribute__((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) __attribute__((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) __attribute__((pure));
/* copy str to dest until \0 byte, return number of copied bytes. */
/* fmt_str(NULL,str) == strlen(str) */
@@ -108,11 +104,11 @@ size_t fmt_minus(char *dest,int src) __pure__;
* 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) __attribute__((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) __attribute__((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 +120,56 @@ static inline size_t fmt_copybytes(char* dest,const char* src,size_t n) {
* 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) __attribute__((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) __attribute__((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) __attribute__((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) __attribute__((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) __attribute__((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) __attribute__((pure)); /* can store 0-0x7fffffff */
+size_t fmt_asn1derlength(char* dest,unsigned long long l) __attribute__((pure)); /* 0-0x7f: 1 byte, above that 1+bytes_needed bytes */
+size_t fmt_asn1dertag(char* dest,unsigned long long l) __attribute__((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) __attribute__((pure)); /* protocol buffers encoding; like asn1dertag but little endian */
+size_t fmt_pb_tag(char* dest,size_t fieldno,unsigned char type) __attribute__((pure)); /* protocol buffer tag */
+size_t fmt_pb_type0_int(char* dest,unsigned long long l) __attribute__((pure)); /* protocol buffers encoding: type 0 bool/enum/int32/uint32/int64/uint64 */
+size_t fmt_pb_type0_sint(char* dest,signed long long l) __attribute__((pure));/* protocol buffers encoding: type 0 sint32/sint64 */
+size_t fmt_pb_type1_double(char* dest,double d) __attribute__((pure)); /* protocol buffers encoding: double (64-bit little endian blob) */
+size_t fmt_pb_type1_fixed64(char* dest,uint64_t l) __attribute__((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_type2_string(char* dest,const char* s,size_t l) __attribute__((pure)); /* protocol buffers encoding: varint length + blob */
+size_t fmt_pb_type5_float(char* dest,float f) __attribute__((pure)); /* protocol buffers encoding: float (32-bit little endian blob) */
+size_t fmt_pb_type5_fixed32(char* dest,uint32_t l) __attribute__((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_int(char* dest,size_t fieldno,unsigned long long l) __attribute__((pure));
+size_t fmt_pb_sint(char* dest,size_t fieldno,signed long long l) __attribute__((pure));
+size_t fmt_pb_double(char* dest,size_t fieldno,double d) __attribute__((pure));
+size_t fmt_pb_float(char* dest,size_t fieldno,float f) __attribute__((pure));
+size_t fmt_pb_string(char* dest,size_t fieldno,const char* s,size_t l) __attribute__((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) __attribute__((pure));
/* Marshaling helper functions.
* Escape one character, no matter if it needs escaping or not.
@@ -185,27 +181,27 @@ size_t fmt_netstring(char* dest,const char* src,size_t len) __pure__;
* 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) __attribute__((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) __attribute__((pure));
/* JSON escaping: '\' -> '\\', '"' -> '\"', 'ö' -> '\u00f6' */
-size_t fmt_escapecharjson(char* dest,uint32_t ch) __pure__;
+size_t fmt_escapecharjson(char* dest,uint32_t ch) __attribute__((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) __attribute__((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) __attribute__((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) __attribute__((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,...) __attribute__((pure));
#ifndef MAX_ALLOCA
#define MAX_ALLOCA 100000
diff --git a/scan.h b/scan.h
index bcd4365..c81fc63 100644
--- a/scan.h
+++ b/scan.h
@@ -15,10 +15,6 @@
extern "C" {
#endif
-#ifndef __pure__
-#define __pure__
-#endif
-
/* This file declared functions used to decode / scan / unmarshal
* integer or string values from a buffer.
* The first argument is always the source buffer, the second argument
@@ -84,18 +80,18 @@ size_t scan_double(const char *in, double *dest);
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) __attribute__((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) __attribute__((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) __attribute__((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) __attribute__((pure));
/* try to parse ASCII GMT date; does not understand time zones. */
/* example dates:
@@ -103,17 +99,17 @@ size_t scan_noncharsetnskip(const char *in,const char *charset,size_t limit) __p
* "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) __attribute__((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) __attribute__((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) __attribute__((pure));
+size_t scan_utf8_sem(const char* in,size_t len,uint32_t* n) __attribute__((pure));
+size_t scan_asn1derlength(const char* in,size_t len,unsigned long long* n) __attribute__((pure));
+size_t scan_asn1dertag(const char* in,size_t len,unsigned long long* n) __attribute__((pure));
/* Google protocol buffers */
/* A protocol buffer is a sequence of (tag,value).
@@ -122,15 +118,15 @@ size_t scan_asn1dertag(const char* in,size_t len,unsigned long long* n) __pure__
* 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) __attribute__((pure)); /* internal */
+size_t scan_pb_tag(const char* in,size_t len, size_t* fieldno,unsigned char* type) __attribute__((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) __attribute__((pure));
+size_t scan_pb_type0_sint(const char* in,size_t len,signed long long* l) __attribute__((pure));
+size_t scan_pb_type1_double(const char* in,size_t len,double* d) __attribute__((pure));
+size_t scan_pb_type1_fixed64(const char* in,size_t len,uint64_t* b) __attribute__((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 +137,9 @@ size_t scan_pb_type1_fixed64(const char* in,size_t len,uint64_t* b) __pure__;
* 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) __attribute__((pure));
+size_t scan_pb_type5_float(const char* in,size_t len,float* f) __attribute__((pure));
+size_t scan_pb_type5_fixed32(const char* in,size_t len,uint32_t* b) __attribute__((pure));
/* parse a netstring, input buffer is in (len bytes).
* if parsing is successful:
@@ -153,7 +149,7 @@ size_t scan_pb_type5_fixed32(const char* in,size_t len,uint32_t* b) __pure__;
* 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) __attribute__((pure));
/* internal function that might be useful independently */
/* convert from hex ASCII, return 0 to 15 for success or -1 for failure */
diff --git a/str.h b/str.h
index 100a37b..88f7431 100644
--- a/str.h
+++ b/str.h
@@ -8,10 +8,6 @@
extern "C" {
#endif
-#ifndef __pure__
-#define __pure__
-#endif
-
/* str_copy copies leading bytes from in to out until \0.
* return number of copied bytes. */
size_t str_copy(char *out,const char *in);
@@ -21,7 +17,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) __attribute__((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 +25,24 @@ int str_diff(const char *a,const char *b) __pure__;
* 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) __attribute__((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) __attribute__((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) __attribute__((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) __attribute__((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) __attribute__((pure));
/* convenience shortcut to test for string equality */
#define str_equal(s,t) (!str_diff((s),(t)))
diff --git a/stralloc.h b/stralloc.h
index b328667..cf48af1 100644
--- a/stralloc.h
+++ b/stralloc.h
@@ -8,10 +8,6 @@
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 +97,17 @@ static inline int stralloc_APPEND(stralloc* sa,const char* in) {
/* 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) __attribute__((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) __attribute__((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) __attribute__((pure));
#define stralloc_equal(a,b) (!stralloc_diff((a),(b)))
#define stralloc_equals(a,b) (!stralloc_diffs((a),(b)))
|