summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Costan <costan@google.com>2020-04-29 19:59:39 +0000
committerVictor Costan <costan@google.com>2020-04-29 20:51:13 +0000
commit3f934e3705444a3df80b128ddefc4cf440441ffe (patch)
tree7f9003632579b80fb7ba535ecd2abbfc911502d0
parent23d67e7c1f4396919bd0c73c0eced13a0dac37f3 (diff)
downloadleveldb-3f934e3705444a3df80b128ddefc4cf440441ffe.tar.gz
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
-rw-r--r--benchmarks/db_bench.cc5
-rw-r--r--benchmarks/db_bench_sqlite3.cc5
-rw-r--r--benchmarks/db_bench_tree_db.cc5
-rw-r--r--db/db_impl.cc5
-rw-r--r--db/db_iter.h2
-rw-r--r--db/dbformat.cc3
-rw-r--r--db/dumpfile.cc2
-rw-r--r--db/filename.cc4
-rw-r--r--db/filename.h3
-rw-r--r--db/leveldbutil.cc2
-rw-r--r--db/log_reader.cc2
-rw-r--r--db/log_reader.h2
-rw-r--r--db/log_writer.cc2
-rw-r--r--db/log_writer.h2
-rw-r--r--db/table_cache.h3
-rw-r--r--db/version_set.cc3
-rw-r--r--helpers/memenv/memenv.cc3
-rw-r--r--include/leveldb/cache.h2
-rw-r--r--include/leveldb/db.h4
-rw-r--r--include/leveldb/env.h5
-rw-r--r--include/leveldb/options.h2
-rw-r--r--include/leveldb/slice.h7
-rw-r--r--include/leveldb/table.h2
-rw-r--r--include/leveldb/table_builder.h2
-rw-r--r--table/block.h4
-rw-r--r--table/block_builder.cc3
-rw-r--r--table/block_builder.h3
-rw-r--r--table/filter_block.h5
-rw-r--r--table/format.h3
-rw-r--r--table/table_builder.cc2
-rw-r--r--util/cache.cc9
-rw-r--r--util/crc32c.cc4
-rw-r--r--util/crc32c.h4
-rw-r--r--util/hash.cc2
-rw-r--r--util/hash.h4
-rw-r--r--util/histogram.cc4
-rw-r--r--util/logging.cc8
-rw-r--r--util/logging.h5
-rw-r--r--util/random.h2
-rw-r--r--util/status.cc2
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 <stdio.h>
-#include <stdlib.h>
#include <sys/types.h>
+#include <cstdio>
+#include <cstdlib>
+
#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 <sqlite3.h>
-#include <stdio.h>
-#include <stdlib.h>
+
+#include <cstdio>
+#include <cstdlib>
#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 <kcpolydb.h>
-#include <stdio.h>
-#include <stdlib.h>
+
+#include <cstdio>
+#include <cstdlib>
#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 <stdint.h>
-#include <stdio.h>
-
#include <algorithm>
#include <atomic>
+#include <cstdint>
+#include <cstdio>
#include <set>
#include <string>
#include <vector>
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 <stdint.h>
+#include <cstdint>
#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 <stdio.h>
-
+#include <cstdio>
#include <sstream>
#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 <stdio.h>
+#include <cstdio>
#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 <ctype.h>
-#include <stdio.h>
+#include <cassert>
+#include <cstdio>
#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 <stdint.h>
-
+#include <cstdint>
#include <string>
#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 <stdio.h>
+#include <cstdio>
#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 <stdio.h>
+#include <cstdio>
#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 <stdint.h>
+#include <cstdint>
#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 <stdint.h>
+#include <cstdint>
#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 <stdint.h>
+#include <cstdint>
#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 <stdint.h>
-
+#include <cstdint>
#include <string>
#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 <stdio.h>
-
#include <algorithm>
+#include <cstdio>
#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 <string.h>
-
+#include <cstring>
#include <limits>
#include <map>
#include <string>
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 <stdint.h>
+#include <cstdint>
#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 <stdint.h>
-#include <stdio.h>
+#include <cstdint>
+#include <cstdio>
#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 <stdarg.h>
-#include <stdint.h>
-
+#include <cstdarg>
+#include <cstdint>
#include <string>
#include <vector>
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 <stddef.h>
+#include <cstddef>
#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 <assert.h>
-#include <stddef.h>
-#include <string.h>
-
+#include <cassert>
+#include <cstddef>
+#include <cstring>
#include <string>
#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 <stdint.h>
+#include <cstdint>
#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 <stdint.h>
+#include <cstdint>
#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 <stddef.h>
-#include <stdint.h>
+#include <cstddef>
+#include <cstdint>
#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 <assert.h>
-
#include <algorithm>
+#include <cassert>
#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 <stdint.h>
-
+#include <cstdint>
#include <vector>
#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 <stddef.h>
-#include <stdint.h>
-
+#include <cstddef>
+#include <cstdint>
#include <string>
#include <vector>
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 <stdint.h>
-
+#include <cstdint>
#include <string>
#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 <assert.h>
+#include <cassert>
#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 <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-
#include "leveldb/cache.h"
+
+#include <cassert>
+#include <cstdio>
+#include <cstdlib>
+
#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 <stddef.h>
-#include <stdint.h>
+#include <cstddef>
+#include <cstdint>
#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 <stddef.h>
-#include <stdint.h>
+#include <cstddef>
+#include <cstdint>
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 <string.h>
+#include <cstring>
#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 <stddef.h>
-#include <stdint.h>
+#include <cstddef>
+#include <cstdint>
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 <math.h>
-#include <stdio.h>
+#include <cmath>
+#include <cstdio>
#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 <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-
+#include <cstdarg>
+#include <cstdio>
+#include <cstdlib>
#include <limits>
#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 <stdint.h>
-#include <stdio.h>
-
+#include <cstdint>
+#include <cstdio>
#include <string>
#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 <stdint.h>
+#include <cstdint>
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 <stdio.h>
+#include <cstdio>
#include "port/port.h"