Skip to content

Commit

Permalink
Cleanup: Modernize deprecated C library headers
Browse files Browse the repository at this point in the history
Some headers from C library were deprecated in C++ and are no
longer welcome in C++ codebases. For more details refer to the
C++14 Standard [depr.c.headers] section.

This commit replaces C standard library headers with their C++ alternatives
  • Loading branch information
ol-imorozko authored and GeorgyKirichenko committed Apr 11, 2024
1 parent b8a0aa8 commit ff65644
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion autotest/common.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <stdio.h>
#include <cstdio>

#define ANSI_COLOR_RED "\x1b[31m"
#define ANSI_COLOR_GREEN "\x1b[32m"
Expand Down
4 changes: 2 additions & 2 deletions cli/latch.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

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

namespace latch
{
Expand Down
2 changes: 1 addition & 1 deletion controlplane/acl/dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "rule.h"

#ifdef ACL_DEBUG
#include <stdio.h>
#include <cstdio>
#define debug(format...) printf(format)
#else
#define debug(format...)
Expand Down
2 changes: 1 addition & 1 deletion controlplane/acl_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <set>
#include <unordered_map>

#include <inttypes.h>
#include <cinttypes>

using tAclGroupId = uint32_t;

Expand Down
2 changes: 1 addition & 1 deletion controlplane/acl_tree.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <inttypes.h>
#include <cinttypes>

#include "common/acl.h"

Expand Down
2 changes: 1 addition & 1 deletion dataplane/checksum.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <inttypes.h>
#include <cinttypes>

#include <rte_icmp.h>
#include <rte_ip.h>
Expand Down
2 changes: 1 addition & 1 deletion dataplane/common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <arpa/inet.h>
#include <stdio.h>
#include <cstdio>

#include <rte_ether.h>
#include <rte_hash_crc.h>
Expand Down
2 changes: 1 addition & 1 deletion dataplane/debug_latch.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#ifdef CONFIG_YADECAP_AUTOTEST

#include <stdint.h>
#include <cstdint>
#include <unistd.h>

#define LATCH_USLEEP_CYCLE 50
Expand Down
2 changes: 1 addition & 1 deletion dataplane/dynamic_table.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <inttypes.h>
#include <cinttypes>

#include "common/config.h"
#include "common/define.h"
Expand Down
2 changes: 1 addition & 1 deletion dataplane/flat.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <inttypes.h>
#include <cinttypes>

#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion dataplane/fragmentation.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <inttypes.h>
#include <cinttypes>

#include <atomic>
#include <map>
Expand Down
2 changes: 1 addition & 1 deletion dataplane/hashtable.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <cstdint>
#include <memory.h>
#include <stdint.h>

#include <rte_byteorder.h>
#include <rte_common.h>
Expand Down
2 changes: 1 addition & 1 deletion dataplane/sock_dev.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <stdint.h>
#include <cstdint>

#define SOCK_DEV_PREFIX "sock_dev:"

Expand Down
2 changes: 1 addition & 1 deletion ext/murmurhash3.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#define FORCE_INLINE __forceinline

#include <stdlib.h>
#include <cstdlib>

#define ROTL32(x,y) _rotl(x,y)
#define ROTL64(x,y) _rotl64(x,y)
Expand Down
2 changes: 1 addition & 1 deletion ext/xxhash32.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//

#pragma once
#include <stdint.h> // for uint32_t and uint64_t
#include <cstdint> // for uint32_t and uint64_t

/// XXHash (32 bit), based on Yann Collet's descriptions, see http://cyan4973.github.io/xxHash/
/** How to use:
Expand Down
2 changes: 1 addition & 1 deletion librib/libyabird.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ extern "C"
//#define YANET_DEBUG

#ifdef YANET_DEBUG
#include <stdio.h>
#include <cstdio>

extern int yanet_logfd;
#define BP(fmt, ...) \
Expand Down

0 comments on commit ff65644

Please sign in to comment.