summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-02-20 13:43:08 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2024-02-20 13:49:04 +0100
commit40a75722c43ae24cb9a99d6730a3b25b65819c49 (patch)
treea5e7292b13ed1a77a443f367ea0fd7b2e66b0742
parent04ea92054757272c344afdf8d8e68046c7678b37 (diff)
Modernize standard library includes
This was automated with sed and git-clang-format, and then I had to fix up the top of policy.cc by hand as git-clang-format accidentally indented it by two spaces.
-rw-r--r--apt-pkg/acquire-item.cc12
-rw-r--r--apt-pkg/acquire-method.cc8
-rw-r--r--apt-pkg/acquire-method.h4
-rw-r--r--apt-pkg/acquire-worker.cc8
-rw-r--r--apt-pkg/acquire.cc8
-rw-r--r--apt-pkg/acquire.h2
-rw-r--r--apt-pkg/algorithms.cc2
-rw-r--r--apt-pkg/aptconfiguration.cc10
-rw-r--r--apt-pkg/cachefile.cc4
-rw-r--r--apt-pkg/cachefile.h2
-rw-r--r--apt-pkg/cachefilter-patterns.h2
-rw-r--r--apt-pkg/cachefilter.cc2
-rw-r--r--apt-pkg/cacheiterators.h2
-rw-r--r--apt-pkg/cacheset.cc6
-rw-r--r--apt-pkg/cacheset.h2
-rw-r--r--apt-pkg/cdrom.cc5
-rw-r--r--apt-pkg/cdrom.h3
-rw-r--r--apt-pkg/clean.cc2
-rw-r--r--apt-pkg/contrib/arfile.cc2
-rw-r--r--apt-pkg/contrib/cdromutl.cc6
-rw-r--r--apt-pkg/contrib/cmndline.cc6
-rw-r--r--apt-pkg/contrib/configuration.cc10
-rw-r--r--apt-pkg/contrib/error.cc10
-rw-r--r--apt-pkg/contrib/error.h4
-rw-r--r--apt-pkg/contrib/extracttar.cc4
-rw-r--r--apt-pkg/contrib/fileutl.cc15
-rw-r--r--apt-pkg/contrib/fileutl.h2
-rw-r--r--apt-pkg/contrib/gpgv.cc10
-rw-r--r--apt-pkg/contrib/hashes.cc6
-rw-r--r--apt-pkg/contrib/mmap.cc4
-rw-r--r--apt-pkg/contrib/progress.cc4
-rw-r--r--apt-pkg/contrib/srvrec.cc4
-rw-r--r--apt-pkg/contrib/string_view.h2
-rw-r--r--apt-pkg/contrib/strutl.cc18
-rw-r--r--apt-pkg/contrib/strutl.h6
-rw-r--r--apt-pkg/contrib/weakptr.h2
-rw-r--r--apt-pkg/deb/debfile.cc4
-rw-r--r--apt-pkg/deb/debindexfile.cc2
-rw-r--r--apt-pkg/deb/deblistparser.cc6
-rw-r--r--apt-pkg/deb/debmetaindex.cc2
-rw-r--r--apt-pkg/deb/debrecords.cc2
-rw-r--r--apt-pkg/deb/debsrcrecords.cc8
-rw-r--r--apt-pkg/deb/debsrcrecords.h2
-rw-r--r--apt-pkg/deb/debsystem.cc8
-rw-r--r--apt-pkg/deb/debversion.cc6
-rw-r--r--apt-pkg/deb/dpkgpm.cc12
-rw-r--r--apt-pkg/deb/dpkgpm.h3
-rw-r--r--apt-pkg/depcache.cc4
-rw-r--r--apt-pkg/depcache.h2
-rw-r--r--apt-pkg/dirstream.cc2
-rw-r--r--apt-pkg/edsp.cc8
-rw-r--r--apt-pkg/edsp.h2
-rw-r--r--apt-pkg/edsp/edspindexfile.cc2
-rw-r--r--apt-pkg/edsp/edspsystem.cc4
-rw-r--r--apt-pkg/indexcopy.cc6
-rw-r--r--apt-pkg/indexcopy.h2
-rw-r--r--apt-pkg/init.cc2
-rw-r--r--apt-pkg/install-progress.cc4
-rw-r--r--apt-pkg/install-progress.h2
-rw-r--r--apt-pkg/metaindex.h2
-rw-r--r--apt-pkg/orderlist.cc4
-rw-r--r--apt-pkg/packagemanager.cc2
-rw-r--r--apt-pkg/pkgcache.cc4
-rw-r--r--apt-pkg/pkgcache.h6
-rw-r--r--apt-pkg/pkgcachegen.cc4
-rw-r--r--apt-pkg/pkgrecords.cc2
-rw-r--r--apt-pkg/policy.cc8
-rw-r--r--apt-pkg/sourcelist.cc6
-rw-r--r--apt-pkg/sourcelist.h2
-rw-r--r--apt-pkg/srcrecords.cc2
-rw-r--r--apt-pkg/tagfile.cc8
-rw-r--r--apt-pkg/tagfile.h4
-rw-r--r--apt-pkg/upgrade.h2
-rw-r--r--apt-pkg/version.cc4
-rw-r--r--apt-pkg/versionmatch.cc10
-rw-r--r--apt-private/acqprogress.cc6
-rw-r--r--apt-private/private-cachefile.cc2
-rw-r--r--apt-private/private-cacheset.cc2
-rw-r--r--apt-private/private-cmndline.cc6
-rw-r--r--apt-private/private-depends.cc2
-rw-r--r--apt-private/private-download.cc2
-rw-r--r--apt-private/private-install.cc4
-rw-r--r--apt-private/private-json-hooks.cc2
-rw-r--r--apt-private/private-main.cc4
-rw-r--r--apt-private/private-moo.cc6
-rw-r--r--apt-private/private-output.cc8
-rw-r--r--apt-private/private-search.cc2
-rw-r--r--apt-private/private-show.cc2
-rw-r--r--apt-private/private-source.cc8
-rw-r--r--apt-private/private-sources.cc2
-rw-r--r--apt-private/private-unmet.cc2
-rw-r--r--cmdline/apt-cache.cc6
-rw-r--r--cmdline/apt-config.cc2
-rw-r--r--cmdline/apt-dump-solver.cc2
-rw-r--r--cmdline/apt-extracttemplates.cc6
-rw-r--r--cmdline/apt-get.cc12
-rw-r--r--cmdline/apt-helper.cc2
-rw-r--r--cmdline/apt-internal-planner.cc4
-rw-r--r--cmdline/apt-internal-solver.cc4
-rw-r--r--cmdline/apt-mark.cc10
-rw-r--r--cmdline/apt-sortpkgs.cc2
-rw-r--r--ftparchive/apt-ftparchive.cc8
-rw-r--r--ftparchive/cachedb.cc4
-rw-r--r--ftparchive/cachedb.h8
-rw-r--r--ftparchive/contents.cc6
-rw-r--r--ftparchive/contents.h4
-rw-r--r--ftparchive/multicompress.cc2
-rw-r--r--ftparchive/multicompress.h4
-rw-r--r--ftparchive/override.cc6
-rw-r--r--ftparchive/writer.cc6
-rw-r--r--ftparchive/writer.h4
-rw-r--r--methods/aptmethod.h4
-rw-r--r--methods/basehttp.cc10
-rw-r--r--methods/basehttp.h2
-rw-r--r--methods/connect.cc6
-rw-r--r--methods/connect.h2
-rw-r--r--methods/ftp.cc14
-rw-r--r--methods/ftp.h2
-rw-r--r--methods/gpgv.cc12
-rw-r--r--methods/http.cc10
-rw-r--r--methods/rfc2553emu.cc6
-rw-r--r--methods/rred.cc10
-rw-r--r--methods/rsh.cc12
-rw-r--r--methods/rsh.h2
-rw-r--r--methods/store.cc2
-rw-r--r--test/interactive-helper/aptwebserver.cc12
-rw-r--r--test/interactive-helper/createdeb-cve-2020-27350.cc10
-rw-r--r--test/interactive-helper/rpmver.cc6
-rw-r--r--test/interactive-helper/test_fileutl.cc2
-rw-r--r--test/interactive-helper/test_udevcdrom.cc4
-rw-r--r--test/libapt/cdrom_test.cc2
-rw-r--r--test/libapt/cdromfindpackages_test.cc2
-rw-r--r--test/libapt/compareversion_test.cc2
-rw-r--r--test/libapt/extracttar_test.cc4
-rw-r--r--test/libapt/fileutl_test.cc4
-rw-r--r--test/libapt/globalerror_test.cc6
-rw-r--r--test/libapt/hashsums_test.cc2
-rw-r--r--test/libapt/indexcopytosourcelist_test.cc2
-rw-r--r--test/libapt/parsedepends_test.cc2
-rw-r--r--test/libapt/sourcelist_test.cc4
-rw-r--r--test/libapt/tagfile_test.cc4
141 files changed, 342 insertions, 346 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 400838dcb..3c491adc0 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -32,8 +32,13 @@
#include <apt-pkg/tagfile.h>
#include <algorithm>
-#include <ctime>
+#include <cerrno>
#include <chrono>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
#include <iostream>
#include <memory>
#include <numeric>
@@ -42,11 +47,6 @@
#include <string>
#include <unordered_set>
#include <vector>
-#include <errno.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc
index 089582561..7b1f4f1b5 100644
--- a/apt-pkg/acquire-method.cc
+++ b/apt-pkg/acquire-method.cc
@@ -24,15 +24,15 @@
#include <apt-pkg/strutl.h>
#include <algorithm>
+#include <cstdarg>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <iostream>
#include <iterator>
#include <sstream>
#include <string>
#include <vector>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <unistd.h>
/*}}}*/
diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h
index b4b238c4c..edee93996 100644
--- a/apt-pkg/acquire-method.h
+++ b/apt-pkg/acquire-method.h
@@ -22,8 +22,8 @@
#include <apt-pkg/hashes.h>
#include <apt-pkg/macros.h>
-#include <stdarg.h>
-#include <time.h>
+#include <cstdarg>
+#include <ctime>
#include <string>
#include <unordered_map>
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index 1bf07e82a..4f247cf84 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/apt-pkg/acquire-worker.cc
@@ -28,11 +28,11 @@
#include <string>
#include <vector>
+#include <cerrno>
+#include <csignal>
+#include <cstdio>
+#include <cstdlib>
#include <sstream>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 1cb55bf14..7ebfa4ffe 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -35,14 +35,14 @@
#include <tuple>
#include <vector>
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <dirent.h>
-#include <errno.h>
#include <fcntl.h>
#include <grp.h>
#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/select.h>
#include <sys/stat.h>
#include <sys/time.h>
diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h
index f7c40aa5f..6eb9a6581 100644
--- a/apt-pkg/acquire.h
+++ b/apt-pkg/acquire.h
@@ -73,7 +73,7 @@
#include <string>
#include <vector>
-#include <stddef.h>
+#include <cstddef>
#include <sys/select.h>
#include <sys/time.h>
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 24a41b70a..5869668cd 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -32,6 +32,7 @@
#include <apt-pkg/prettyprinters.h>
#include <cstdlib>
+#include <cstring>
#include <iostream>
#include <map>
#include <set>
@@ -39,7 +40,6 @@
#include <string>
#include <utility>
#include <vector>
-#include <string.h>
#include <sys/utsname.h>
#include <apti18n.h>
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index dbfa00bb3..982e68bb1 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -19,15 +19,15 @@
#include <apt-pkg/strutl.h>
#include <algorithm>
+#include <cctype>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <string>
#include <vector>
-#include <ctype.h>
#include <dirent.h>
#include <fcntl.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
/*}}}*/
diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc
index 4c3cc9586..e27688b4e 100644
--- a/apt-pkg/cachefile.cc
+++ b/apt-pkg/cachefile.cc
@@ -27,13 +27,13 @@
#include <apt-pkg/progress.h>
#include <apt-pkg/sourcelist.h>
+#include <cstring>
#include <limits>
#include <memory>
#include <string>
#include <vector>
-#include <string.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
#include <apti18n.h>
diff --git a/apt-pkg/cachefile.h b/apt-pkg/cachefile.h
index 4e26e6dab..cea802dc6 100644
--- a/apt-pkg/cachefile.h
+++ b/apt-pkg/cachefile.h
@@ -16,7 +16,7 @@
#ifndef PKGLIB_CACHEFILE_H
#define PKGLIB_CACHEFILE_H
-#include <stddef.h>
+#include <cstddef>
#include <apt-pkg/depcache.h>
#include <apt-pkg/macros.h>
diff --git a/apt-pkg/cachefilter-patterns.h b/apt-pkg/cachefilter-patterns.h
index fa4605253..1f2f4f781 100644
--- a/apt-pkg/cachefilter-patterns.h
+++ b/apt-pkg/cachefilter-patterns.h
@@ -14,12 +14,12 @@
#include <apt-pkg/header-is-private.h>
#include <apt-pkg/string_view.h>
#include <apt-pkg/strutl.h>
+#include <cassert>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
-#include <assert.h>
namespace APT
{
diff --git a/apt-pkg/cachefilter.cc b/apt-pkg/cachefilter.cc
index eadbb98c7..e9334134f 100644
--- a/apt-pkg/cachefilter.cc
+++ b/apt-pkg/cachefilter.cc
@@ -14,11 +14,11 @@
#include <apt-pkg/strutl.h>
#include <algorithm>
+#include <cstring>
#include <string>
#include <unordered_map>
#include <fnmatch.h>
#include <regex.h>
-#include <string.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 074973048..9ed5c1719 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -39,7 +39,7 @@
#include <string>
#include <apt-pkg/string_view.h>
-#include <string.h>
+#include <cstring>
// abstract Iterator template /*{{{*/
/* This template provides the very basic iterator methods we
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index ee0dcee28..bfc85ef49 100644
--- a/apt-pkg/cacheset.cc
+++ b/apt-pkg/cacheset.cc
@@ -25,13 +25,13 @@
#include <apt-pkg/policy.h>
#include <apt-pkg/versionmatch.h>
+#include <cstddef>
+#include <cstdio>
+#include <cstring>
#include <list>
#include <string>
#include <vector>
#include <regex.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index 4ea78bcae..5dbb9bf08 100644
--- a/apt-pkg/cacheset.h
+++ b/apt-pkg/cacheset.h
@@ -24,7 +24,7 @@
#include <string>
#include <vector>
-#include <stddef.h>
+#include <cstddef>
#include <apt-pkg/error.h>
#include <apt-pkg/macros.h>
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index ea10d10ad..70192a044 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -12,16 +12,15 @@
#include <apt-pkg/strutl.h>
#include <algorithm>
+#include <cstdio>
+#include <cstring>
#include <fstream>
#include <iostream>
-#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <dirent.h>
#include <dlfcn.h>
-#include <stdio.h>
-#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/apt-pkg/cdrom.h b/apt-pkg/cdrom.h
index d3fc7710b..d5584dfab 100644
--- a/apt-pkg/cdrom.h
+++ b/apt-pkg/cdrom.h
@@ -6,8 +6,7 @@
#include <string>
#include <vector>
-#include <stddef.h>
-
+#include <cstddef>
class Configuration;
class OpProgress;
diff --git a/apt-pkg/clean.cc b/apt-pkg/clean.cc
index 9dd56e609..d3b0ac3ed 100644
--- a/apt-pkg/clean.cc
+++ b/apt-pkg/clean.cc
@@ -17,10 +17,10 @@
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/strutl.h>
+#include <cstring>
#include <string>
#include <dirent.h>
#include <fcntl.h>
-#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/apt-pkg/contrib/arfile.cc b/apt-pkg/contrib/arfile.cc
index 6d4a1f158..dfc380b77 100644
--- a/apt-pkg/contrib/arfile.cc
+++ b/apt-pkg/contrib/arfile.cc
@@ -20,8 +20,8 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/strutl.h>
+#include <cstring>
#include <string>
-#include <string.h>
#include <sys/types.h>
#include <apti18n.h>
diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc
index f4020176a..5e2255fa3 100644
--- a/apt-pkg/contrib/cdromutl.cc
+++ b/apt-pkg/contrib/cdromutl.cc
@@ -18,14 +18,14 @@
#include <apt-pkg/hashes.h>
#include <apt-pkg/strutl.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <dirent.h>
#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <unistd.h>
diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc
index 998af2fd6..38f8521f9 100644
--- a/apt-pkg/contrib/cmndline.cc
+++ b/apt-pkg/contrib/cmndline.cc
@@ -21,10 +21,10 @@
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
+#include <cstddef>
+#include <cstdlib>
+#include <cstring>
#include <string>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index a5f97729c..abda6b66b 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -27,12 +27,12 @@
#include <apt-pkg/strutl.h>
#include <apt-pkg/string_view.h>
-#include <ctype.h>
+#include <cctype>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <regex.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <algorithm>
#include <array>
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index dd28af16d..c9bb622e7 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -23,15 +23,15 @@
#include <apt-pkg/error.h>
#include <algorithm>
+#include <cerrno>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <string>
-#include <errno.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <unistd.h>
/*}}}*/
diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h
index dd50b9cc4..35e39ee0e 100644
--- a/apt-pkg/contrib/error.h
+++ b/apt-pkg/contrib/error.h
@@ -49,8 +49,8 @@
#include <list>
#include <string>
-#include <stdarg.h>
-#include <stddef.h>
+#include <cstdarg>
+#include <cstddef>
class APT_PUBLIC GlobalError /*{{{*/
{
diff --git a/apt-pkg/contrib/extracttar.cc b/apt-pkg/contrib/extracttar.cc
index dc2437528..96cc513f0 100644
--- a/apt-pkg/contrib/extracttar.cc
+++ b/apt-pkg/contrib/extracttar.cc
@@ -25,11 +25,11 @@
#include <apt-pkg/strutl.h>
#include <algorithm>
+#include <csignal>
+#include <cstring>
#include <iostream>
#include <string>
#include <fcntl.h>
-#include <signal.h>
-#include <string.h>
#include <unistd.h>
#include <apti18n.h>
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 99b1df3ff..81e6fec85 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -35,28 +35,27 @@
#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/strutl.h>
+#include <cctype>
+#include <cerrno>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include <ctime>
#include <iostream>
#include <string>
#include <vector>
-#include <ctype.h>
#include <dirent.h>
-#include <errno.h>
#include <fcntl.h>
#include <glob.h>
#include <grp.h>
#include <pwd.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
#include <sys/select.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/wait.h>
-#include <time.h>
#include <unistd.h>
#include <algorithm>
@@ -81,8 +80,8 @@
#ifdef HAVE_SYSTEMD
#include <systemd/sd-bus.h>
#endif
+#include <cstdint>
#include <endian.h>
-#include <stdint.h>
#if __gnu_linux__
#include <sys/prctl.h>
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 970b11878..11f4871f6 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -27,11 +27,11 @@
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/macros.h>
+#include <ctime>
#include <set>
#include <string>
#include <vector>
#include <sys/stat.h>
-#include <time.h>
/* Define this for python-apt */
#define APT_HAS_GZIP 1
diff --git a/apt-pkg/contrib/gpgv.cc b/apt-pkg/contrib/gpgv.cc
index 3368ece84..2fa5b0c30 100644
--- a/apt-pkg/contrib/gpgv.cc
+++ b/apt-pkg/contrib/gpgv.cc
@@ -8,12 +8,12 @@
#include <apt-pkg/gpgv.h>
#include <apt-pkg/strutl.h>
-#include <errno.h>
+#include <cerrno>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <fcntl.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/wait.h>
#include <unistd.h>
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc
index 313b1d37d..7ff5f9e9f 100644
--- a/apt-pkg/contrib/hashes.cc
+++ b/apt-pkg/contrib/hashes.cc
@@ -21,11 +21,11 @@
#include <apt-pkg/tagfile.h>
#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <cstdlib>
#include <iostream>
#include <string>
-#include <assert.h>
-#include <stddef.h>
-#include <stdlib.h>
#include <unistd.h>
#include <gcrypt.h>
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index 0568e1cd0..56e0801f6 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -23,11 +23,11 @@
#include <apt-pkg/macros.h>
#include <apt-pkg/mmap.h>
+#include <cerrno>
#include <cstdint>
+#include <cstdlib>
#include <cstring>
#include <string>
-#include <errno.h>
-#include <stdlib.h>
#include <unistd.h>
#include <apti18n.h>
diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc
index eb688b9a2..a2c4332ca 100644
--- a/apt-pkg/contrib/progress.cc
+++ b/apt-pkg/contrib/progress.cc
@@ -13,12 +13,12 @@
#include <apt-pkg/error.h>
#include <apt-pkg/progress.h>
-#include <cmath>
#include <chrono>
+#include <cmath>
+#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
-#include <stdio.h>
#include <sys/time.h>
#include <apti18n.h>
diff --git a/apt-pkg/contrib/srvrec.cc b/apt-pkg/contrib/srvrec.cc
index 3eb5f1d4c..4a68f3578 100644
--- a/apt-pkg/contrib/srvrec.cc
+++ b/apt-pkg/contrib/srvrec.cc
@@ -10,11 +10,11 @@
#include <netdb.h>
-#include <arpa/nameser.h>
+#include <ctime>
#include <arpa/inet.h>
+#include <arpa/nameser.h>
#include <netinet/in.h>
#include <resolv.h>
-#include <time.h>
#include <algorithm>
#include <memory>
diff --git a/apt-pkg/contrib/string_view.h b/apt-pkg/contrib/string_view.h
index 04f6ff115..71f47f563 100644
--- a/apt-pkg/contrib/string_view.h
+++ b/apt-pkg/contrib/string_view.h
@@ -12,8 +12,8 @@
#if !defined(APT_STRINGVIEW_H)
#define APT_STRINGVIEW_H
#include <apt-pkg/macros.h>
+#include <cstring>
#include <string>
-#include <string.h>
namespace APT {
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 67100f1a2..3689dc17a 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -35,18 +35,18 @@
#include <string>
#include <vector>
-#include <ctype.h>
-#include <errno.h>
+#include <cctype>
+#include <cerrno>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <cwchar>
#include <iconv.h>
#include <regex.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
#include <unistd.h>
-#include <wchar.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h
index 1fdc8dc99..7cf9b456d 100644
--- a/apt-pkg/contrib/strutl.h
+++ b/apt-pkg/contrib/strutl.h
@@ -19,14 +19,14 @@
#ifndef STRUTL_H
#define STRUTL_H
+#include <apt-pkg/string_view.h>
+#include <cstddef>
#include <cstring>
+#include <ctime>
#include <iostream>
#include <limits>
#include <string>
#include <vector>
-#include <apt-pkg/string_view.h>
-#include <stddef.h>
-#include <time.h>
#include "macros.h"
diff --git a/apt-pkg/contrib/weakptr.h b/apt-pkg/contrib/weakptr.h
index 8de727d89..6cfa948ac 100644
--- a/apt-pkg/contrib/weakptr.h
+++ b/apt-pkg/contrib/weakptr.h
@@ -21,8 +21,8 @@
#ifndef WEAK_POINTER_H
#define WEAK_POINTER_H
+#include <cstddef>
#include <set>
-#include <stddef.h>
/**
* Class for objects providing support for weak pointers.
diff --git a/apt-pkg/deb/debfile.cc b/apt-pkg/deb/debfile.cc
index 645a579ef..1d61c8227 100644
--- a/apt-pkg/deb/debfile.cc
+++ b/apt-pkg/deb/debfile.cc
@@ -28,10 +28,10 @@
#include <apt-pkg/tagfile.h>
#include <algorithm>
-#include <string>
+#include <cstring>
#include <sstream>
+#include <string>
#include <vector>
-#include <string.h>
#include <sys/stat.h>
#include <apti18n.h>
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index e1698e151..c4115e53e 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -25,11 +25,11 @@
#include <apt-pkg/srcrecords.h>
#include <apt-pkg/strutl.h>
+#include <cstdio>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
-#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 6b76c4d07..8099b36e4 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -25,11 +25,11 @@
#include <apt-pkg/tagfile.h>
#include <algorithm>
+#include <cctype>
+#include <cstddef>
+#include <cstring>
#include <string>
#include <vector>
-#include <ctype.h>
-#include <stddef.h>
-#include <string.h>
/*}}}*/
using std::string;
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index 3fef976e9..0f05cb21a 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -24,7 +24,7 @@
#include <utility>
#include <vector>
-#include <string.h>
+#include <cstring>
#include <sys/stat.h>
#include <apti18n.h>
diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc
index e2ffaefff..b9d1b6e2f 100644
--- a/apt-pkg/deb/debrecords.cc
+++ b/apt-pkg/deb/debrecords.cc
@@ -20,11 +20,11 @@
#include <apt-pkg/tagfile.h>
#include <algorithm>
+#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <langinfo.h>
-#include <string.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index 311bacfdd..ab78b88ce 100644
--- a/apt-pkg/deb/debsrcrecords.cc
+++ b/apt-pkg/deb/debsrcrecords.cc
@@ -22,12 +22,12 @@
#include <apt-pkg/tagfile.h>
#include <algorithm>
-#include <string>
+#include <cctype>
+#include <cstdlib>
+#include <cstring>
#include <sstream>
+#include <string>
#include <vector>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
/*}}}*/
using std::max;
diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h
index 1a0bbe0fd..6ba30c2ac 100644
--- a/apt-pkg/deb/debsrcrecords.h
+++ b/apt-pkg/deb/debsrcrecords.h
@@ -15,9 +15,9 @@
#include <apt-pkg/tagfile-keys.h>
#include <apt-pkg/tagfile.h>
+#include <cstddef>
#include <string>
#include <vector>
-#include <stddef.h>
class pkgIndexFile;
diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc
index 9c55e0a6e..a218005dc 100644
--- a/apt-pkg/deb/debsystem.cc
+++ b/apt-pkg/deb/debsystem.cc
@@ -24,14 +24,14 @@
#include <algorithm>
#include <sstream>
+#include <cctype>
+#include <cerrno>
+#include <cstdlib>
+#include <cstring>
#include <string>
#include <vector>
-#include <ctype.h>
#include <dirent.h>
-#include <errno.h>
#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/apt-pkg/deb/debversion.cc b/apt-pkg/deb/debversion.cc
index 005f1bce0..ec7c9538e 100644
--- a/apt-pkg/deb/debversion.cc
+++ b/apt-pkg/deb/debversion.cc
@@ -14,9 +14,9 @@
#include <apt-pkg/debversion.h>
#include <apt-pkg/pkgcache.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cctype>
+#include <cstdlib>
+#include <cstring>
/*}}}*/
debVersioningSystem debVS;
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 93effa959..4f87cc22b 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -24,15 +24,16 @@
#include <apt-pkg/strutl.h>
#include <apt-pkg/version.h>
+#include <cerrno>
+#include <csignal>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <ctime>
#include <dirent.h>
-#include <errno.h>
#include <fcntl.h>
#include <grp.h>
#include <pwd.h>
-#include <signal.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/stat.h>
@@ -40,7 +41,6 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <termios.h>
-#include <time.h>
#include <unistd.h>
#include <algorithm>
diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h
index caf7d3512..ed0b67b31 100644
--- a/apt-pkg/deb/dpkgpm.h
+++ b/apt-pkg/deb/dpkgpm.h
@@ -13,11 +13,10 @@
#include <apt-pkg/packagemanager.h>
#include <apt-pkg/pkgcache.h>
+#include <cstdio>
#include <map>
#include <string>
#include <vector>
-#include <stdio.h>
-
class pkgDepCache;
namespace APT { namespace Progress { class PackageManager; } }
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index c965781a4..e3e8d627c 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -29,6 +29,8 @@
#include <apt-pkg/versionmatch.h>
#include <algorithm>
+#include <cstdio>
+#include <cstring>
#include <iostream>
#include <iterator>
#include <list>
@@ -40,8 +42,6 @@
#include <unordered_map>
#include <utility>
#include <vector>
-#include <stdio.h>
-#include <string.h>
#include <sys/stat.h>
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index a850cf91a..5dd022b56 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -41,7 +41,7 @@
#include <apt-pkg/macros.h>
#include <apt-pkg/pkgcache.h>
-#include <stddef.h>
+#include <cstddef>
#include <list>
#include <memory>
diff --git a/apt-pkg/dirstream.cc b/apt-pkg/dirstream.cc
index d6cf0ab3f..ef9f08ebc 100644
--- a/apt-pkg/dirstream.cc
+++ b/apt-pkg/dirstream.cc
@@ -15,7 +15,7 @@
#include <apt-pkg/dirstream.h>
#include <apt-pkg/error.h>
-#include <errno.h>
+#include <cerrno>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/time.h>
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index 9d196eed3..b0ac4ae49 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -23,10 +23,10 @@
#include <apt-pkg/strutl.h>
#include <apt-pkg/tagfile.h>
-#include <ctype.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
+#include <cctype>
+#include <cstddef>
+#include <cstdio>
+#include <cstring>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/apt-pkg/edsp.h b/apt-pkg/edsp.h
index 434010dc4..0c37e231d 100644
--- a/apt-pkg/edsp.h
+++ b/apt-pkg/edsp.h
@@ -13,7 +13,7 @@
#include <apt-pkg/macros.h>
#include <apt-pkg/pkgcache.h>
-#include <stdio.h>
+#include <cstdio>
#include <list>
#include <string>
diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc
index faade6e0a..e97f16894 100644
--- a/apt-pkg/edsp/edspindexfile.cc
+++ b/apt-pkg/edsp/edspindexfile.cc
@@ -16,9 +16,9 @@
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/pkgrecords.h>
+#include <cstddef>
#include <memory>
#include <string>
-#include <stddef.h>
#include <unistd.h>
/*}}}*/
diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc
index c86f1ed3f..b12b20da8 100644
--- a/apt-pkg/edsp/edspsystem.cc
+++ b/apt-pkg/edsp/edspsystem.cc
@@ -18,8 +18,8 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/pkgcache.h>
-#include <stddef.h>
-#include <stdlib.h>
+#include <cstddef>
+#include <cstdlib>
#include <unistd.h>
#include <string>
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index 0d569265d..bf787036f 100644
--- a/apt-pkg/indexcopy.cc
+++ b/apt-pkg/indexcopy.cc
@@ -25,11 +25,11 @@
#include <apt-pkg/tagfile-keys.h>
#include <apt-pkg/tagfile.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <iostream>
#include <sstream>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/apt-pkg/indexcopy.h b/apt-pkg/indexcopy.h
index 41be15498..5fcce20d0 100644
--- a/apt-pkg/indexcopy.h
+++ b/apt-pkg/indexcopy.h
@@ -11,8 +11,8 @@
#include <vector>
#ifndef APT_11_CLEAN_HEADERS
+#include <cstdio>
#include <string>
-#include <stdio.h>
#endif
#include <apt-pkg/macros.h>
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index 3990a1f39..f1742c019 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -18,12 +18,12 @@
#include <apt-pkg/strutl.h>
#include <cstdlib>
+#include <cstring>
#include <fstream>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
-#include <string.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc
index c7f7573de..2b0dc21ea 100644
--- a/apt-pkg/install-progress.cc
+++ b/apt-pkg/install-progress.cc
@@ -7,12 +7,12 @@
#include <algorithm>
#include <cmath>
+#include <csignal>
+#include <cstdio>
#include <iostream>
#include <sstream>
#include <vector>
#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h
index 617ce2a35..db060b3bc 100644
--- a/apt-pkg/install-progress.h
+++ b/apt-pkg/install-progress.h
@@ -3,9 +3,9 @@
#include <apt-pkg/macros.h>
+#include <csignal>
#include <string>
#include <vector>
-#include <signal.h>
#include <unistd.h>
namespace APT {
diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h
index 3e9cf3718..e2a773c31 100644
--- a/apt-pkg/metaindex.h
+++ b/apt-pkg/metaindex.h
@@ -4,7 +4,7 @@
#include <apt-pkg/indexfile.h>
#include <apt-pkg/init.h>
-#include <stddef.h>
+#include <cstddef>
#include <string>
#include <vector>
diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc
index 49a3126b7..33d17fcec 100644
--- a/apt-pkg/orderlist.cc
+++ b/apt-pkg/orderlist.cc
@@ -71,9 +71,9 @@
#include <apt-pkg/pkgcache.h>
#include <algorithm>
+#include <cstdlib>
+#include <cstring>
#include <iostream>
-#include <stdlib.h>
-#include <string.h>
/*}}}*/
using namespace std;
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 48dd03f66..ce7677e83 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -29,10 +29,10 @@
#include <apt-pkg/strutl.h>
#include <apt-pkg/version.h>
+#include <cstddef>
#include <iostream>
#include <list>
#include <string>
-#include <stddef.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 06689aa33..ffe30fa92 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -32,11 +32,11 @@
#include <apt-pkg/version.h>
#include <algorithm>
+#include <cstddef>
+#include <cstring>
#include <sstream>
#include <string>
#include <vector>
-#include <stddef.h>
-#include <string.h>
#include <sys/stat.h>
#include <xxhash.h>
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index 55baa3cef..7c16f0dee 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -77,10 +77,10 @@
#include <apt-pkg/macros.h>
#include <apt-pkg/mmap.h>
-#include <cstddef> // required for nullptr_t
+#include <cstddef> // required for nullptr_t
+#include <cstdint>
+#include <ctime>
#include <string>
-#include <stdint.h>
-#include <time.h>
#include <apt-pkg/string_view.h>
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 3a85a9585..504756104 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -27,12 +27,12 @@
#include <apt-pkg/version.h>
#include <algorithm>
+#include <cstddef>
+#include <cstring>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
-#include <stddef.h>
-#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/apt-pkg/pkgrecords.cc b/apt-pkg/pkgrecords.cc
index 77aa8ce1b..83d19bb8b 100644
--- a/apt-pkg/pkgrecords.cc
+++ b/apt-pkg/pkgrecords.cc
@@ -15,8 +15,8 @@
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/pkgrecords.h>
+#include <cstddef>
#include <vector>
-#include <stddef.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index 68b3f5e5f..b1d8e7223 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -28,17 +28,17 @@
#include <apt-pkg/version.h>
#include <apt-pkg/versionmatch.h>
+#include <cctype>
+#include <cstddef>
+#include <cstring>
#include <iostream>
#include <random>
#include <sstream>
#include <string>
#include <vector>
-#include <ctype.h>
-#include <stddef.h>
-#include <string.h>
#include <apti18n.h>
- /*}}}*/
+ /*}}}*/
using namespace std;
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index e11afceed..65412b458 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -23,14 +23,14 @@
#include <apt-pkg/tagfile.h>
#include <algorithm>
+#include <cctype>
+#include <cstddef>
#include <cstring>
+#include <ctime>
#include <fstream>
#include <map>
#include <string>
#include <vector>
-#include <ctype.h>
-#include <stddef.h>
-#include <time.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h
index 454180371..2d7018824 100644
--- a/apt-pkg/sourcelist.h
+++ b/apt-pkg/sourcelist.h
@@ -25,7 +25,7 @@
#include <apt-pkg/macros.h>
#include <apt-pkg/pkgcache.h>
-#include <time.h>
+#include <ctime>
#include <map>
#include <string>
diff --git a/apt-pkg/srcrecords.cc b/apt-pkg/srcrecords.cc
index 03bda75e9..f2511b37b 100644
--- a/apt-pkg/srcrecords.cc
+++ b/apt-pkg/srcrecords.cc
@@ -20,9 +20,9 @@
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/srcrecords.h>
+#include <cstring>
#include <string>
#include <vector>
-#include <string.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index 047f88986..8f323bb5a 100644
--- a/apt-pkg/tagfile.cc
+++ b/apt-pkg/tagfile.cc
@@ -21,11 +21,11 @@
#include <list>
+#include <cctype>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <string>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h
index a9f581424..0020d284b 100644
--- a/apt-pkg/tagfile.h
+++ b/apt-pkg/tagfile.h
@@ -21,8 +21,8 @@
#include <apt-pkg/macros.h>
-#include <stdint.h>
-#include <stdio.h>
+#include <cstdint>
+#include <cstdio>
#include <list>
#include <string>
diff --git a/apt-pkg/upgrade.h b/apt-pkg/upgrade.h
index 8e8960197..00914a190 100644
--- a/apt-pkg/upgrade.h
+++ b/apt-pkg/upgrade.h
@@ -11,7 +11,7 @@
#define PKGLIB_UPGRADE_H
#include <apt-pkg/macros.h>
-#include <stddef.h>
+#include <cstddef>
class pkgDepCache;
class OpProgress;
diff --git a/apt-pkg/version.cc b/apt-pkg/version.cc
index e0b83e0cd..df01507e0 100644
--- a/apt-pkg/version.cc
+++ b/apt-pkg/version.cc
@@ -11,8 +11,8 @@
#include <apt-pkg/version.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstdlib>
+#include <cstring>
/*}}}*/
static pkgVersioningSystem *VSList[10];
diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc
index 83a969c4a..f95232ac3 100644
--- a/apt-pkg/versionmatch.cc
+++ b/apt-pkg/versionmatch.cc
@@ -17,14 +17,14 @@
#include <apt-pkg/strutl.h>
#include <apt-pkg/versionmatch.h>
+#include <cctype>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <string>
-#include <ctype.h>
#include <fnmatch.h>
#include <regex.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
/*}}}*/
using std::string;
diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc
index fa7edfc82..1f5acdd97 100644
--- a/apt-private/acqprogress.cc
+++ b/apt-private/acqprogress.cc
@@ -19,11 +19,11 @@
#include <apt-private/acqprogress.h>
#include <apt-private/private-output.h>
+#include <csignal>
+#include <cstdio>
+#include <cstring>
#include <iostream>
#include <sstream>
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
#include <unistd.h>
#include <apti18n.h>
diff --git a/apt-private/private-cachefile.cc b/apt-private/private-cachefile.cc
index 9d875b4a7..d46f2acc4 100644
--- a/apt-private/private-cachefile.cc
+++ b/apt-private/private-cachefile.cc
@@ -13,8 +13,8 @@
#include <apt-private/private-output.h>
#include <cstdlib>
+#include <cstring>
#include <ostream>
-#include <string.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc
index 1b2834ea1..bd8f629b1 100644
--- a/apt-private/private-cacheset.cc
+++ b/apt-private/private-cacheset.cc
@@ -13,7 +13,7 @@
#include <apt-private/private-cacheset.h>
-#include <stddef.h>
+#include <cstddef>
#include <apti18n.h>
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
index 2805685b0..79881d034 100644
--- a/apt-private/private-cmndline.cc
+++ b/apt-private/private-cmndline.cc
@@ -12,9 +12,9 @@
#include <apt-private/private-cmndline.h>
#include <apt-private/private-main.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstdarg>
+#include <cstdlib>
+#include <cstring>
#include <unistd.h>
#include <algorithm>
diff --git a/apt-private/private-depends.cc b/apt-private/private-depends.cc
index 95c747ee3..2664cc919 100644
--- a/apt-private/private-depends.cc
+++ b/apt-private/private-depends.cc
@@ -16,7 +16,7 @@
#include <string>
#include <vector>
-#include <stddef.h>
+#include <cstddef>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-private/private-download.cc b/apt-private/private-download.cc
index 84a088f3d..3f473b840 100644
--- a/apt-private/private-download.cc
+++ b/apt-private/private-download.cc
@@ -33,7 +33,7 @@
#endif
#include <sys/mount.h>
#endif
-#include <errno.h>
+#include <cerrno>
#include <sys/stat.h>
#include <sys/statvfs.h>
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index dbcba8fd1..254d93436 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -22,12 +22,12 @@
#include <apt-pkg/upgrade.h>
#include <algorithm>
+#include <cstdlib>
+#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>
-#include <stdlib.h>
-#include <string.h>
#include <apt-private/acqprogress.h>
#include <apt-private/private-cachefile.h>
diff --git a/apt-private/private-json-hooks.cc b/apt-private/private-json-hooks.cc
index ddf1c89d6..58185181e 100644
--- a/apt-private/private-json-hooks.cc
+++ b/apt-private/private-json-hooks.cc
@@ -20,7 +20,7 @@
#include <stack>
#include <unordered_map>
-#include <signal.h>
+#include <csignal>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/apt-private/private-main.cc b/apt-private/private-main.cc
index d4ce0ab2a..a80f03c99 100644
--- a/apt-private/private-main.cc
+++ b/apt-private/private-main.cc
@@ -10,8 +10,8 @@
#include <iostream>
#include <locale>
-#include <signal.h>
-#include <string.h>
+#include <csignal>
+#include <cstring>
#include <unistd.h>
#include <apti18n.h>
diff --git a/apt-private/private-moo.cc b/apt-private/private-moo.cc
index ca456ed96..2a9ed9391 100644
--- a/apt-private/private-moo.cc
+++ b/apt-private/private-moo.cc
@@ -17,12 +17,12 @@
#include <apt-private/private-output.h>
#include <apt-private/private-utils.h>
+#include <cstddef>
+#include <cstring>
+#include <ctime>
#include <iostream>
#include <sstream>
#include <string>
-#include <stddef.h>
-#include <string.h>
-#include <time.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc
index c73d5229b..93b942458 100644
--- a/apt-private/private-output.cc
+++ b/apt-private/private-output.cc
@@ -13,14 +13,14 @@
#include <apt-private/private-cachefile.h>
#include <apt-private/private-output.h>
+#include <csignal>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <iomanip>
#include <iostream>
#include <langinfo.h>
#include <regex.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
diff --git a/apt-private/private-search.cc b/apt-private/private-search.cc
index b2114740e..19a3bf0fa 100644
--- a/apt-private/private-search.cc
+++ b/apt-private/private-search.cc
@@ -20,13 +20,13 @@
#include <apt-private/private-search.h>
#include <apt-private/private-show.h>
+#include <cstring>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
-#include <string.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc
index 08a4fe6df..cefbd9b67 100644
--- a/apt-private/private-show.cc
+++ b/apt-private/private-show.cc
@@ -25,9 +25,9 @@
#include <apt-private/private-install.h>
#include <apt-private/private-show.h>
+#include <cstdio>
#include <ostream>
#include <string>
-#include <stdio.h>
#include <unistd.h>
#include <apti18n.h>
diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc
index 14bc5b43e..9b9409c80 100644
--- a/apt-private/private-source.cc
+++ b/apt-private/private-source.cc
@@ -31,10 +31,10 @@
#include <apt-pkg/debindexfile.h>
#include <apt-pkg/deblistparser.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/apt-private/private-sources.cc b/apt-private/private-sources.cc
index 4cfb87938..a7d003f08 100644
--- a/apt-private/private-sources.cc
+++ b/apt-private/private-sources.cc
@@ -13,9 +13,9 @@
#include <apt-private/private-sources.h>
#include <apt-private/private-utils.h>
+#include <cstddef>
#include <iostream>
#include <string>
-#include <stddef.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/apt-private/private-unmet.cc b/apt-private/private-unmet.cc
index f5161fcc3..229e5a29a 100644
--- a/apt-private/private-unmet.cc
+++ b/apt-private/private-unmet.cc
@@ -10,7 +10,7 @@
#include <apt-private/private-cacheset.h>
#include <apt-private/private-unmet.h>
-#include <stddef.h>
+#include <cstddef>
#include <iostream>
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index ffe650970..531500cc0 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -47,6 +47,9 @@
#include <apt-private/private-unmet.h>
#include <algorithm>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
@@ -56,9 +59,6 @@
#include <string>
#include <vector>
#include <regex.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <unistd.h>
#include <apti18n.h>
diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc
index 8ad7cac68..6b1e3850e 100644
--- a/cmdline/apt-config.cc
+++ b/cmdline/apt-config.cc
@@ -25,11 +25,11 @@
#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/strutl.h>
+#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
-#include <string.h>
#include <apt-private/private-cmndline.h>
#include <apt-private/private-main.h>
diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc
index ab44b9fd1..3e590355e 100644
--- a/cmdline/apt-dump-solver.cc
+++ b/cmdline/apt-dump-solver.cc
@@ -25,7 +25,7 @@
#include <sys/types.h>
#include <sys/wait.h>
-#include <string.h>
+#include <cstring>
#include <unistd.h>
#include <apti18n.h>
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index 88a204110..a578fa84b 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -35,10 +35,10 @@
#include <apt-private/private-cmndline.h>
#include <apt-private/private-main.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <iostream>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <unistd.h>
#include "apt-extracttemplates.h"
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index d41e0f243..2828ad68a 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -67,14 +67,14 @@
#include <apt-private/private-upgrade.h>
#include <apt-private/private-utils.h>
-#include <errno.h>
+#include <cerrno>
+#include <csignal>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <grp.h>
#include <pwd.h>
-#include <signal.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc
index 85795e0d2..f48cb293f 100644
--- a/cmdline/apt-helper.cc
+++ b/cmdline/apt-helper.cc
@@ -30,7 +30,7 @@
#include <string>
#include <vector>
-#include <stdlib.h>
+#include <cstdlib>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
diff --git a/cmdline/apt-internal-planner.cc b/cmdline/apt-internal-planner.cc
index be9de4ef4..c77997a7a 100644
--- a/cmdline/apt-internal-planner.cc
+++ b/cmdline/apt-internal-planner.cc
@@ -29,12 +29,12 @@
#include <apt-private/private-output.h>
#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <iostream>
#include <list>
#include <sstream>
#include <string>
-#include <stdlib.h>
-#include <string.h>
#include <unistd.h>
#include <apti18n.h>
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc
index 23af6dab7..094ed183c 100644
--- a/cmdline/apt-internal-solver.cc
+++ b/cmdline/apt-internal-solver.cc
@@ -29,12 +29,12 @@
#include <apt-private/private-output.h>
#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <iostream>
#include <list>
#include <sstream>
#include <string>
-#include <stdlib.h>
-#include <string.h>
#include <unistd.h>
#include <apti18n.h>
diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc
index 3f3b008ba..33716bb3c 100644
--- a/cmdline/apt-mark.cc
+++ b/cmdline/apt-mark.cc
@@ -26,16 +26,16 @@
#include <apt-private/private-output.h>
#include <algorithm>
+#include <cerrno>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
-#include <errno.h>
#include <fcntl.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/wait.h>
#include <unistd.h>
diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc
index 519825457..acbb2832e 100644
--- a/cmdline/apt-sortpkgs.cc
+++ b/cmdline/apt-sortpkgs.cc
@@ -27,11 +27,11 @@
#include <apt-private/private-main.h>
#include <algorithm>
+#include <cstdio>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
-#include <stdio.h>
#include <unistd.h>
#include <apti18n.h>
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index 0f6587281..5a915ff71 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -25,16 +25,16 @@
#include <algorithm>
#include <chrono>
#include <climits>
+#include <clocale>
+#include <cmath>
+#include <cstdio>
+#include <ctime>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
-#include <locale.h>
-#include <stdio.h>
#include <sys/stat.h>
#include <sys/time.h>
-#include <time.h>
-#include <math.h>
#include "apt-ftparchive.h"
#include "cachedb.h"
diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc
index dedb01eaa..7ad28732f 100644
--- a/ftparchive/cachedb.cc
+++ b/ftparchive/cachedb.cc
@@ -19,9 +19,9 @@
#include <apt-pkg/hashes.h>
#include <apt-pkg/strutl.h>
-#include <ctype.h>
+#include <cctype>
+#include <cstddef>
#include <netinet/in.h> // htonl, etc
-#include <stddef.h>
#include <strings.h>
#include <sys/stat.h>
diff --git a/ftparchive/cachedb.h b/ftparchive/cachedb.h
index 399e1f1ee..98817b9ec 100644
--- a/ftparchive/cachedb.h
+++ b/ftparchive/cachedb.h
@@ -15,11 +15,11 @@
#include <apt-pkg/hashes.h>
#include <db.h>
+#include <cerrno>
+#include <cstdint>
+#include <cstdio>
+#include <cstring>
#include <string>
-#include <errno.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
#include "contents.h"
#include "sources.h"
diff --git a/ftparchive/contents.cc b/ftparchive/contents.cc
index 8a7adfd8e..4835cc6dd 100644
--- a/ftparchive/contents.cc
+++ b/ftparchive/contents.cc
@@ -39,9 +39,9 @@
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include "contents.h"
diff --git a/ftparchive/contents.h b/ftparchive/contents.h
index 74607053e..6d960d6f4 100644
--- a/ftparchive/contents.h
+++ b/ftparchive/contents.h
@@ -11,9 +11,9 @@
#include <apt-pkg/dirstream.h>
+#include <cstddef>
+#include <cstdio>
#include <string>
-#include <stddef.h>
-#include <stdio.h>
class debDebFile;
class FileFd;
diff --git a/ftparchive/multicompress.cc b/ftparchive/multicompress.cc
index cdaa7a60a..ac85670d5 100644
--- a/ftparchive/multicompress.cc
+++ b/ftparchive/multicompress.cc
@@ -21,7 +21,7 @@
#include <apt-pkg/hashes.h>
#include <apt-pkg/strutl.h>
-#include <ctype.h>
+#include <cctype>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
diff --git a/ftparchive/multicompress.h b/ftparchive/multicompress.h
index c237269f2..198a6967f 100644
--- a/ftparchive/multicompress.h
+++ b/ftparchive/multicompress.h
@@ -18,10 +18,10 @@
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/fileutl.h>
+#include <cstdio>
+#include <ctime>
#include <string>
-#include <stdio.h>
#include <sys/types.h>
-#include <time.h>
class MultiCompress
{
diff --git a/ftparchive/override.cc b/ftparchive/override.cc
index 16fefeca5..4994d9f28 100644
--- a/ftparchive/override.cc
+++ b/ftparchive/override.cc
@@ -14,10 +14,10 @@
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
+#include <cctype>
+#include <cstdio>
+#include <cstring>
#include <utility>
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
#include "override.h"
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc
index ae427b120..2651cb83d 100644
--- a/ftparchive/writer.cc
+++ b/ftparchive/writer.cc
@@ -25,17 +25,17 @@
#include <apt-pkg/tagfile.h>
#include <algorithm>
+#include <cctype>
+#include <clocale>
+#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <memory>
#include <sstream>
#include <utility>
-#include <ctype.h>
#include <fnmatch.h>
#include <ftw.h>
-#include <locale.h>
-#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/ftparchive/writer.h b/ftparchive/writer.h
index 9aa216859..90fb27fe7 100644
--- a/ftparchive/writer.h
+++ b/ftparchive/writer.h
@@ -14,14 +14,14 @@
#include <apt-pkg/hashes.h>
+#include <cstdio>
+#include <cstdlib>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
-#include <stdio.h>
-#include <stdlib.h>
#include <sys/types.h>
#include "apt-ftparchive.h"
diff --git a/methods/aptmethod.h b/methods/aptmethod.h
index afc761cc5..26b8c0b55 100644
--- a/methods/aptmethod.h
+++ b/methods/aptmethod.h
@@ -16,7 +16,7 @@
#include <string>
#include <vector>
-#include <stdlib.h>
+#include <cstdlib>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -26,7 +26,7 @@
#include <apti18n.h>
#ifdef HAVE_SECCOMP
-#include <signal.h>
+#include <csignal>
#include <seccomp.h>
#endif
diff --git a/methods/basehttp.cc b/methods/basehttp.cc
index 9ed308116..26b633cba 100644
--- a/methods/basehttp.cc
+++ b/methods/basehttp.cc
@@ -16,19 +16,19 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/strutl.h>
+#include <cctype>
+#include <csignal>
+#include <cstdio>
+#include <cstdlib>
+#include <ctime>
#include <iostream>
#include <limits>
#include <map>
#include <string>
#include <string_view>
#include <vector>
-#include <ctype.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <sys/stat.h>
#include <sys/time.h>
-#include <time.h>
#include <unistd.h>
#include "basehttp.h"
diff --git a/methods/basehttp.h b/methods/basehttp.h
index 0f776b0a8..080ea527e 100644
--- a/methods/basehttp.h
+++ b/methods/basehttp.h
@@ -15,10 +15,10 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/strutl.h>
+#include <ctime>
#include <iostream>
#include <memory>
#include <string>
-#include <time.h>
using std::cout;
using std::endl;
diff --git a/methods/connect.cc b/methods/connect.cc
index bc2fe1de5..110f2fc75 100644
--- a/methods/connect.cc
+++ b/methods/connect.cc
@@ -22,13 +22,13 @@
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
+#include <cerrno>
+#include <cstdio>
+#include <cstring>
#include <list>
#include <set>
#include <sstream>
#include <string>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
#include <unistd.h>
// Internet stuff
diff --git a/methods/connect.h b/methods/connect.h
index 413484aa3..5c7904950 100644
--- a/methods/connect.h
+++ b/methods/connect.h
@@ -9,9 +9,9 @@
#ifndef CONNECT_H
#define CONNECT_H
+#include <cstddef>
#include <memory>
#include <string>
-#include <stddef.h>
#include "aptmethod.h"
diff --git a/methods/ftp.cc b/methods/ftp.cc
index aa0c0692c..379bf32b6 100644
--- a/methods/ftp.cc
+++ b/methods/ftp.cc
@@ -22,14 +22,14 @@
#include <apt-pkg/hashes.h>
#include <apt-pkg/strutl.h>
+#include <cctype>
+#include <cerrno>
+#include <csignal>
+#include <cstdarg>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <iostream>
-#include <ctype.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
diff --git a/methods/ftp.h b/methods/ftp.h
index da9887bfd..953a1da86 100644
--- a/methods/ftp.h
+++ b/methods/ftp.h
@@ -13,10 +13,10 @@
#include "connect.h"
#include <apt-pkg/strutl.h>
+#include <ctime>
#include <string>
#include <sys/socket.h>
#include <sys/types.h>
-#include <time.h>
class FTPConn
{
diff --git a/methods/gpgv.cc b/methods/gpgv.cc
index 267b43e08..f89aa8d2e 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -7,12 +7,12 @@
#include <apt-pkg/gpgv.h>
#include <apt-pkg/strutl.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cctype>
+#include <cerrno>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <sys/wait.h>
#include <unistd.h>
diff --git a/methods/http.cc b/methods/http.cc
index b4519a890..9b4550664 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -26,16 +26,16 @@
#include <apt-pkg/string_view.h>
#include <apt-pkg/strutl.h>
+#include <cerrno>
#include <chrono>
+#include <csignal>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <arpa/inet.h>
-#include <errno.h>
-#include <signal.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <sys/select.h>
#include <sys/stat.h>
#include <sys/time.h>
diff --git a/methods/rfc2553emu.cc b/methods/rfc2553emu.cc
index 41aa7470e..f5a3fc922 100644
--- a/methods/rfc2553emu.cc
+++ b/methods/rfc2553emu.cc
@@ -16,11 +16,11 @@
#include <config.h>
#include "rfc2553emu.h"
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <arpa/inet.h>
#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#ifndef HAVE_GETADDRINFO
// getaddrinfo - Resolve a hostname /*{{{*/
diff --git a/methods/rred.cc b/methods/rred.cc
index 3453bd3bc..aeefea5a2 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -20,17 +20,17 @@
#include <apt-private/private-cmndline.h>
+#include <cstddef>
#include <iostream>
#include <list>
#include <string>
#include <vector>
-#include <stddef.h>
#include <cassert>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <sys/stat.h>
#include <sys/time.h>
diff --git a/methods/rsh.cc b/methods/rsh.cc
index f5e12795a..4432d5a5e 100644
--- a/methods/rsh.cc
+++ b/methods/rsh.cc
@@ -33,12 +33,12 @@
#include <apt-pkg/strutl.h>
#include "rsh.h"
-#include <errno.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cerrno>
+#include <csignal>
+#include <cstdarg>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
diff --git a/methods/rsh.h b/methods/rsh.h
index 7545d5815..82ac54319 100644
--- a/methods/rsh.h
+++ b/methods/rsh.h
@@ -9,8 +9,8 @@
#ifndef APT_RSH_H
#define APT_RSH_H
+#include <ctime>
#include <string>
-#include <time.h>
#include <apt-pkg/strutl.h>
diff --git a/methods/store.cc b/methods/store.cc
index ef2008273..8b30efaf3 100644
--- a/methods/store.cc
+++ b/methods/store.cc
@@ -21,9 +21,9 @@
#include <apt-pkg/hashes.h>
#include <apt-pkg/strutl.h>
+#include <cstring>
#include <string>
#include <vector>
-#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc
index f4f8d95eb..a30581198 100644
--- a/test/interactive-helper/aptwebserver.cc
+++ b/test/interactive-helper/aptwebserver.cc
@@ -8,17 +8,17 @@
#include "teestream.h"
+#include <cerrno>
+#include <csignal>
+#include <cstddef>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
#include <dirent.h>
-#include <errno.h>
#include <netinet/in.h>
#include <regex.h>
-#include <signal.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
-#include <time.h>
#include <unistd.h>
#include <array>
diff --git a/test/interactive-helper/createdeb-cve-2020-27350.cc b/test/interactive-helper/createdeb-cve-2020-27350.cc
index 57c53ae91..84d1cfa63 100644
--- a/test/interactive-helper/createdeb-cve-2020-27350.cc
+++ b/test/interactive-helper/createdeb-cve-2020-27350.cc
@@ -1,11 +1,11 @@
#include <config.h>
-#include <errno.h>
+#include <cerrno>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <fcntl.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/test/interactive-helper/rpmver.cc b/test/interactive-helper/rpmver.cc
index b23ba2876..c1a0d7918 100644
--- a/test/interactive-helper/rpmver.cc
+++ b/test/interactive-helper/rpmver.cc
@@ -1,11 +1,11 @@
#include <config.h>
#include <apt-pkg/debversion.h>
-#include <ctype.h>
+#include <cctype>
+#include <cstdio>
+#include <cstdlib>
#include <rpm/misc.h>
#include <rpm/rpmio.h>
-#include <stdio.h>
-#include <stdlib.h>
#define xisdigit(x) isdigit(x)
#define xisalpha(x) isalpha(x)
diff --git a/test/interactive-helper/test_fileutl.cc b/test/interactive-helper/test_fileutl.cc
index 5569af1bf..edc699e62 100644
--- a/test/interactive-helper/test_fileutl.cc
+++ b/test/interactive-helper/test_fileutl.cc
@@ -4,8 +4,8 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/strutl.h>
+#include <cstdlib>
#include <fcntl.h>
-#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/test/interactive-helper/test_udevcdrom.cc b/test/interactive-helper/test_udevcdrom.cc
index 2355186d6..9ccdfdb9f 100644
--- a/test/interactive-helper/test_udevcdrom.cc
+++ b/test/interactive-helper/test_udevcdrom.cc
@@ -2,11 +2,11 @@
#include <apt-pkg/cdrom.h>
+#include <cassert>
+#include <cstddef>
#include <iostream>
#include <string>
#include <vector>
-#include <assert.h>
-#include <stddef.h>
int main()
{
diff --git a/test/libapt/cdrom_test.cc b/test/libapt/cdrom_test.cc
index e2ec05ab8..364971e2a 100644
--- a/test/libapt/cdrom_test.cc
+++ b/test/libapt/cdrom_test.cc
@@ -5,9 +5,9 @@
#include <apt-pkg/configuration.h>
#include <apt-pkg/fileutl.h>
+#include <cstring>
#include <string>
#include <vector>
-#include <string.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/cdromfindpackages_test.cc b/test/libapt/cdromfindpackages_test.cc
index cffa7aa9c..9e13c1d8b 100644
--- a/test/libapt/cdromfindpackages_test.cc
+++ b/test/libapt/cdromfindpackages_test.cc
@@ -5,10 +5,10 @@
#include <apt-pkg/fileutl.h>
#include <algorithm>
+#include <cstddef>
#include <iostream>
#include <string>
#include <vector>
-#include <stddef.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/compareversion_test.cc b/test/libapt/compareversion_test.cc
index 012932286..0fe32cf98 100644
--- a/test/libapt/compareversion_test.cc
+++ b/test/libapt/compareversion_test.cc
@@ -22,9 +22,9 @@
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
+#include <cstdlib>
#include <fstream>
#include <string>
-#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
diff --git a/test/libapt/extracttar_test.cc b/test/libapt/extracttar_test.cc
index c945a0c68..246aea737 100644
--- a/test/libapt/extracttar_test.cc
+++ b/test/libapt/extracttar_test.cc
@@ -1,10 +1,10 @@
#include <config.h>
-#include <apt-pkg/error.h>
#include <apt-pkg/dirstream.h>
+#include <apt-pkg/error.h>
#include <apt-pkg/extracttar.h>
+#include <cstdlib>
#include <iostream>
-#include <stdlib.h>
#include "assert.h"
#include <gtest/gtest.h>
diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc
index ecab2eb50..da772df3b 100644
--- a/test/libapt/fileutl_test.cc
+++ b/test/libapt/fileutl_test.cc
@@ -7,10 +7,10 @@
#include <apt-pkg/strutl.h>
#include <algorithm>
+#include <cstdlib>
+#include <cstring>
#include <string>
#include <vector>
-#include <stdlib.h>
-#include <string.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/globalerror_test.cc b/test/libapt/globalerror_test.cc
index ff14d4618..42e8355b3 100644
--- a/test/libapt/globalerror_test.cc
+++ b/test/libapt/globalerror_test.cc
@@ -2,10 +2,10 @@
#include <apt-pkg/error.h>
+#include <cerrno>
+#include <cstddef>
+#include <cstring>
#include <string>
-#include <errno.h>
-#include <stddef.h>
-#include <string.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc
index 2d8079e5a..901150e02 100644
--- a/test/libapt/hashsums_test.cc
+++ b/test/libapt/hashsums_test.cc
@@ -5,9 +5,9 @@
#include <apt-pkg/hashes.h>
#include <apt-pkg/strutl.h>
+#include <cstdlib>
#include <iostream>
#include <string>
-#include <stdlib.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/indexcopytosourcelist_test.cc b/test/libapt/indexcopytosourcelist_test.cc
index b0bfeb4b2..7dbe97329 100644
--- a/test/libapt/indexcopytosourcelist_test.cc
+++ b/test/libapt/indexcopytosourcelist_test.cc
@@ -4,8 +4,8 @@
#include <apt-pkg/configuration.h>
#include <apt-pkg/indexcopy.h>
+#include <cstdio>
#include <string>
-#include <stdio.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/parsedepends_test.cc b/test/libapt/parsedepends_test.cc
index ed849f768..f641c8c1c 100644
--- a/test/libapt/parsedepends_test.cc
+++ b/test/libapt/parsedepends_test.cc
@@ -4,8 +4,8 @@
#include <apt-pkg/deblistparser.h>
#include <apt-pkg/pkgcache.h>
+#include <cstring>
#include <string>
-#include <string.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc
index 42fab65a9..f6a1a91ae 100644
--- a/test/libapt/sourcelist_test.cc
+++ b/test/libapt/sourcelist_test.cc
@@ -3,9 +3,9 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/sourcelist.h>
+#include <cstdlib>
+#include <cstring>
#include <string>
-#include <stdlib.h>
-#include <string.h>
#include <unistd.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc
index 06ea01c32..51a574fb2 100644
--- a/test/libapt/tagfile_test.cc
+++ b/test/libapt/tagfile_test.cc
@@ -3,10 +3,10 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/tagfile.h>
+#include <cstdlib>
+#include <cstring>
#include <sstream>
#include <string>
-#include <stdlib.h>
-#include <string.h>
#include <unistd.h>
#include <gtest/gtest.h>