Remove res_init.* and move its functionalities into ResState

Add the constructor for ResState and remove the methods used for
initializing RedState.

Bug: 174825679
Test: atest
Change-Id: Ie3e81572e606a6e6f441c2dd61667e31545a4c87
diff --git a/gethnamaddr.cpp b/gethnamaddr.cpp
index 6a5f116..4d01c64 100644
--- a/gethnamaddr.cpp
+++ b/gethnamaddr.cpp
@@ -76,8 +76,8 @@
 #include "netd_resolv/resolv.h"
 #include "res_comp.h"
 #include "res_debug.h"  // p_class(), p_type()
-#include "res_init.h"
 #include "resolv_cache.h"
+#include "resolv_private.h"
 #include "stats.pb.h"
 
 using android::net::NetworkDnsEventReported;
@@ -393,8 +393,7 @@
     }
 
     getnamaddr info;
-    ResState res;
-    res_init(&res, netcontext, event);
+    ResState res(netcontext, event);
 
     size_t size;
     switch (af) {
@@ -730,8 +729,7 @@
 
     auto buf = std::make_unique<querybuf>();
 
-    ResState res;
-    res_init(&res, netcontext, event);
+    ResState res(netcontext, event);
     int he;
     n = res_nquery(&res, qbuf, C_IN, T_PTR, buf->buf, (int)sizeof(buf->buf), &he);
     if (n < 0) {