tlib9: make a p9frexp function wrapping system frexp - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit e0c4896ed41faa71445d9e0b1751aba5157343c9
 (DIR) parent fafa622a5bdf71adfbb4334541c3b65f29c89ca9
 (HTM) Author: Russ Cox <rsc@swtch.com>
       Date:   Wed,  8 Jan 2020 22:28:44 -0500
       
       lib9: make a p9frexp function wrapping system frexp
       
       Under certain conditions it looks like frexp gets #defined
       tto something else on macOS during system headers,
       which then breaks the declaration in libc.h.
       
       Diffstat:
         M include/libc.h                      |       4 +++-
         A src/lib9/frexp.c                    |       9 +++++++++
         M src/lib9/mkfile                     |       1 +
       
       3 files changed, 13 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/include/libc.h b/include/libc.h
       t@@ -383,7 +383,7 @@ extern        int        encodefmt(Fmt*);
        extern        int        dirmodefmt(Fmt*);
        extern        int        exitcode(char*);
        extern        void        exits(char*);
       -extern        double        frexp(double, int*);
       +extern        double        p9frexp(double, int*);
        extern        ulong        getcallerpc(void*);
        #if defined(__GNUC__) || defined(__clang__)
        #define getcallerpc(x) ((ulong)__builtin_return_address(0))
       t@@ -436,6 +436,8 @@ extern        void        (*_unpin)(void);
        #define atoll                p9atoll
        #define encrypt                p9encrypt
        #define decrypt                p9decrypt
       +#undef frexp
       +#define frexp                p9frexp
        #define getenv                p9getenv
        #define        getwd                p9getwd
        #define        longjmp                p9longjmp
 (DIR) diff --git a/src/lib9/frexp.c b/src/lib9/frexp.c
       t@@ -0,0 +1,9 @@
       +#include <u.h>
       +#define NOPLAN9DEFINES
       +#include <libc.h>
       +
       +double
       +p9frexp(double d, int *i)
       +{
       +        return frexp(d, i);
       +}
 (DIR) diff --git a/src/lib9/mkfile b/src/lib9/mkfile
       t@@ -22,6 +22,7 @@ FMTOFILES=\
                fmtstr.$O\
                fmtvprint.$O\
                fprint.$O\
       +        frexp.$O\
                nan64.$O\
                print.$O\
                runefmtstr.$O\