From 3f934e3705444a3df80b128ddefc4cf440441ffe Mon Sep 17 00:00:00 2001 From: Victor Costan Date: Wed, 29 Apr 2020 19:59:39 +0000 Subject: [PATCH] Switch from C headers to C++ headers. This CL makes the following substitutions. * assert.h -> cassert * math.h -> cmath * stdarg.h -> cstdarg * stddef.h -> cstddef * stdint.h -> cstdint * stdio.h -> cstdio * stdlib.h -> cstdlib * string.h -> cstring PiperOrigin-RevId: 309080151 --- benchmarks/db_bench.cc | 5 +++-- benchmarks/db_bench_sqlite3.cc | 5 +++-- benchmarks/db_bench_tree_db.cc | 5 +++-- db/db_impl.cc | 5 ++--- db/db_iter.h | 2 +- db/dbformat.cc | 3 +-- db/dumpfile.cc | 2 +- db/filename.cc | 4 ++-- db/filename.h | 3 +-- db/leveldbutil.cc | 2 +- db/log_reader.cc | 2 +- db/log_reader.h | 2 +- db/log_writer.cc | 2 +- db/log_writer.h | 2 +- db/table_cache.h | 3 +-- db/version_set.cc | 3 +-- helpers/memenv/memenv.cc | 3 +-- include/leveldb/cache.h | 2 +- include/leveldb/db.h | 4 ++-- include/leveldb/env.h | 5 ++--- include/leveldb/options.h | 2 +- include/leveldb/slice.h | 7 +++---- include/leveldb/table.h | 2 +- include/leveldb/table_builder.h | 2 +- table/block.h | 4 ++-- table/block_builder.cc | 3 +-- table/block_builder.h | 3 +-- table/filter_block.h | 5 ++--- table/format.h | 3 +-- table/table_builder.cc | 2 +- util/cache.cc | 9 +++++---- util/crc32c.cc | 4 ++-- util/crc32c.h | 4 ++-- util/hash.cc | 2 +- util/hash.h | 4 ++-- util/histogram.cc | 4 ++-- util/logging.cc | 8 +++----- util/logging.h | 5 ++--- util/random.h | 2 +- util/status.cc | 2 +- 40 files changed, 65 insertions(+), 76 deletions(-) diff --git a/benchmarks/db_bench.cc b/benchmarks/db_bench.cc index 82ed892..3dcd751 100644 --- a/benchmarks/db_bench.cc +++ b/benchmarks/db_bench.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#include -#include #include +#include +#include + #include "leveldb/cache.h" #include "leveldb/db.h" #include "leveldb/env.h" diff --git a/benchmarks/db_bench_sqlite3.cc b/benchmarks/db_bench_sqlite3.cc index 9c32a2d..2563481 100644 --- a/benchmarks/db_bench_sqlite3.cc +++ b/benchmarks/db_bench_sqlite3.cc @@ -3,8 +3,9 @@ // found in the LICENSE file. See the AUTHORS file for names of contributors. #include -#include -#include + +#include +#include #include "util/histogram.h" #include "util/random.h" diff --git a/benchmarks/db_bench_tree_db.cc b/benchmarks/db_bench_tree_db.cc index 43f0f65..60ab3b0 100644 --- a/benchmarks/db_bench_tree_db.cc +++ b/benchmarks/db_bench_tree_db.cc @@ -3,8 +3,9 @@ // found in the LICENSE file. See the AUTHORS file for names of contributors. #include -#include -#include + +#include +#include #include "util/histogram.h" #include "util/random.h" diff --git a/db/db_impl.cc b/db/db_impl.cc index ba0a46d..ca53485 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -4,11 +4,10 @@ #include "db/db_impl.h" -#include -#include - #include #include +#include +#include #include #include #include diff --git a/db/db_iter.h b/db/db_iter.h index fd93e91..5977fc8 100644 --- a/db/db_iter.h +++ b/db/db_iter.h @@ -5,7 +5,7 @@ #ifndef STORAGE_LEVELDB_DB_DB_ITER_H_ #define STORAGE_LEVELDB_DB_DB_ITER_H_ -#include +#include #include "db/dbformat.h" #include "leveldb/db.h" diff --git a/db/dbformat.cc b/db/dbformat.cc index 459eddf..019aa92 100644 --- a/db/dbformat.cc +++ b/db/dbformat.cc @@ -4,8 +4,7 @@ #include "db/dbformat.h" -#include - +#include #include #include "port/port.h" diff --git a/db/dumpfile.cc b/db/dumpfile.cc index 77d5900..6085475 100644 --- a/db/dumpfile.cc +++ b/db/dumpfile.cc @@ -4,7 +4,7 @@ #include "leveldb/dumpfile.h" -#include +#include #include "db/dbformat.h" #include "db/filename.h" diff --git a/db/filename.cc b/db/filename.cc index 9b451fc..f6bec00 100644 --- a/db/filename.cc +++ b/db/filename.cc @@ -4,8 +4,8 @@ #include "db/filename.h" -#include -#include +#include +#include #include "db/dbformat.h" #include "leveldb/env.h" diff --git a/db/filename.h b/db/filename.h index 524e813..563c6d8 100644 --- a/db/filename.h +++ b/db/filename.h @@ -7,8 +7,7 @@ #ifndef STORAGE_LEVELDB_DB_FILENAME_H_ #define STORAGE_LEVELDB_DB_FILENAME_H_ -#include - +#include #include #include "leveldb/slice.h" diff --git a/db/leveldbutil.cc b/db/leveldbutil.cc index 55cdcc5..8e94abd 100644 --- a/db/leveldbutil.cc +++ b/db/leveldbutil.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#include +#include #include "leveldb/dumpfile.h" #include "leveldb/env.h" diff --git a/db/log_reader.cc b/db/log_reader.cc index b770fee..dcd4b75 100644 --- a/db/log_reader.cc +++ b/db/log_reader.cc @@ -4,7 +4,7 @@ #include "db/log_reader.h" -#include +#include #include "leveldb/env.h" #include "util/coding.h" diff --git a/db/log_reader.h b/db/log_reader.h index 001da89..75d53f7 100644 --- a/db/log_reader.h +++ b/db/log_reader.h @@ -5,7 +5,7 @@ #ifndef STORAGE_LEVELDB_DB_LOG_READER_H_ #define STORAGE_LEVELDB_DB_LOG_READER_H_ -#include +#include #include "db/log_format.h" #include "leveldb/slice.h" diff --git a/db/log_writer.cc b/db/log_writer.cc index bfb16fb..ad66bfb 100644 --- a/db/log_writer.cc +++ b/db/log_writer.cc @@ -4,7 +4,7 @@ #include "db/log_writer.h" -#include +#include #include "leveldb/env.h" #include "util/coding.h" diff --git a/db/log_writer.h b/db/log_writer.h index c0a2114..ad36794 100644 --- a/db/log_writer.h +++ b/db/log_writer.h @@ -5,7 +5,7 @@ #ifndef STORAGE_LEVELDB_DB_LOG_WRITER_H_ #define STORAGE_LEVELDB_DB_LOG_WRITER_H_ -#include +#include #include "db/log_format.h" #include "leveldb/slice.h" diff --git a/db/table_cache.h b/db/table_cache.h index 93069c8..aac9bfc 100644 --- a/db/table_cache.h +++ b/db/table_cache.h @@ -7,8 +7,7 @@ #ifndef STORAGE_LEVELDB_DB_TABLE_CACHE_H_ #define STORAGE_LEVELDB_DB_TABLE_CACHE_H_ -#include - +#include #include #include "db/dbformat.h" diff --git a/db/version_set.cc b/db/version_set.cc index 2d5e51a..f23ae14 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -4,9 +4,8 @@ #include "db/version_set.h" -#include - #include +#include #include "db/filename.h" #include "db/log_reader.h" diff --git a/helpers/memenv/memenv.cc b/helpers/memenv/memenv.cc index 383c78b..0da4e76 100644 --- a/helpers/memenv/memenv.cc +++ b/helpers/memenv/memenv.cc @@ -4,8 +4,7 @@ #include "helpers/memenv/memenv.h" -#include - +#include #include #include #include diff --git a/include/leveldb/cache.h b/include/leveldb/cache.h index 7d1a221..98c95ac 100644 --- a/include/leveldb/cache.h +++ b/include/leveldb/cache.h @@ -18,7 +18,7 @@ #ifndef STORAGE_LEVELDB_INCLUDE_CACHE_H_ #define STORAGE_LEVELDB_INCLUDE_CACHE_H_ -#include +#include #include "leveldb/export.h" #include "leveldb/slice.h" diff --git a/include/leveldb/db.h b/include/leveldb/db.h index b73014a..2a995ec 100644 --- a/include/leveldb/db.h +++ b/include/leveldb/db.h @@ -5,8 +5,8 @@ #ifndef STORAGE_LEVELDB_INCLUDE_DB_H_ #define STORAGE_LEVELDB_INCLUDE_DB_H_ -#include -#include +#include +#include #include "leveldb/export.h" #include "leveldb/iterator.h" diff --git a/include/leveldb/env.h b/include/leveldb/env.h index 6501fa4..3ef0393 100644 --- a/include/leveldb/env.h +++ b/include/leveldb/env.h @@ -13,9 +13,8 @@ #ifndef STORAGE_LEVELDB_INCLUDE_ENV_H_ #define STORAGE_LEVELDB_INCLUDE_ENV_H_ -#include -#include - +#include +#include #include #include diff --git a/include/leveldb/options.h b/include/leveldb/options.h index b748772..0f285bc 100644 --- a/include/leveldb/options.h +++ b/include/leveldb/options.h @@ -5,7 +5,7 @@ #ifndef STORAGE_LEVELDB_INCLUDE_OPTIONS_H_ #define STORAGE_LEVELDB_INCLUDE_OPTIONS_H_ -#include +#include #include "leveldb/export.h" diff --git a/include/leveldb/slice.h b/include/leveldb/slice.h index 2df417d..37cb821 100644 --- a/include/leveldb/slice.h +++ b/include/leveldb/slice.h @@ -15,10 +15,9 @@ #ifndef STORAGE_LEVELDB_INCLUDE_SLICE_H_ #define STORAGE_LEVELDB_INCLUDE_SLICE_H_ -#include -#include -#include - +#include +#include +#include #include #include "leveldb/export.h" diff --git a/include/leveldb/table.h b/include/leveldb/table.h index 25c6013..a30e903 100644 --- a/include/leveldb/table.h +++ b/include/leveldb/table.h @@ -5,7 +5,7 @@ #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_H_ #define STORAGE_LEVELDB_INCLUDE_TABLE_H_ -#include +#include #include "leveldb/export.h" #include "leveldb/iterator.h" diff --git a/include/leveldb/table_builder.h b/include/leveldb/table_builder.h index 7d8896b..85710c3 100644 --- a/include/leveldb/table_builder.h +++ b/include/leveldb/table_builder.h @@ -13,7 +13,7 @@ #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ #define STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ -#include +#include #include "leveldb/export.h" #include "leveldb/options.h" diff --git a/table/block.h b/table/block.h index c8f1f7b..5224108 100644 --- a/table/block.h +++ b/table/block.h @@ -5,8 +5,8 @@ #ifndef STORAGE_LEVELDB_TABLE_BLOCK_H_ #define STORAGE_LEVELDB_TABLE_BLOCK_H_ -#include -#include +#include +#include #include "leveldb/iterator.h" diff --git a/table/block_builder.cc b/table/block_builder.cc index 919cff5..37d4008 100644 --- a/table/block_builder.cc +++ b/table/block_builder.cc @@ -28,9 +28,8 @@ #include "table/block_builder.h" -#include - #include +#include #include "leveldb/comparator.h" #include "leveldb/options.h" diff --git a/table/block_builder.h b/table/block_builder.h index f91f5e6..7a481cd 100644 --- a/table/block_builder.h +++ b/table/block_builder.h @@ -5,8 +5,7 @@ #ifndef STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_H_ #define STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_H_ -#include - +#include #include #include "leveldb/slice.h" diff --git a/table/filter_block.h b/table/filter_block.h index 73b5399..25ab75b 100644 --- a/table/filter_block.h +++ b/table/filter_block.h @@ -9,9 +9,8 @@ #ifndef STORAGE_LEVELDB_TABLE_FILTER_BLOCK_H_ #define STORAGE_LEVELDB_TABLE_FILTER_BLOCK_H_ -#include -#include - +#include +#include #include #include diff --git a/table/format.h b/table/format.h index e49dfdc..f6ea304 100644 --- a/table/format.h +++ b/table/format.h @@ -5,8 +5,7 @@ #ifndef STORAGE_LEVELDB_TABLE_FORMAT_H_ #define STORAGE_LEVELDB_TABLE_FORMAT_H_ -#include - +#include #include #include "leveldb/slice.h" diff --git a/table/table_builder.cc b/table/table_builder.cc index 278febf..29a619d 100644 --- a/table/table_builder.cc +++ b/table/table_builder.cc @@ -4,7 +4,7 @@ #include "leveldb/table_builder.h" -#include +#include #include "leveldb/comparator.h" #include "leveldb/env.h" diff --git a/util/cache.cc b/util/cache.cc index 12de306..509e5eb 100644 --- a/util/cache.cc +++ b/util/cache.cc @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#include -#include -#include - #include "leveldb/cache.h" + +#include +#include +#include + #include "port/port.h" #include "port/thread_annotations.h" #include "util/hash.h" diff --git a/util/crc32c.cc b/util/crc32c.cc index c2e61f7..3f18908 100644 --- a/util/crc32c.cc +++ b/util/crc32c.cc @@ -6,8 +6,8 @@ #include "util/crc32c.h" -#include -#include +#include +#include #include "port/port.h" #include "util/coding.h" diff --git a/util/crc32c.h b/util/crc32c.h index 98fabb0..b420b5f 100644 --- a/util/crc32c.h +++ b/util/crc32c.h @@ -5,8 +5,8 @@ #ifndef STORAGE_LEVELDB_UTIL_CRC32C_H_ #define STORAGE_LEVELDB_UTIL_CRC32C_H_ -#include -#include +#include +#include namespace leveldb { namespace crc32c { diff --git a/util/hash.cc b/util/hash.cc index dd47c11..8122fa8 100644 --- a/util/hash.cc +++ b/util/hash.cc @@ -4,7 +4,7 @@ #include "util/hash.h" -#include +#include #include "util/coding.h" diff --git a/util/hash.h b/util/hash.h index 74bdb6e..87ab279 100644 --- a/util/hash.h +++ b/util/hash.h @@ -7,8 +7,8 @@ #ifndef STORAGE_LEVELDB_UTIL_HASH_H_ #define STORAGE_LEVELDB_UTIL_HASH_H_ -#include -#include +#include +#include namespace leveldb { diff --git a/util/histogram.cc b/util/histogram.cc index 65092c8..d110d28 100644 --- a/util/histogram.cc +++ b/util/histogram.cc @@ -4,8 +4,8 @@ #include "util/histogram.h" -#include -#include +#include +#include #include "port/port.h" diff --git a/util/logging.cc b/util/logging.cc index 75e9d03..39d8551 100644 --- a/util/logging.cc +++ b/util/logging.cc @@ -4,11 +4,9 @@ #include "util/logging.h" -#include -#include -#include -#include - +#include +#include +#include #include #include "leveldb/env.h" diff --git a/util/logging.h b/util/logging.h index 8ff2da8..a0394b2 100644 --- a/util/logging.h +++ b/util/logging.h @@ -8,9 +8,8 @@ #ifndef STORAGE_LEVELDB_UTIL_LOGGING_H_ #define STORAGE_LEVELDB_UTIL_LOGGING_H_ -#include -#include - +#include +#include #include #include "port/port.h" diff --git a/util/random.h b/util/random.h index 76f7daf..fe76ab4 100644 --- a/util/random.h +++ b/util/random.h @@ -5,7 +5,7 @@ #ifndef STORAGE_LEVELDB_UTIL_RANDOM_H_ #define STORAGE_LEVELDB_UTIL_RANDOM_H_ -#include +#include namespace leveldb { diff --git a/util/status.cc b/util/status.cc index 15ce747..6b6528b 100644 --- a/util/status.cc +++ b/util/status.cc @@ -4,7 +4,7 @@ #include "leveldb/status.h" -#include +#include #include "port/port.h"