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
This commit is contained in:
Victor Costan 2020-04-29 19:59:39 +00:00
parent 23d67e7c1f
commit 3f934e3705
40 changed files with 65 additions and 76 deletions

View File

@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // 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. // found in the LICENSE file. See the AUTHORS file for names of contributors.
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <cstdio>
#include <cstdlib>
#include "leveldb/cache.h" #include "leveldb/cache.h"
#include "leveldb/db.h" #include "leveldb/db.h"
#include "leveldb/env.h" #include "leveldb/env.h"

View File

@ -3,8 +3,9 @@
// found in the LICENSE file. See the AUTHORS file for names of contributors. // found in the LICENSE file. See the AUTHORS file for names of contributors.
#include <sqlite3.h> #include <sqlite3.h>
#include <stdio.h>
#include <stdlib.h> #include <cstdio>
#include <cstdlib>
#include "util/histogram.h" #include "util/histogram.h"
#include "util/random.h" #include "util/random.h"

View File

@ -3,8 +3,9 @@
// found in the LICENSE file. See the AUTHORS file for names of contributors. // found in the LICENSE file. See the AUTHORS file for names of contributors.
#include <kcpolydb.h> #include <kcpolydb.h>
#include <stdio.h>
#include <stdlib.h> #include <cstdio>
#include <cstdlib>
#include "util/histogram.h" #include "util/histogram.h"
#include "util/random.h" #include "util/random.h"

View File

@ -4,11 +4,10 @@
#include "db/db_impl.h" #include "db/db_impl.h"
#include <stdint.h>
#include <stdio.h>
#include <algorithm> #include <algorithm>
#include <atomic> #include <atomic>
#include <cstdint>
#include <cstdio>
#include <set> #include <set>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -5,7 +5,7 @@
#ifndef STORAGE_LEVELDB_DB_DB_ITER_H_ #ifndef STORAGE_LEVELDB_DB_DB_ITER_H_
#define STORAGE_LEVELDB_DB_DB_ITER_H_ #define STORAGE_LEVELDB_DB_DB_ITER_H_
#include <stdint.h> #include <cstdint>
#include "db/dbformat.h" #include "db/dbformat.h"
#include "leveldb/db.h" #include "leveldb/db.h"

View File

@ -4,8 +4,7 @@
#include "db/dbformat.h" #include "db/dbformat.h"
#include <stdio.h> #include <cstdio>
#include <sstream> #include <sstream>
#include "port/port.h" #include "port/port.h"

View File

@ -4,7 +4,7 @@
#include "leveldb/dumpfile.h" #include "leveldb/dumpfile.h"
#include <stdio.h> #include <cstdio>
#include "db/dbformat.h" #include "db/dbformat.h"
#include "db/filename.h" #include "db/filename.h"

View File

@ -4,8 +4,8 @@
#include "db/filename.h" #include "db/filename.h"
#include <ctype.h> #include <cassert>
#include <stdio.h> #include <cstdio>
#include "db/dbformat.h" #include "db/dbformat.h"
#include "leveldb/env.h" #include "leveldb/env.h"

View File

@ -7,8 +7,7 @@
#ifndef STORAGE_LEVELDB_DB_FILENAME_H_ #ifndef STORAGE_LEVELDB_DB_FILENAME_H_
#define STORAGE_LEVELDB_DB_FILENAME_H_ #define STORAGE_LEVELDB_DB_FILENAME_H_
#include <stdint.h> #include <cstdint>
#include <string> #include <string>
#include "leveldb/slice.h" #include "leveldb/slice.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // 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. // found in the LICENSE file. See the AUTHORS file for names of contributors.
#include <stdio.h> #include <cstdio>
#include "leveldb/dumpfile.h" #include "leveldb/dumpfile.h"
#include "leveldb/env.h" #include "leveldb/env.h"

View File

