void-packages/srcpkgs/libowfat/patches/03-Prevent-pure-identifier-...

487 lines
24 KiB
Diff

https://salsa.debian.org/debian/libowfat/-/commit/8f014984a70ef236ef337948af384a9bfb3325b3
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: '&' -> '&amp;', '<' -> '&lt;', 'ö' -> '&#xf6;' */
-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)))