Minimal changes to bring the resolver into the C++ era
It took surprisingly few changes, considering the leap from C with some
K&R constructs to C++17; most of the diffs are adding explicit pointer
casts and renaming variables called 'class' or 'try'.
As a result of building as C++, some of the names are now mangled,
making clashes with bionic harder. However, some names remain C due to
the __BEGIN_DECLS / __END_DECLS macros, scheduled to be removed in a
later cleanup pass.
Test: atest netd_integration_test
Change-Id: I3aefb9078421ec42f98f97d917785b365545feba
diff --git a/resolv/resolv_static.h b/resolv/resolv_static.h
index 26863fd..8990e2d 100644
--- a/resolv/resolv_static.h
+++ b/resolv/resolv_static.h
@@ -2,6 +2,7 @@
#define _RESOLV_STATIC_H_
#include <netdb.h>
+#include <stdio.h>
/* this structure contains all the variables that were declared
* 'static' in the original NetBSD resolver code.
@@ -15,7 +16,7 @@
#define MAXALIASES 35
#define MAXADDRS 35
-typedef struct res_static {
+struct res_static {
char* h_addr_ptrs[MAXADDRS + 1];
char* host_aliases[MAXALIASES];
char hostbuf[8 * 1024];
@@ -25,8 +26,8 @@
const char* servent_ptr;
struct servent servent;
struct hostent host;
-} * res_static;
+};
-extern res_static __res_get_static(void);
+extern struct res_static* __res_get_static(void);
#endif // _RESOLV_STATIC_H_