@ -4,7 +4,7 @@
#include "db/log_reader.h" #include "db/log_reader.h"
#include <stdio.h> #include <cstdio>
#include "leveldb/env.h" #include "leveldb/env.h"
#include "util/coding.h" #include "util/coding.h"

View File

@ -5,7 +5,7 @@
#ifndef STORAGE_LEVELDB_DB_LOG_READER_H_ #ifndef STORAGE_LEVELDB_DB_LOG_READER_H_
#define STORAGE_LEVELDB_DB_LOG_READER_H_ #define STORAGE_LEVELDB_DB_LOG_READER_H_
#include <stdint.h> #include <cstdint>
#include "db/log_format.h" #include "db/log_format.h"
#include "leveldb/slice.h" #include "leveldb/slice.h"

View File

@ -4,7 +4,7 @@
#include "db/log_writer.h" #include "db/log_writer.h"
#include <stdint.h> #include <cstdint>
#include "leveldb/env.h" #include "leveldb/env.h"
#include "util/coding.h" #include "util/coding.h"

View File

@ -5,7 +5,7 @@
#ifndef STORAGE_LEVELDB_DB_LOG_WRITER_H_ #ifndef STORAGE_LEVELDB_DB_LOG_WRITER_H_
#define STORAGE_LEVELDB_DB_LOG_WRITER_H_ #define STORAGE_LEVELDB_DB_LOG_WRITER_H_
#include <stdint.h> #include <cstdint>
#include "db/log_format.h" #include "db/log_format.h"
#include "leveldb/slice.h" #include "leveldb/slice.h"

View File

@ -7,8 +7,7 @@
#ifndef STORAGE_LEVELDB_DB_TABLE_CACHE_H_ #ifndef STORAGE_LEVELDB_DB_TABLE_CACHE_H_
#define STORAGE_LEVELDB_DB_TABLE_CACHE_H_ #define STORAGE_LEVELDB_DB_TABLE_CACHE_H_
#include <stdint.h> #include <cstdint>
#include <string> #include <string>
#include "db/dbformat.h" #include "db/dbformat.h"

View File

@ -4,9 +4,8 @@
#include "db/version_set.h" #include "db/version_set.h"
#include <stdio.h>
#include <algorithm> #include <algorithm>
#include <cstdio>
#include "db/filename.h" #include "db/filename.h"
#include "db/log_reader.h" #include "db/log_reader.h"

View File

@ -4,8 +4,7 @@
#include "helpers/memenv/memenv.h" #include "helpers/memenv/memenv.h"
#include <string.h> #include <cstring>
#include <limits> #include <limits>
#include <map> #include <map>
#include <string> #include <string>

View File

@ -18,7 +18,7 @@
#ifndef STORAGE_LEVELDB_INCLUDE_CACHE_H_ #ifndef STORAGE_LEVELDB_INCLUDE_CACHE_H_
#define STORAGE_LEVELDB_INCLUDE_CACHE_H_ #define STORAGE_LEVELDB_INCLUDE_CACHE_H_
#include <stdint.h> #include <cstdint>
#include "leveldb/export.h" #include "leveldb/export.h"
#include "leveldb/slice.h" #include "leveldb/slice.h"

View File

@ -5,8 +5,8 @@
#ifndef STORAGE_LEVELDB_INCLUDE_DB_H_ #ifndef STORAGE_LEVELDB_INCLUDE_DB_H_
#define STORAGE_LEVELDB_INCLUDE_DB_H_ #define STORAGE_LEVELDB_INCLUDE_DB_H_
#include <stdint.h> #include <cstdint>
#include <stdio.h> #include <cstdio>
#include "leveldb/export.h" #include "leveldb/export.h"
#include "leveldb/iterator.h" #include "leveldb/iterator.h"

View File

