Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

refactor: include-what-you-use #32

Merged
merged 2 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions gen/gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
// $ ./gen > univalue_escapes.h
//

#include <stdio.h>
#include <string.h>
#include "univalue.h"
#include <univalue.h>

#include <cstdio>
#include <cstring>
#include <string>

static bool initEscapes;
static std::string escapes[256];
Expand Down
8 changes: 3 additions & 5 deletions include/univalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
#ifndef __UNIVALUE_H__
#define __UNIVALUE_H__

#include <stdint.h>
#include <string.h>

#include <cstdint>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <map>
#include <cassert>

class UniValue {
public:
Expand Down
11 changes: 7 additions & 4 deletions lib/univalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://opensource.org/licenses/mit-license.php.

#include <stdint.h>
#include <univalue.h>

#include <iomanip>
#include <map>
#include <memory>
#include <sstream>
#include <stdlib.h>

#include "univalue.h"
#include <string>
#include <utility>
#include <vector>

const UniValue NullUniValue;

Expand Down
19 changes: 10 additions & 9 deletions lib/univalue_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://opensource.org/licenses/mit-license.php.

#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <stdexcept>
#include <vector>
#include <univalue.h>

#include <cerrno>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <limits>
#include <string>
#include <locale>
#include <sstream>

#include "univalue.h"
#include <stdexcept>
#include <string>
#include <vector>

namespace
{
Expand Down
13 changes: 8 additions & 5 deletions lib/univalue_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://opensource.org/licenses/mit-license.php.

#include <string.h>
#include <vector>
#include <stdio.h>
#include "univalue.h"
#include <univalue.h>
#include "univalue_utffilter.h"

#include <cstdio>
#include <cstdint>
#include <cstring>
#include <string>
#include <vector>

/*
* According to stackexchange, the original json test suite wanted
* to limit depth to 22. Widely-deployed PHP bails at depth 512,
* so we will follow PHP's lead, which should be more than sufficient
* (further stackexchange comments indicate depth > 32 rarely occurs).
*/
static const size_t MAX_JSON_DEPTH = 512;
static constexpr size_t MAX_JSON_DEPTH = 512;

static bool json_isdigit(int ch)
{
Expand Down
8 changes: 5 additions & 3 deletions lib/univalue_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://opensource.org/licenses/mit-license.php.

#include <iomanip>
#include <stdio.h>
#include "univalue.h"
#include <univalue.h>
#include "univalue_escapes.h"

#include <memory>
#include <string>
#include <vector>

static std::string json_escape(const std::string& inS)
{
std::string outS;
Expand Down
2 changes: 1 addition & 1 deletion test/no_nul.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "univalue.h"
#include <univalue.h>

int main (int argc, char *argv[])
{
Expand Down
12 changes: 7 additions & 5 deletions test/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://opensource.org/licenses/mit-license.php.

#include <stdint.h>
#include <vector>
#include <string>
#include <map>
#include <univalue.h>

#include <cassert>
#include <cstdint>
#include <map>
#include <memory>
#include <stdexcept>
#include <univalue.h>
#include <string>
#include <vector>

#define BOOST_FIXTURE_TEST_SUITE(a, b)
#define BOOST_AUTO_TEST_CASE(funcName) void funcName()
Expand Down
4 changes: 3 additions & 1 deletion test/test_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
// It reads JSON input from stdin and exits with code 0 if it can be parsed
// successfully. It also pretty prints the parsed JSON value to stdout.

#include <univalue.h>

#include <iostream>
#include <iterator>
#include <string>
#include "univalue.h"

using namespace std;

Expand Down
7 changes: 3 additions & 4 deletions test/unitester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or https://opensource.org/licenses/mit-license.php.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <univalue.h>

#include <cassert>
#include <cstdio>
#include <string>
#include "univalue.h"

#ifndef JSON_TEST_SRC
#error JSON_TEST_SRC must point to test source directory
Expand Down