refactor: Initialize data

This commit is contained in:
Michael Carlberg 2016-12-15 09:29:14 +01:00
parent f9062d031c
commit a0d485f79d
28 changed files with 55 additions and 54 deletions

View File

@ -83,7 +83,7 @@ class controller : public signal_receiver<SIGN_PRIORITY_CONTROLLER, sig_ev::proc
stateflag m_reload{false}; stateflag m_reload{false};
stateflag m_waiting{false}; stateflag m_waiting{false};
sigset_t m_waitmask; sigset_t m_waitmask{};
vector<thread> m_threads; vector<thread> m_threads;
watch_t m_confwatch; watch_t m_confwatch;

View File

@ -105,7 +105,7 @@ class eventloop : public signal_receiver<SIGN_PRIORITY_EVENTLOOP, process_quit,
/** /**
* @brief Flag to indicate current run state * @brief Flag to indicate current run state
*/ */
stateflag m_running; stateflag m_running{};
/** /**
* @brief Time to wait for subsequent events * @brief Time to wait for subsequent events
@ -130,7 +130,7 @@ class eventloop : public signal_receiver<SIGN_PRIORITY_EVENTLOOP, process_quit,
/** /**
* @brief Mutex used to guard input data * @brief Mutex used to guard input data
*/ */
std::mutex m_inputlock; std::mutex m_inputlock{};
/** /**
* @brief Input data * @brief Input data

View File

@ -48,7 +48,7 @@ namespace modules {
connection& m_connection; connection& m_connection;
monitor_t m_output; monitor_t m_output;
xcb_window_t m_proxy; xcb_window_t m_proxy{};
ramp_t m_ramp; ramp_t m_ramp;
label_t m_label; label_t m_label;

View File

@ -66,11 +66,11 @@ namespace command_util {
string m_cmd; string m_cmd;
int m_stdout[2]; int m_stdout[2]{};
int m_stdin[2]; int m_stdin[2]{};
pid_t m_forkpid; pid_t m_forkpid{};
int m_forkstatus; int m_forkstatus{};
concurrency_util::spin_lock m_pipelock; concurrency_util::spin_lock m_pipelock;
}; };

View File

@ -135,11 +135,11 @@ class tray_manager : public xpp::event::sink<evt::expose, evt::visibility_notify
const logger& m_log; const logger& m_log;
vector<shared_ptr<tray_client>> m_clients; vector<shared_ptr<tray_client>> m_clients;
tray_settings m_opts; tray_settings m_opts{};
xcb_gcontext_t m_gc{0}; xcb_gcontext_t m_gc{0};
xcb_pixmap_t m_pixmap{0}; xcb_pixmap_t m_pixmap{0};
graphics_util::root_pixmap m_rootpixmap; graphics_util::root_pixmap m_rootpixmap{};
uint16_t m_prevwidth{0}; uint16_t m_prevwidth{0};
uint16_t m_prevheight{0}; uint16_t m_prevheight{0};
@ -156,7 +156,7 @@ class tray_manager : public xpp::event::sink<evt::expose, evt::visibility_notify
bool m_restacked{false}; bool m_restacked{false};
std::mutex m_mtx; std::mutex m_mtx{};
chrono::time_point<chrono::system_clock, chrono::milliseconds> m_drawtime; chrono::time_point<chrono::system_clock, chrono::milliseconds> m_drawtime;

View File

@ -154,8 +154,8 @@ namespace net {
* interface is a TUN/TAP device * interface is a TUN/TAP device
*/ */
void network::check_tuntap() { void network::check_tuntap() {
struct ethtool_drvinfo driver; struct ethtool_drvinfo driver {};
struct ifreq request; struct ifreq request {};
driver.cmd = ETHTOOL_GDRVINFO; driver.cmd = ETHTOOL_GDRVINFO;
@ -219,8 +219,8 @@ namespace net {
return false; return false;
} }
struct ifreq request; struct ifreq request {};
struct ethtool_cmd data; struct ethtool_cmd data {};
memset(&request, 0, sizeof(request)); memset(&request, 0, sizeof(request));
strncpy(request.ifr_name, m_interface.c_str(), IFNAMSIZ - 1); strncpy(request.ifr_name, m_interface.c_str(), IFNAMSIZ - 1);
@ -244,8 +244,8 @@ namespace net {
return false; return false;
} }
struct ethtool_value data; struct ethtool_value data {};
struct ifreq request; struct ifreq request {};
memset(&request, 0, sizeof(request)); memset(&request, 0, sizeof(request));
strncpy(request.ifr_name, m_interface.c_str(), IFNAMSIZ - 1); strncpy(request.ifr_name, m_interface.c_str(), IFNAMSIZ - 1);
@ -285,7 +285,7 @@ namespace net {
return false; return false;
} }
struct iwreq req; struct iwreq req {};
if (iw_get_ext(socket_fd, m_interface.c_str(), SIOCGIWMODE, &req) == -1) { if (iw_get_ext(socket_fd, m_interface.c_str(), SIOCGIWMODE, &req) == -1) {
return false; return false;
@ -341,7 +341,7 @@ namespace net {
void wireless_network::query_essid(const int& socket_fd) { void wireless_network::query_essid(const int& socket_fd) {
char essid[IW_ESSID_MAX_SIZE + 1]; char essid[IW_ESSID_MAX_SIZE + 1];
struct iwreq req; struct iwreq req {};
req.u.essid.pointer = &essid; req.u.essid.pointer = &essid;
req.u.essid.length = sizeof(essid); req.u.essid.length = sizeof(essid);
req.u.essid.flags = 0; req.u.essid.flags = 0;
@ -357,8 +357,8 @@ namespace net {
* Query for device driver quality values * Query for device driver quality values
*/ */
void wireless_network::query_quality(const int& socket_fd) { void wireless_network::query_quality(const int& socket_fd) {
iwrange range; iwrange range{};
iwstats stats; iwstats stats{};
// Fill range // Fill range
if (iw_get_range_info(socket_fd, m_interface.c_str(), &range) == -1) { if (iw_get_range_info(socket_fd, m_interface.c_str(), &range) == -1) {

View File

@ -59,7 +59,7 @@ void eventloop::start() {
dispatch_modules(); dispatch_modules();
while (m_running) { while (m_running) {
event evt, next; event evt{}, next{};
m_queue.wait_dequeue(evt); m_queue.wait_dequeue(evt);

View File

@ -94,7 +94,7 @@ renderer::renderer(connection& conn, signal_emitter& emitter, const logger& logg
uint32_t mask{0}; uint32_t mask{0};
uint32_t value_list[32]{0}; uint32_t value_list[32]{0};
xcb_params_gc_t params; xcb_params_gc_t params{};
XCB_AUX_ADD_PARAM(&mask, &params, foreground, colors[i]); XCB_AUX_ADD_PARAM(&mask, &params, foreground, colors[i]);
XCB_AUX_ADD_PARAM(&mask, &params, graphics_exposures, 0); XCB_AUX_ADD_PARAM(&mask, &params, graphics_exposures, 0);
xutils::pack_values(mask, &params, value_list); xutils::pack_values(mask, &params, value_list);

View File

@ -128,7 +128,8 @@ namespace drawtypes {
string text; string text;
struct side_values padding, margin; struct side_values padding {
}, margin{};
if (required) { if (required) {
text = conf.get<string>(section, name); text = conf.get<string>(section, name);

View File

@ -55,7 +55,7 @@ int main(int argc, char** argv) {
//================================================== //==================================================
// Block all signals by default // Block all signals by default
//================================================== //==================================================
sigset_t blockmask; sigset_t blockmask{};
sigfillset(&blockmask); sigfillset(&blockmask);
if (pthread_sigmask(SIG_BLOCK, &blockmask, nullptr) == -1) { if (pthread_sigmask(SIG_BLOCK, &blockmask, nullptr) == -1) {

View File

@ -57,7 +57,7 @@ namespace modules {
bool fs_module::update() { bool fs_module::update() {
m_mounts.clear(); m_mounts.clear();
struct statvfs buffer; struct statvfs buffer {};
struct mntent* mnt = nullptr; struct mntent* mnt = nullptr;
for (auto&& mountpoint : m_mountpoints) { for (auto&& mountpoint : m_mountpoints) {

View File

@ -122,7 +122,7 @@ namespace modules {
auto names = ewmh_util::get_desktop_names(m_ewmh.get()); auto names = ewmh_util::get_desktop_names(m_ewmh.get());
vector<position> viewports; vector<position> viewports;
size_t num{0}; size_t num{0};
position pos; position pos{};
if (m_monitorsupport) { if (m_monitorsupport) {
viewports = ewmh_util::get_desktop_viewports(m_ewmh.get()); viewports = ewmh_util::get_desktop_viewports(m_ewmh.get());

View File

@ -16,7 +16,7 @@ namespace bspwm_util {
auto children = conn.query_tree(conn.screen()->root).children(); auto children = conn.query_tree(conn.screen()->root).children();
for (auto it = children.begin(); it != children.end(); it++) { for (auto it = children.begin(); it != children.end(); it++) {
xcb_icccm_get_wm_class_reply_t reply; xcb_icccm_get_wm_class_reply_t reply{};
reply.class_name = reply.instance_name = nullptr; reply.class_name = reply.instance_name = nullptr;
if (xcb_icccm_get_wm_class_reply(conn, xcb_icccm_get_wm_class(conn, *it), &reply, nullptr)) { if (xcb_icccm_get_wm_class_reply(conn, xcb_icccm_get_wm_class(conn, *it), &reply, nullptr)) {
@ -76,7 +76,7 @@ namespace bspwm_util {
return env_path; return env_path;
} }
struct sockaddr_un sa; struct sockaddr_un sa {};
char* host = nullptr; char* host = nullptr;
int dsp = 0; int dsp = 0;
int scr = 0; int scr = 0;

View File

@ -38,7 +38,7 @@ namespace file_util {
* Checks if the given file exist * Checks if the given file exist
*/ */
bool exists(const string& filename) { bool exists(const string& filename) {
struct stat buffer; struct stat buffer {};
return stat(filename.c_str(), &buffer) == 0; return stat(filename.c_str(), &buffer) == 0;
} }
@ -83,7 +83,7 @@ namespace file_util {
bool is_fifo(string filename) { bool is_fifo(string filename) {
auto fileptr = factory_util::unique<file_ptr>(filename); auto fileptr = factory_util::unique<file_ptr>(filename);
int fd = fileno((*fileptr)()); int fd = fileno((*fileptr)());
struct stat statbuf; struct stat statbuf {};
fstat(fd, &statbuf); fstat(fd, &statbuf);
return S_ISFIFO(statbuf.st_mode); return S_ISFIFO(statbuf.st_mode);
} }

View File

@ -108,7 +108,7 @@ namespace process_util {
} }
void unblock_signal(int sig) { void unblock_signal(int sig) {
sigset_t sigmask; sigset_t sigmask{};
sigemptyset(&sigmask); sigemptyset(&sigmask);
sigaddset(&sigmask, sig); sigaddset(&sigmask, sig);
if (pthread_sigmask(SIG_UNBLOCK, &sigmask, nullptr) == -1) { if (pthread_sigmask(SIG_UNBLOCK, &sigmask, nullptr) == -1) {

View File

@ -18,7 +18,7 @@ namespace socket_util {
* Constructor: establishing socket connection * Constructor: establishing socket connection
*/ */
unix_connection::unix_connection(string&& path) : m_socketpath(path) { unix_connection::unix_connection(string&& path) : m_socketpath(path) {
struct sockaddr_un socket_addr; struct sockaddr_un socket_addr {};
socket_addr.sun_family = AF_UNIX; socket_addr.sun_family = AF_UNIX;
if ((m_fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { if ((m_fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {

View File

@ -246,7 +246,7 @@ namespace string_util {
* @endcode * @endcode
*/ */
string from_stream(const std::basic_ostream<char>& os) { string from_stream(const std::basic_ostream<char>& os) {
return static_cast<const stringstream&>(os).str(); return dynamic_cast<const stringstream&>(os).str();
} }
/** /**

View File

@ -35,7 +35,7 @@ string color::source() const {
} }
color::operator XRenderColor() const { color::operator XRenderColor() const {
XRenderColor x; XRenderColor x{};
x.red = color_util::red_channel<uint16_t>(m_color); x.red = color_util::red_channel<uint16_t>(m_color);
x.green = color_util::green_channel<uint16_t>(m_color); x.green = color_util::green_channel<uint16_t>(m_color);
x.blue = color_util::blue_channel<uint16_t>(m_color); x.blue = color_util::blue_channel<uint16_t>(m_color);

View File

@ -37,8 +37,8 @@ namespace draw_util {
}; };
struct iovec xcb_parts[7]; struct iovec xcb_parts[7];
uint8_t xcb_lendelta[2]; uint8_t xcb_lendelta[2];
xcb_void_cookie_t xcb_ret; xcb_void_cookie_t xcb_ret{};
xcb_poly_text_8_request_t xcb_out; xcb_poly_text_8_request_t xcb_out{};
xcb_out.pad0 = 0; xcb_out.pad0 = 0;
xcb_out.drawable = d; xcb_out.drawable = d;
xcb_out.gc = gc; xcb_out.gc = gc;

View File

@ -22,7 +22,7 @@ namespace ewmh_util {
bool supports(xcb_ewmh_connection_t* ewmh, xcb_atom_t atom, int screen) { bool supports(xcb_ewmh_connection_t* ewmh, xcb_atom_t atom, int screen) {
bool supports{false}; bool supports{false};
xcb_ewmh_get_atoms_reply_t reply; xcb_ewmh_get_atoms_reply_t reply{};
reply.atoms = nullptr; reply.atoms = nullptr;
if (!xcb_ewmh_get_supported_reply(ewmh, xcb_ewmh_get_supported(ewmh, screen), &reply, nullptr)) { if (!xcb_ewmh_get_supported_reply(ewmh, xcb_ewmh_get_supported(ewmh, screen), &reply, nullptr)) {
@ -44,7 +44,7 @@ namespace ewmh_util {
} }
string get_wm_name(xcb_ewmh_connection_t* conn, xcb_window_t win) { string get_wm_name(xcb_ewmh_connection_t* conn, xcb_window_t win) {
xcb_ewmh_get_utf8_strings_reply_t utf8_reply; xcb_ewmh_get_utf8_strings_reply_t utf8_reply{};
if (xcb_ewmh_get_wm_name_reply(conn, xcb_ewmh_get_wm_name(conn, win), &utf8_reply, nullptr)) { if (xcb_ewmh_get_wm_name_reply(conn, xcb_ewmh_get_wm_name(conn, win), &utf8_reply, nullptr)) {
return get_reply_string(&utf8_reply); return get_reply_string(&utf8_reply);
} }
@ -52,7 +52,7 @@ namespace ewmh_util {
} }
string get_visible_name(xcb_ewmh_connection_t* conn, xcb_window_t win) { string get_visible_name(xcb_ewmh_connection_t* conn, xcb_window_t win) {
xcb_ewmh_get_utf8_strings_reply_t utf8_reply; xcb_ewmh_get_utf8_strings_reply_t utf8_reply{};
if (xcb_ewmh_get_wm_visible_name_reply(conn, xcb_ewmh_get_wm_visible_name(conn, win), &utf8_reply, nullptr)) { if (xcb_ewmh_get_wm_visible_name_reply(conn, xcb_ewmh_get_wm_visible_name(conn, win), &utf8_reply, nullptr)) {
return get_reply_string(&utf8_reply); return get_reply_string(&utf8_reply);
} }
@ -60,7 +60,7 @@ namespace ewmh_util {
} }
string get_icon_name(xcb_ewmh_connection_t* conn, xcb_window_t win) { string get_icon_name(xcb_ewmh_connection_t* conn, xcb_window_t win) {
xcb_ewmh_get_utf8_strings_reply_t utf8_reply; xcb_ewmh_get_utf8_strings_reply_t utf8_reply{};
if (xcb_ewmh_get_wm_icon_name_reply(conn, xcb_ewmh_get_wm_icon_name(conn, win), &utf8_reply, nullptr)) { if (xcb_ewmh_get_wm_icon_name_reply(conn, xcb_ewmh_get_wm_icon_name(conn, win), &utf8_reply, nullptr)) {
return get_reply_string(&utf8_reply); return get_reply_string(&utf8_reply);
} }
@ -86,7 +86,7 @@ namespace ewmh_util {
vector<position> get_desktop_viewports(xcb_ewmh_connection_t* conn, int screen) { vector<position> get_desktop_viewports(xcb_ewmh_connection_t* conn, int screen) {
vector<position> viewports; vector<position> viewports;
xcb_ewmh_get_desktop_viewport_reply_t reply; xcb_ewmh_get_desktop_viewport_reply_t reply{};
if (!xcb_ewmh_get_desktop_viewport_reply(conn, xcb_ewmh_get_desktop_viewport(conn, screen), &reply, nullptr)) { if (!xcb_ewmh_get_desktop_viewport_reply(conn, xcb_ewmh_get_desktop_viewport(conn, screen), &reply, nullptr)) {
return viewports; return viewports;
@ -102,7 +102,7 @@ namespace ewmh_util {
vector<string> get_desktop_names(xcb_ewmh_connection_t* conn, int screen) { vector<string> get_desktop_names(xcb_ewmh_connection_t* conn, int screen) {
vector<string> names; vector<string> names;
xcb_ewmh_get_utf8_strings_reply_t reply; xcb_ewmh_get_utf8_strings_reply_t reply{};
if (!xcb_ewmh_get_desktop_names_reply(conn, xcb_ewmh_get_desktop_names(conn, screen), &reply, nullptr)) { if (!xcb_ewmh_get_desktop_names_reply(conn, xcb_ewmh_get_desktop_names(conn, screen), &reply, nullptr)) {
return names; return names;

View File

@ -60,7 +60,7 @@ namespace graphics_util {
*/ */
bool create_gc(connection& conn, xcb_drawable_t drawable, xcb_gcontext_t* gc) { bool create_gc(connection& conn, xcb_drawable_t drawable, xcb_gcontext_t* gc) {
try { try {
xcb_params_gc_t params; xcb_params_gc_t params{};
uint32_t mask = 0; uint32_t mask = 0;
uint32_t values[32]; uint32_t values[32];

View File

@ -4,7 +4,7 @@ POLYBAR_NS
namespace icccm_util { namespace icccm_util {
string get_wm_name(xcb_connection_t* conn, xcb_window_t win) { string get_wm_name(xcb_connection_t* conn, xcb_window_t win) {
xcb_icccm_get_text_property_reply_t reply; xcb_icccm_get_text_property_reply_t reply{};
if (xcb_icccm_get_wm_name_reply(conn, xcb_icccm_get_wm_name(conn, win), &reply, nullptr)) { if (xcb_icccm_get_wm_name_reply(conn, xcb_icccm_get_wm_name(conn, win), &reply, nullptr)) {
return get_reply_string(&reply); return get_reply_string(&reply);
} }

View File

@ -88,7 +88,7 @@ void tray_client::ensure_state() const {
void tray_client::reconfigure(int16_t x, int16_t y) const { void tray_client::reconfigure(int16_t x, int16_t y) const {
uint32_t configure_mask = 0; uint32_t configure_mask = 0;
uint32_t configure_values[7]; uint32_t configure_values[7];
xcb_params_configure_window_t configure_params; xcb_params_configure_window_t configure_params{};
XCB_AUX_ADD_PARAM(&configure_mask, &configure_params, width, m_width); XCB_AUX_ADD_PARAM(&configure_mask, &configure_params, width, m_width);
XCB_AUX_ADD_PARAM(&configure_mask, &configure_params, height, m_height); XCB_AUX_ADD_PARAM(&configure_mask, &configure_params, height, m_height);

View File

@ -360,7 +360,7 @@ void tray_manager::reconfigure_window() {
uint32_t mask = 0; uint32_t mask = 0;
uint32_t values[7]; uint32_t values[7];
xcb_params_configure_window_t params; xcb_params_configure_window_t params{};
XCB_AUX_ADD_PARAM(&mask, &params, width, width); XCB_AUX_ADD_PARAM(&mask, &params, width, width);
XCB_AUX_ADD_PARAM(&mask, &params, x, x); XCB_AUX_ADD_PARAM(&mask, &params, x, x);
@ -610,7 +610,7 @@ void tray_manager::restack_window() {
uint32_t mask = 0; uint32_t mask = 0;
uint32_t values[7]; uint32_t values[7];
xcb_params_configure_window_t params; xcb_params_configure_window_t params{};
XCB_AUX_ADD_PARAM(&mask, &params, sibling, m_opts.sibling); XCB_AUX_ADD_PARAM(&mask, &params, sibling, m_opts.sibling);
XCB_AUX_ADD_PARAM(&mask, &params, stack_mode, XCB_STACK_MODE_ABOVE); XCB_AUX_ADD_PARAM(&mask, &params, stack_mode, XCB_STACK_MODE_ABOVE);

View File

@ -50,7 +50,7 @@ window window::reconfigure_geom(uint16_t w, uint16_t h, int16_t x, int16_t y) {
uint32_t mask{0}; uint32_t mask{0};
uint32_t values[7]{0}; uint32_t values[7]{0};
xcb_params_configure_window_t params; xcb_params_configure_window_t params{};
XCB_AUX_ADD_PARAM(&mask, &params, width, w); XCB_AUX_ADD_PARAM(&mask, &params, width, w);
XCB_AUX_ADD_PARAM(&mask, &params, height, h); XCB_AUX_ADD_PARAM(&mask, &params, height, h);
XCB_AUX_ADD_PARAM(&mask, &params, x, x); XCB_AUX_ADD_PARAM(&mask, &params, x, x);
@ -69,7 +69,7 @@ window window::reconfigure_pos(int16_t x, int16_t y) {
uint32_t mask{0}; uint32_t mask{0};
uint32_t values[2]{0}; uint32_t values[2]{0};
xcb_params_configure_window_t params; xcb_params_configure_window_t params{};
XCB_AUX_ADD_PARAM(&mask, &params, x, x); XCB_AUX_ADD_PARAM(&mask, &params, x, x);
XCB_AUX_ADD_PARAM(&mask, &params, y, y); XCB_AUX_ADD_PARAM(&mask, &params, y, y);

View File

@ -99,7 +99,7 @@ namespace xkb_util {
return results; return results;
} }
xcb_xkb_get_names_value_list_t values; xcb_xkb_get_names_value_list_t values{};
void* buffer = xcb_xkb_get_names_value_list(reply); void* buffer = xcb_xkb_get_names_value_list(reply);
xcb_xkb_get_names_value_list_unpack(buffer, reply->nTypes, reply->indicators, reply->virtualMods, reply->groupNames, xcb_xkb_get_names_value_list_unpack(buffer, reply->nTypes, reply->indicators, reply->virtualMods, reply->groupNames,
reply->nKeys, reply->nKeyAliases, reply->nRadioGroups, reply->which, &values); reply->nKeys, reply->nKeyAliases, reply->nRadioGroups, reply->which, &values);
@ -140,7 +140,7 @@ namespace xkb_util {
return results; return results;
} }
xcb_xkb_get_names_value_list_t values; xcb_xkb_get_names_value_list_t values{};
void* buffer = xcb_xkb_get_names_value_list(reply); void* buffer = xcb_xkb_get_names_value_list(reply);
xcb_xkb_get_names_value_list_unpack(buffer, reply->nTypes, reply->indicators, reply->virtualMods, reply->groupNames, xcb_xkb_get_names_value_list_unpack(buffer, reply->nTypes, reply->indicators, reply->virtualMods, reply->groupNames,
reply->nKeys, reply->nKeyAliases, reply->nRadioGroups, reply->which, &values); reply->nKeys, reply->nKeyAliases, reply->nRadioGroups, reply->which, &values);

View File

@ -17,7 +17,7 @@ namespace xlib {
shared_ptr<Visual> get_visual(int screen) { shared_ptr<Visual> get_visual(int screen) {
if (!g_visual_ptr) { if (!g_visual_ptr) {
XVisualInfo info; XVisualInfo info{};
if (XMatchVisualInfo(get_display().get(), screen, 32, TrueColor, &info)) { if (XMatchVisualInfo(get_display().get(), screen, 32, TrueColor, &info)) {
g_visual_ptr = shared_ptr<Visual>(info.visual, [=](Visual* v) { XFree(v); }); g_visual_ptr = shared_ptr<Visual>(info.visual, [=](Visual* v) { XFree(v); });
} }

View File

@ -80,7 +80,7 @@ string xresource_manager::load_value(const string& key, const string& res_type,
return ""; return "";
} }
char* type = nullptr; char* type = nullptr;
XrmValue ret; XrmValue ret{};
XrmGetResource(m_db, key.c_str(), res_type.c_str(), &type, &ret); XrmGetResource(m_db, key.c_str(), res_type.c_str(), &type, &ret);
if (ret.addr != nullptr && !std::strncmp(res_type.c_str(), type, n)) { if (ret.addr != nullptr && !std::strncmp(res_type.c_str(), type, n)) {