@ -13,9 +13,8 @@
#ifndef STORAGE_LEVELDB_INCLUDE_ENV_H_ #ifndef STORAGE_LEVELDB_INCLUDE_ENV_H_
#define STORAGE_LEVELDB_INCLUDE_ENV_H_ #define STORAGE_LEVELDB_INCLUDE_ENV_H_
#include <stdarg.h> #include <cstdarg>
#include <stdint.h> #include <cstdint>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -5,7 +5,7 @@
#ifndef STORAGE_LEVELDB_INCLUDE_OPTIONS_H_ #ifndef STORAGE_LEVELDB_INCLUDE_OPTIONS_H_
#define STORAGE_LEVELDB_INCLUDE_OPTIONS_H_ #define STORAGE_LEVELDB_INCLUDE_OPTIONS_H_
#include <stddef.h> #include <cstddef>
#include "leveldb/export.h" #include "leveldb/export.h"

View File

@ -15,10 +15,9 @@
#ifndef STORAGE_LEVELDB_INCLUDE_SLICE_H_ #ifndef STORAGE_LEVELDB_INCLUDE_SLICE_H_
#define STORAGE_LEVELDB_INCLUDE_SLICE_H_ #define STORAGE_LEVELDB_INCLUDE_SLICE_H_
#include <assert.h> #include <cassert>
#include <stddef.h> #include <cstddef>
#include <string.h> #include <cstring>
#include <string> #include <string>
#include "leveldb/export.h" #include "leveldb/export.h"

View File

@ -5,7 +5,7 @@
#ifndef STORAGE_LEVELDB_INCLUDE_TABLE_H_ #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_H_
#define STORAGE_LEVELDB_INCLUDE_TABLE_H_ #define STORAGE_LEVELDB_INCLUDE_TABLE_H_
#include <stdint.h> #include <cstdint>
#include "leveldb/export.h" #include "leveldb/export.h"
#include "leveldb/iterator.h" #include "leveldb/iterator.h"

View File

@ -13,7 +13,7 @@
#ifndef STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_
#define STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ #define STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_
#include <stdint.h> #include <cstdint>
#include "leveldb/export.h" #include "leveldb/export.h"
#include "leveldb/options.h" #include "leveldb/options.h"

View File

@ -5,8 +5,8 @@
#ifndef STORAGE_LEVELDB_TABLE_BLOCK_H_ #ifndef STORAGE_LEVELDB_TABLE_BLOCK_H_
#define STORAGE_LEVELDB_TABLE_BLOCK_H_ #define STORAGE_LEVELDB_TABLE_BLOCK_H_
#include <stddef.h> #include <cstddef>
#include <stdint.h> #include <cstdint>
#include "leveldb/iterator.h" #include "leveldb/iterator.h"

View File

@ -28,9 +28,8 @@
#include "table/block_builder.h" #include "table/block_builder.h"
#include <assert.h>
#include <algorithm> #include <algorithm>
#include <cassert>
#include "leveldb/comparator.h" #include "leveldb/comparator.h"
#include "leveldb/options.h" #include "leveldb/options.h"

View File

@ -5,8 +5,7 @@
#ifndef STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_H_ #ifndef STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_H_
#define STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_H_ #define STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_H_
#include <stdint.h> #include <cstdint>
#include <vector> #include <vector>
#include "leveldb/slice.h" #include "leveldb/slice.h"

View File

@ -9,9 +9,8 @@
#ifndef STORAGE_LEVELDB_TABLE_FILTER_BLOCK_H_ #ifndef STORAGE_LEVELDB_TABLE_FILTER_BLOCK_H_
#define STORAGE_LEVELDB_TABLE_FILTER_BLOCK_H_ #define STORAGE_LEVELDB_TABLE_FILTER_BLOCK_H_
#include <stddef.h> #include <cstddef>
#include <stdint.h> #include <cstdint>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -5,8 +5,7 @@
#ifndef STORAGE_LEVELDB_TABLE_FORMAT_H_ #ifndef STORAGE_LEVELDB_TABLE_FORMAT_H_
#define STORAGE_LEVELDB_TABLE_FORMAT_H_ #define STORAGE_LEVELDB_TABLE_FORMAT_H_
#include <stdint.h> #include <cstdint>
#include <string> #include <string>
#include "leveldb/slice.h" #include "leveldb/slice.h"

