[Pkg-bitcoin-commits] [libunivalue] 18/76: add compile flag for number parsing functions

Jonas Smedegaard dr at jones.dk
Mon Apr 4 09:18:28 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libunivalue.

commit 4b288b380a364737c7488b6cc9bb552f98d7f890
Author: Jonas Schnelli <jonas.schnelli at include7.ch>
Date:   Fri Aug 21 08:48:47 2015 +0200

    add compile flag for number parsing functions
---
 AUTHORS         |  1 +
 Makefile.am     | 11 ++++++++---
 configure.ac    |  8 ++++++++
 numberparse.cpp |  2 --
 numberparse.h   | 18 ------------------
 univalue.cpp    |  4 ----
 6 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 57330f7..0837764 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,4 @@
 Tests from MIT-licenses "vjson"
 
 Jeff Garzik
+Jonas Schnelli
\ No newline at end of file
diff --git a/Makefile.am b/Makefile.am
index 75a58fe..01f41b8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,8 +6,14 @@ lib_LIBRARIES = libunivalue.a
 libunivalue_a_SOURCES = \
 	univalue.cpp \
 	univalue_read.cpp \
-	univalue_write.cpp \
-	numberparse.cpp
+	univalue_write.cpp
+
+# ----------------------------------
+# optional add numberparse functions
+# ----------------------------------
+if USE_NUMFUNC
+libunivalue_a_SOURCES += numberparse.cpp
+endif
 
 TESTS = unitester
 
@@ -54,4 +60,3 @@ EXTRA_DIST = \
 	pass1.json \
 	pass2.json \
 	pass3.json
-
diff --git a/configure.ac b/configure.ac
index 618c368..e7102e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,6 +21,14 @@ AC_PATH_TOOL(RANLIB, ranlib)
 AC_PATH_TOOL(STRIP, strip)
 PKG_PROG_PKG_CONFIG
 
+# Enable wallet
+AC_ARG_WITH([numfunc],
+  [AS_HELP_STRING([--with-numfunc],
+  [enable compiling of number parsing functions (default is yes)])],
+  [use_numfunc=$withval],
+  [use_numfunc=yes])
+AM_CONDITIONAL([USE_NUMFUNC], [test x$use_numfunc = xyes])
+
 AC_LANG_PUSH([C++])
 
 AC_CONFIG_FILES([Makefile])
diff --git a/numberparse.cpp b/numberparse.cpp
index feb18fb..663cf8e 100644
--- a/numberparse.cpp
+++ b/numberparse.cpp
@@ -2,8 +2,6 @@
 // Distributed under the MIT software license, see the accompanying
 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
 
-#include "numberparse.h"
-
 #include <errno.h>
 #include <stdlib.h>
 #include <locale>
diff --git a/numberparse.h b/numberparse.h
deleted file mode 100644
index 7a91634..0000000
--- a/numberparse.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2015 Bitcoin Core Developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#ifndef __UNIVALUE_NUMBERPARSE_H__
-#define __UNIVALUE_NUMBERPARSE_H__
-
-#include <stdint.h>
-#include <ctype.h>
-
-#include <string>
-
-static bool ParsePrechecks(const std::string& str);
-bool ParseInt32(const std::string& str, int32_t *out);
-bool ParseInt64(const std::string& str, int64_t *out);
-bool ParseDouble(const std::string& str, double *out);
-
-#endif //__UNIVALUE_NUMBERPARSE_H__
\ No newline at end of file
diff --git a/univalue.cpp b/univalue.cpp
index 8244d87..a4d5b94 100644
--- a/univalue.cpp
+++ b/univalue.cpp
@@ -11,13 +11,9 @@
 
 #include "univalue.h"
 
-#ifdef EXTERNAL_NUM_PARSE
 extern bool ParseInt32(const std::string& str, int32_t *out);
 extern bool ParseInt64(const std::string& str, int64_t *out);
 extern bool ParseDouble(const std::string& str, double *out);
-#else
-#include "numberparse.h"
-#endif
 
 using namespace std;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/libunivalue.git



More information about the Pkg-bitcoin-commits mailing list