[packages] tokyocabinet: add missing function nanl() to work with backfire/uClibc...
[openwrt/svn-archive/archive.git] / libs / tokyocabinet / patches / 200-uclibc_0.9.30_compat.patch
1 --- a/tctdb.c
2 +++ b/tctdb.c
3 @@ -20,6 +20,26 @@
4 #include "tctdb.h"
5 #include "myconf.h"
6
7 +#ifdef __UCLIBC__
8 +# include <features.h>
9 +# if __UCLIBC_MINOR__ <= 9 && __UCLIBC_SUBLEVEL__ <= 30
10 +
11 +size_t strlen(const char *s);
12 +long double strtold(const char *nptr, char **endptr);
13 +static inline long double nanl(const char *tagp)
14 +{
15 + if (tagp[0] != '\0') {
16 + char buf[6 + strlen(tagp)];
17 + sprintf(buf, "NAN(%s)", tagp);
18 + return strtold(buf, NULL);
19 + }
20 + return NAN;
21 +}
22 +
23 +# endif /* __UCLIBC_MINOR__ <= 9 && __UCLIBC_SUBLEVEL__ <= 30 */
24 +#endif /* __UCLIBC__ */
25 +
26 +
27 #define TDBOPAQUESIZ 64 // size of using opaque field
28 #define TDBLEFTOPQSIZ 64 // size of left opaque field
29 #define TDBPAGEBUFSIZ 32768 // size of a buffer to read each page