View File

@ -4,7 +4,7 @@
#include "leveldb/table_builder.h" #include "leveldb/table_builder.h"
#include <assert.h> #include <cassert>
#include "leveldb/comparator.h" #include "leveldb/comparator.h"
#include "leveldb/env.h" #include "leveldb/env.h"

View File

@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // 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. // 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 "leveldb/cache.h"
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include "port/port.h" #include "port/port.h"
#include "port/thread_annotations.h" #include "port/thread_annotations.h"
#include "util/hash.h" #include "util/hash.h"

View File

@ -6,8 +6,8 @@
#include "util/crc32c.h" #include "util/crc32c.h"
#include <stddef.h> #include <cstddef>
#include <stdint.h> #include <cstdint>
#include "port/port.h" #include "port/port.h"
#include "util/coding.h" #include "util/coding.h"

View File

@ -5,8 +5,8 @@
#ifndef STORAGE_LEVELDB_UTIL_CRC32C_H_ #ifndef STORAGE_LEVELDB_UTIL_CRC32C_H_
#define STORAGE_LEVELDB_UTIL_CRC32C_H_ #define STORAGE_LEVELDB_UTIL_CRC32C_H_
#include <stddef.h> #include <cstddef>
#include <stdint.h> #include <cstdint>
namespace leveldb { namespace leveldb {
namespace crc32c { namespace crc32c {

View File

@ -4,7 +4,7 @@
#include "util/hash.h" #include "util/hash.h"
#include <string.h> #include <cstring>
#include "util/coding.h" #include "util/coding.h"

View File

@ -7,8 +7,8 @@
#ifndef STORAGE_LEVELDB_UTIL_HASH_H_ #ifndef STORAGE_LEVELDB_UTIL_HASH_H_
#define STORAGE_LEVELDB_UTIL_HASH_H_ #define STORAGE_LEVELDB_UTIL_HASH_H_
#include <stddef.h> #include <cstddef>
#include <stdint.h> #include <cstdint>
namespace leveldb { namespace leveldb {

View File

@ -4,8 +4,8 @@
#include "util/histogram.h" #include "util/histogram.h"
#include <math.h> #include <cmath>
#include <stdio.h> #include <cstdio>
#include "port/port.h" #include "port/port.h"

View File

@ -4,11 +4,9 @@
#include "util/logging.h" #include "util/logging.h"
#include <errno.h> #include <cstdarg>
#include <stdarg.h> #include <cstdio>
#include <stdio.h> #include <cstdlib>
#include <stdlib.h>
#include <limits> #include <limits>
#include "leveldb/env.h" #include "leveldb/env.h"

View File

@ -8,9 +8,8 @@
#ifndef STORAGE_LEVELDB_UTIL_LOGGING_H_ #ifndef STORAGE_LEVELDB_UTIL_LOGGING_H_
#define STORAGE_LEVELDB_UTIL_LOGGING_H_ #define STORAGE_LEVELDB_UTIL_LOGGING_H_
#include <stdint.h> #include <cstdint>
#include <stdio.h> #include <cstdio>
#include <string> #include <string>
#include "port/port.h" #include "port/port.h"

View File

@ -5,7 +5,7 @@
#ifndef STORAGE_LEVELDB_UTIL_RANDOM_H_ #ifndef STORAGE_LEVELDB_UTIL_RANDOM_H_
#define STORAGE_LEVELDB_UTIL_RANDOM_H_ #define STORAGE_LEVELDB_UTIL_RANDOM_H_
#include <stdint.h> #include <cstdint>
namespace leveldb { namespace leveldb {

View File

@ -4,7 +4,7 @@
#include "leveldb/status.h" #include "leveldb/status.h"
#include <stdio.h> #include <cstdio>
#include "port/port.h" #include "port/port.h"