char const *func, gauge_t rate, rate_to_value_state_t *state,
value_list_t *vl, char const *pi_prefix, cdtime_t t)
{
- value_t v;
+ value_t v = { 0 } ;
int status;
if (pi_prefix[0] != 0)
else
sstrncpy (vl->plugin_instance, func, sizeof (vl->plugin_instance));
- memset (&v, 0, sizeof (v));
status = rate_to_value (&v, rate, state, inst->ds_type, t);
if (status != 0)
{
static int camqp_write_locked (camqp_config_t *conf, /* {{{ */
const char *buffer, const char *routing_key)
{
- amqp_basic_properties_t props;
+ amqp_basic_properties_t props = { 0 };
int status;
status = camqp_connect (conf);
if (status != 0)
return (status);
- memset (&props, 0, sizeof (props));
props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG
| AMQP_BASIC_DELIVERY_MODE_FLAG
| AMQP_BASIC_APP_ID_FLAG;
{
camqp_config_t *conf = user_data->data;
char routing_key[6 * DATA_MAX_NAME_LEN];
- char buffer[8192];
+ char buffer[8192] = { 0 };
int status;
if ((ds == NULL) || (vl == NULL) || (conf == NULL))
return (EINVAL);
- memset (buffer, 0, sizeof (buffer));
-
if (conf->routing_key != NULL)
{
sstrncpy (routing_key, conf->routing_key, sizeof (routing_key));
if (status == 0)
{
- user_data_t ud;
- char callback_name[3*DATA_MAX_NAME_LEN];
+ user_data_t ud = { 0 };
+ char callback_name[3*DATA_MAX_NAME_LEN] = { 0 };
- memset (&ud, 0, sizeof (ud));
ud.data = st;
ud.free_func = apache_free;
- memset (callback_name, 0, sizeof (callback_name));
ssnprintf (callback_name, sizeof (callback_name),
"apache/%s/%s",
(st->host != NULL) ? st->host : hostname_g,
{
int sd;
int status;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_return;
struct addrinfo *ai_list;
- /* Resolve name */
- memset (&ai_hints, 0, sizeof (ai_hints));
/* TODO: Change this to `AF_UNSPEC' if apcupsd can handle IPv6 */
ai_hints.ai_family = AF_INET;
ai_hints.ai_socktype = SOCK_STREAM;
static int ascent_xml_sessions (xmlDoc *doc, xmlNode *node) /* {{{ */
{
xmlNode *child;
- player_stats_t ps;
-
- memset (&ps, 0, sizeof (ps));
+ player_stats_t ps = {
+ .level_sum = 0
+ };
for (child = node->xmlChildrenNode; child != NULL; child = child->next)
{
xmlNode *node;
char *str_ptr;
char *tmp;
- struct tm tm;
+ struct tm tm = { 0 };
xpathObj = xmlXPathEvalExpression (BAD_CAST xpath_expression, xpathCtx);
if (xpathObj == NULL)
return (-1);
}
- memset (&tm, 0, sizeof(tm));
tmp = strptime (str_ptr, "%Y-%m-%dT%T", &tm);
xmlFree(str_ptr);
if (tmp == NULL)
{
yajl_struct *state = (yajl_struct*) ctx;
char buffer[number_len+1];
- char key[2 * DATA_MAX_NAME_LEN];
+ char key[2 * DATA_MAX_NAME_LEN] = { 0 };
_Bool latency_type = 0;
size_t i;
int status;
memcpy(buffer, number_val, number_len);
buffer[sizeof(buffer) - 1] = 0;
- memset (key, 0, sizeof (key));
for (i = 0; i < state->depth; i++)
{
if (state->stack[i] == NULL)
int pc_type)
{
uint32_t type;
- char ds_name[DATA_MAX_NAME_LEN];
- memset(ds_name, 0, sizeof(ds_name));
+ char ds_name[DATA_MAX_NAME_LEN] = { 0 };
if(convert_special_metrics)
{
static int cc_add_daemon_config(oconfig_item_t *ci)
{
int ret, i;
- struct ceph_daemon *nd, cd;
+ struct ceph_daemon *nd, cd = { 0 };
struct ceph_daemon **tmp;
- memset(&cd, 0, sizeof(struct ceph_daemon));
if((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
{
uint32_t type = DSET_TYPE_UNFOUND;
int index = vtmp->index;
- char ds_name[DATA_MAX_NAME_LEN];
- memset(ds_name, 0, sizeof(ds_name));
+ char ds_name[DATA_MAX_NAME_LEN] = { 0 };
if (parse_keys (ds_name, sizeof (ds_name), key))
{
static int cconn_connect(struct cconn *io)
{
- struct sockaddr_un address;
+ struct sockaddr_un address = { 0 };
int flags, fd, err;
if(io->state != CSTATE_UNCONNECTED)
{
"failed: error %d", err);
return err;
}
- memset(&address, 0, sizeof(struct sockaddr_un));
address.sun_family = AF_UNIX;
snprintf(address.sun_path, sizeof(address.sun_path), "%s",
io->d->asok_path);
connect_client(const char *p_hostname,
const char *p_service, int p_family, int p_socktype)
{
- struct addrinfo hints, *res = NULL, *ressave = NULL;
+ struct addrinfo hints = { 0 };
+ struct addrinfo *res = NULL, *ressave = NULL;
int n, sockfd;
- memset(&hints, 0, sizeof(struct addrinfo));
-
hints.ai_family = p_family;
hints.ai_socktype = p_socktype;
}
#if COLLECT_DEBUG
{
- char src_addr[IPV6_STR_MAX_SIZE];
- memset(src_addr, 0, sizeof(src_addr));
+ char src_addr[IPV6_STR_MAX_SIZE] = { 0 };
niptoha(&chrony_resp.body.tracking.addr, src_addr, sizeof(src_addr));
DEBUG(PLUGIN_NAME ": Daemon stat: .addr = %s, .ref_id= %u, .stratum = %u, .leap_status = %u, .ref_time = %u:%u:%u, .current_correction = %f, .last_offset = %f, .rms_offset = %f, .freq_ppm = %f, .skew_ppm = %f, .root_delay = %f, .root_dispersion = %f, .last_update_interval = %f", src_addr, ntohs(chrony_resp.body.tracking.f_ref_id),
ntohs(chrony_resp.body.tracking.f_stratum),
tChrony_Request chrony_req;
tChrony_Response chrony_resp;
- char src_addr[IPV6_STR_MAX_SIZE];
- memset(src_addr, 0, sizeof(src_addr));
+ char src_addr[IPV6_STR_MAX_SIZE] = { 0 };
chrony_init_req(&chrony_req);
chrony_req.body.source_data.f_index = htonl(p_src_idx);
tChrony_Response chrony_resp;
double skew_ppm, frequency_error, time_offset;
- char src_addr[IPV6_STR_MAX_SIZE];
- memset(src_addr, 0, sizeof(src_addr));
+ char src_addr[IPV6_STR_MAX_SIZE] = { 0 };
if (*p_is_reachable == 0)
{
hostname_g, value_string_g);
ident_str[sizeof (ident_str) - 1] = 0;
- memset (&ident, 0, sizeof (ident));
status = lcc_string_to_identifier (connection, &ident, ident_str);
if (status != 0)
{
return (-1);
}
- memset (&ident, 0, sizeof (ident));
status = parse_identifier (c, argv[1], &ident);
if (status != 0)
return (status);
{
value_t conntrack, conntrack_max, conntrack_pct;
FILE *fh;
- char buffer[64];
+ char buffer[64] = { 0 };
size_t buffer_len;
fh = fopen (old_files?CONNTRACK_FILE_OLD:CONNTRACK_FILE, "r");
if (fh == NULL)
return (-1);
- memset (buffer, 0, sizeof (buffer));
if (fgets (buffer, sizeof (buffer), fh) == NULL)
{
fclose (fh);
char values[4096];
FILE *csv;
int csv_fd;
- struct flock fl;
+ struct flock fl = { 0 };
int status;
if (0 != strcmp (ds->type, vl->type)) {
}
csv_fd = fileno (csv);
- memset (&fl, '\0', sizeof (fl));
- fl.l_start = 0;
- fl.l_len = 0; /* till end of file */
fl.l_pid = getpid ();
fl.l_type = F_WRLCK;
fl.l_whence = SEEK_SET;
/* If all went well, register this database for reading */
if (status == 0)
{
- user_data_t ud;
+ user_data_t ud = { 0 };
char *cb_name;
if (db->instance == NULL)
DEBUG ("curl_json plugin: Registering new read callback: %s",
db->instance);
- memset (&ud, 0, sizeof (ud));
ud.data = (void *) db;
ud.free_func = cj_free;
/* If all went well, register this database for reading */
if (status == 0)
{
- user_data_t ud;
+ user_data_t ud = { 0 };
char *cb_name;
if (db->instance == NULL)
DEBUG ("curl_xml plugin: Registering new read callback: %s",
db->instance);
- memset (&ud, 0, sizeof (ud));
ud.data = (void *) db;
ud.free_func = cx_free;
{
const char *str;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list;
struct addrinfo *ai_ptr;
int status;
if (IS_FALSE (str))
return (0);
- memset (&ai_hints, '\0', sizeof (ai_hints));
ai_hints.ai_flags = AI_CANONNAME;
status = getaddrinfo (hostname_g, NULL, &ai_hints, &ai_list);
{
int fd;
const char *notifysocket;
- struct sockaddr_un su;
+ struct sockaddr_un su = { 0 };
size_t su_size;
char buffer[] = "READY=1\n";
return 0;
}
- memset (&su, 0, sizeof (su));
su.sun_family = AF_UNIX;
if (notifysocket[0] != '@')
{
int main (int argc, char **argv)
{
- struct sigaction sig_int_action;
- struct sigaction sig_term_action;
- struct sigaction sig_usr1_action;
- struct sigaction sig_pipe_action;
const char *configfile = CONFIGFILE;
int test_config = 0;
int test_readall = 0;
const char *basedir;
#if COLLECT_DAEMON
- struct sigaction sig_chld_action;
pid_t pid;
int daemonize = 1;
#endif
/*
* fork off child
*/
- memset (&sig_chld_action, '\0', sizeof (sig_chld_action));
- sig_chld_action.sa_handler = SIG_IGN;
+ struct sigaction sig_chld_action = {
+ .sa_handler = SIG_IGN
+ };
+
sigaction (SIGCHLD, &sig_chld_action, NULL);
/*
} /* if (daemonize) */
#endif /* COLLECT_DAEMON */
- memset (&sig_pipe_action, '\0', sizeof (sig_pipe_action));
- sig_pipe_action.sa_handler = SIG_IGN;
+ struct sigaction sig_pipe_action = {
+ .sa_handler = SIG_IGN
+ };
+
sigaction (SIGPIPE, &sig_pipe_action, NULL);
/*
* install signal handlers
*/
- memset (&sig_int_action, '\0', sizeof (sig_int_action));
- sig_int_action.sa_handler = sig_int_handler;
+ struct sigaction sig_int_action = {
+ .sa_handler = sig_int_handler
+ };
+
if (0 != sigaction (SIGINT, &sig_int_action, NULL)) {
char errbuf[1024];
ERROR ("Error: Failed to install a signal handler for signal INT: %s",
return (1);
}
- memset (&sig_term_action, '\0', sizeof (sig_term_action));
- sig_term_action.sa_handler = sig_term_handler;
+ struct sigaction sig_term_action = {
+ .sa_handler = sig_term_handler
+ };
+
if (0 != sigaction (SIGTERM, &sig_term_action, NULL)) {
char errbuf[1024];
ERROR ("Error: Failed to install a signal handler for signal TERM: %s",
return (1);
}
- memset (&sig_usr1_action, '\0', sizeof (sig_usr1_action));
- sig_usr1_action.sa_handler = sig_usr1_handler;
+ struct sigaction sig_usr1_action = {
+ .sa_handler = sig_usr1_handler
+ };
+
if (0 != sigaction (SIGUSR1, &sig_usr1_action, NULL)) {
char errbuf[1024];
ERROR ("Error: Failed to install a signal handler for signal USR1: %s",
{
struct addrinfo *ai_list;
struct addrinfo *ai_ptr;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
int status;
int service_number;
return (-1);
ai_list = NULL;
- memset (&ai_hints, 0, sizeof (ai_hints));
ai_hints.ai_family = AF_UNSPEC;
status = getaddrinfo (/* node = */ NULL, service_name,
int i;
const char *name;
unsigned int flags = 0;
- plugin_ctx_t ctx;
+ plugin_ctx_t ctx = { 0 };
plugin_ctx_t old_ctx;
int ret_val;
name = "virt";
/* default to the global interval set before loading this plugin */
- memset (&ctx, 0, sizeof (ctx));
ctx.interval = cf_get_default_interval ();
ctx.flush_interval = 0;
ctx.flush_timeout = 0;
if (IS_TRUE (global_option_get ("AutoLoadPlugin")))
{
- plugin_ctx_t ctx;
+ plugin_ctx_t ctx = { 0 };
plugin_ctx_t old_ctx;
int status;
/* default to the global interval set before loading this plugin */
- memset (&ctx, 0, sizeof (ctx));
ctx.interval = cf_get_default_interval ();
old_ctx = plugin_set_ctx (ctx);
static int fc_init_once (void) /* {{{ */
{
static int done = 0;
- target_proc_t tproc;
+ target_proc_t tproc = { 0 };
if (done != 0)
return (0);
- memset (&tproc, 0, sizeof (tproc));
tproc.create = fc_bit_jump_create;
tproc.destroy = fc_bit_jump_destroy;
tproc.invoke = fc_bit_jump_invoke;
{
int status;
regmatch_t re_match[32];
- char *matches[32];
+ char *matches[32] = { 0 };
size_t matches_num;
size_t i;
if (status != 0)
return (0);
- memset (matches, '\0', sizeof (matches));
for (matches_num = 0; matches_num < STATIC_ARRAY_SIZE (matches); matches_num++)
{
if ((re_match[matches_num].rm_so < 0)
{
int seek_end = 0;
FILE *fh;
- struct stat stat_buf;
+ struct stat stat_buf = { 0 };
int status;
- memset (&stat_buf, 0, sizeof (stat_buf));
status = stat (obj->file, &stat_buf);
if (status != 0)
{
}
else
{
- user_data_t ud;
+ user_data_t ud = { 0 };
char *name = NULL;
databases = temp;
databases[databases_num] = db;
databases_num++;
- memset (&ud, 0, sizeof (ud));
ud.data = (void *) db;
ud.free_func = NULL;
name = ssnprintf_alloc("dbi:%s", db->name);
{
pcap_t *pcap_obj;
char pcap_error[PCAP_ERRBUF_SIZE];
- struct bpf_program fp;
+ struct bpf_program fp = { 0 };
int status;
return (PCAP_ERROR);
}
- memset (&fp, 0, sizeof (fp));
status = pcap_compile (pcap_obj, &fp, "udp port 53", 1, 0);
if (status < 0)
{
static int ethstat_read_interface (char *device)
{
int fd;
- struct ifreq req;
- struct ethtool_drvinfo drvinfo;
struct ethtool_gstrings *strings;
struct ethtool_stats *stats;
size_t n_stats;
size_t i;
int status;
- memset (&req, 0, sizeof (req));
- sstrncpy(req.ifr_name, device, sizeof (req.ifr_name));
-
fd = socket(AF_INET, SOCK_DGRAM, /* protocol = */ 0);
if (fd < 0)
{
return 1;
}
- memset (&drvinfo, 0, sizeof (drvinfo));
- drvinfo.cmd = ETHTOOL_GDRVINFO;
- req.ifr_data = (void *) &drvinfo;
+ struct ethtool_drvinfo drvinfo = {
+ .cmd = ETHTOOL_GDRVINFO
+ };
+
+ struct ifreq req = {
+ .ifr_data = (void *) &drvinfo
+ };
+
+ sstrncpy(req.ifr_name, device, sizeof (req.ifr_name));
+
status = ioctl (fd, SIOCETHTOOL, &req);
if (status < 0)
{
{
sigset_t ss;
- memset (&ss, 0, sizeof (ss));
sigemptyset (&ss);
sigprocmask (SIG_SETMASK, &ss, /* old mask = */ NULL);
} /* }}} void reset_signal_mask */
static int exec_init (void) /* {{{ */
{
- struct sigaction sa;
+ struct sigaction sa = {
+ .sa_handler = sigchld_handler
+ };
- memset (&sa, '\0', sizeof (sa));
- sa.sa_handler = sigchld_handler;
sigaction (SIGCHLD, &sa, NULL);
return (0);
size_t *ret_sockets_num,
const char *node, const char *service, int listen)
{
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list;
struct addrinfo *ai_ptr;
int ai_return;
if (*ret_sockets != NULL)
return (EINVAL);
- memset (&ai_hints, 0, sizeof (ai_hints));
- ai_hints.ai_flags = 0;
#ifdef AI_PASSIVE
ai_hints.ai_flags |= AI_PASSIVE;
#endif
if (ai_ptr->ai_family == AF_INET)
{
struct sockaddr_in *addr;
- struct ip_mreq mreq;
int loop;
addr = (struct sockaddr_in *) ai_ptr->ai_addr;
sstrerror (errno, errbuf, sizeof (errbuf)));
}
- memset (&mreq, 0, sizeof (mreq));
- mreq.imr_multiaddr.s_addr = addr->sin_addr.s_addr;
- mreq.imr_interface.s_addr = htonl (INADDR_ANY);
+ struct ip_mreq mreq = {
+ .imr_multiaddr.s_addr = addr->sin_addr.s_addr,
+ .imr_interface.s_addr = htonl (INADDR_ANY)
+ };
status = setsockopt (sockets[sockets_num].fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
(void *) &mreq, sizeof (mreq));
else if (ai_ptr->ai_family == AF_INET6)
{
struct sockaddr_in6 *addr;
- struct ipv6_mreq mreq;
int loop;
addr = (struct sockaddr_in6 *) ai_ptr->ai_addr;
sstrerror (errno, errbuf, sizeof (errbuf)));
}
- memset (&mreq, 0, sizeof (mreq));
+ struct ipv6_mreq mreq = {
+ .ipv6mr_interface = 0 /* any */
+ };
+
memcpy (&mreq.ipv6mr_multiaddr,
&addr->sin6_addr, sizeof (addr->sin6_addr));
- mreq.ipv6mr_interface = 0; /* any */
status = setsockopt (sockets[sockets_num].fd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP,
(void *) &mreq, sizeof (mreq));
if (status != 0)
static int request_meta_data (const char *host, const char *name) /* {{{ */
{
- Ganglia_metadata_msg msg;
- char buffer[BUFF_SIZE];
+ Ganglia_metadata_msg msg = { 0 };
+ char buffer[BUFF_SIZE] = { 0 };
unsigned int buffer_size;
XDR xdr;
size_t i;
- memset (&msg, 0, sizeof (msg));
-
msg.id = gmetadata_request;
msg.Ganglia_metadata_msg_u.grequest.metric_id.host = strdup (host);
msg.Ganglia_metadata_msg_u.grequest.metric_id.name = strdup (name);
return (-1);
}
- memset (buffer, 0, sizeof (buffer));
xdrmem_create (&xdr, buffer, sizeof (buffer), XDR_ENCODE);
if (!xdr_Ganglia_metadata_msg (&xdr, &msg))
case gmetric_float:
case gmetric_double:
{
- Ganglia_value_msg msg;
+ Ganglia_value_msg msg = { 0 };
- memset (&msg, 0, sizeof (msg));
if (xdr_Ganglia_value_msg (&xdr, &msg))
mc_handle_value_msg (&msg);
break;
case gmetadata_full:
case gmetadata_request:
{
- Ganglia_metadata_msg msg;
- memset (&msg, 0, sizeof (msg));
+ Ganglia_metadata_msg msg = { 0 };
if (xdr_Ganglia_metadata_msg (&xdr, &msg))
mc_handle_metadata_msg (&msg);
break;
const char *host;
const char *port;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list, *ai_ptr;
int ai_return;
- memset (&ai_hints, '\0', sizeof (ai_hints));
- ai_hints.ai_flags = 0;
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
*/
static void c_ipmi_error (const char *func, int status)
{
- char errbuf[4096];
-
- memset (errbuf, 0, sizeof (errbuf));
+ char errbuf[4096] = { 0 };
if (IPMI_IS_OS_ERR (status))
{
c_ipmi_sensor_list_t *list_item;
c_ipmi_sensor_list_t *list_prev;
- char buffer[DATA_MAX_NAME_LEN];
+ char buffer[DATA_MAX_NAME_LEN] = { 0 };
const char *entity_id_string;
char sensor_name[DATA_MAX_NAME_LEN];
char *sensor_name_ptr;
sensor_id = ipmi_sensor_convert_to_id (sensor);
- memset (buffer, 0, sizeof (buffer));
ipmi_sensor_get_name (sensor, buffer, sizeof (buffer));
buffer[sizeof (buffer) - 1] = 0;
static int thread_init (os_handler_t **ret_os_handler)
{
os_handler_t *os_handler;
- ipmi_open_option_t open_option[1];
+ ipmi_open_option_t open_option[1] = { 0 };
ipmi_con_t *smi_connection = NULL;
ipmi_domain_id_t domain_id;
int status;
return (-1);
}
- memset (open_option, 0, sizeof (open_option));
open_option[0].option = IPMI_OPEN_OPTION_ALL;
open_option[0].ival = 1;
else
return (1);
- ip_chain_t temp, *final, **list;
+ ip_chain_t temp = { 0 };
+ ip_chain_t *final, **list;
char *table;
int table_len;
char *chain;
char *fields[4];
int fields_num;
- memset (&temp, 0, sizeof (temp));
-
value_copy = strdup (value);
if (value_copy == NULL)
{
static jint JNICALL cjni_api_dispatch_notification (JNIEnv *jvm_env, /* {{{ */
jobject this, jobject o_notification)
{
- notification_t n;
+ notification_t n = { 0 };
int status;
- memset (&n, 0, sizeof (n));
- n.meta = NULL;
-
status = jtoc_notification (jvm_env, &n, o_notification);
if (status != 0)
{
static jint JNICALL cjni_api_register_read (JNIEnv *jvm_env, /* {{{ */
jobject this, jobject o_name, jobject o_read)
{
- user_data_t ud;
+ user_data_t ud = { 0 };
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_read, CB_TYPE_READ);
DEBUG ("java plugin: Registering new read callback: %s", cbi->name);
- memset (&ud, 0, sizeof (ud));
ud.data = (void *) cbi;
ud.free_func = cjni_callback_info_destroy;
static jint JNICALL cjni_api_register_write (JNIEnv *jvm_env, /* {{{ */
jobject this, jobject o_name, jobject o_write)
{
- user_data_t ud;
+ user_data_t ud = { 0 };
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_write, CB_TYPE_WRITE);
DEBUG ("java plugin: Registering new write callback: %s", cbi->name);
- memset (&ud, 0, sizeof (ud));
ud.data = (void *) cbi;
ud.free_func = cjni_callback_info_destroy;
static jint JNICALL cjni_api_register_flush (JNIEnv *jvm_env, /* {{{ */
jobject this, jobject o_name, jobject o_flush)
{
- user_data_t ud;
+ user_data_t ud = { 0 };
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_flush, CB_TYPE_FLUSH);
DEBUG ("java plugin: Registering new flush callback: %s", cbi->name);
- memset (&ud, 0, sizeof (ud));
ud.data = (void *) cbi;
ud.free_func = cjni_callback_info_destroy;
static jint JNICALL cjni_api_register_log (JNIEnv *jvm_env, /* {{{ */
jobject this, jobject o_name, jobject o_log)
{
- user_data_t ud;
+ user_data_t ud = { 0 };
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_log, CB_TYPE_LOG);
DEBUG ("java plugin: Registering new log callback: %s", cbi->name);
- memset (&ud, 0, sizeof (ud));
ud.data = (void *) cbi;
ud.free_func = cjni_callback_info_destroy;
static jint JNICALL cjni_api_register_notification (JNIEnv *jvm_env, /* {{{ */
jobject this, jobject o_name, jobject o_notification)
{
- user_data_t ud;
+ user_data_t ud = { 0 };
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_notification,
DEBUG ("java plugin: Registering new notification callback: %s", cbi->name);
- memset (&ud, 0, sizeof (ud));
ud.data = (void *) cbi;
ud.free_func = cjni_callback_info_destroy;
if (type == CB_TYPE_MATCH)
{
- match_proc_t m_proc;
+ match_proc_t m_proc = { 0 };
- memset (&m_proc, 0, sizeof (m_proc));
m_proc.create = cjni_match_target_create;
m_proc.destroy = cjni_match_target_destroy;
m_proc.match = (void *) cjni_match_target_invoke;
}
else if (type == CB_TYPE_TARGET)
{
- target_proc_t t_proc;
+ target_proc_t t_proc = { 0 };
- memset (&t_proc, 0, sizeof (t_proc));
t_proc.create = cjni_match_target_create;
t_proc.destroy = cjni_match_target_destroy;
t_proc.invoke = cjni_match_target_invoke;
static int cjni_create_jvm (void) /* {{{ */
{
JNIEnv *jvm_env;
- JavaVMInitArgs vm_args;
+ JavaVMInitArgs vm_args = { 0 };
JavaVMOption vm_options[jvm_argc];
int status;
jvm_env = NULL;
- memset (&vm_args, 0, sizeof (vm_args));
vm_args.version = JNI_VERSION_1_2;
vm_args.options = vm_options;
vm_args.nOptions = (jint) jvm_argc;
else
{
int status;
- JavaVMAttachArgs args;
+ JavaVMAttachArgs args = { 0 };
assert (cjni_env->jvm_env == NULL);
- memset (&args, 0, sizeof (args));
args.version = JNI_VERSION_1_2;
status = (*jvm)->AttachCurrentThread (jvm, (void *) &jvm_env, (void *) &args);
* `value_list_t'. */
if (cbi->type == CB_TYPE_TARGET)
{
- value_list_t new_vl;
+ value_list_t new_vl = { 0 };
- memset (&new_vl, 0, sizeof (new_vl));
status = jtoc_value_list (jvm_env, &new_vl, o_vl);
if (status != 0)
{
static int cjni_shutdown (void) /* {{{ */
{
JNIEnv *jvm_env;
- JavaVMAttachArgs args;
+ JavaVMAttachArgs args = { 0 };
int status;
size_t i;
return (0);
jvm_env = NULL;
- memset (&args, 0, sizeof (args));
args.version = JNI_VERSION_1_2;
status = (*jvm)->AttachCurrentThread (jvm, (void *) &jvm_env, &args);
static int lcc_receive (lcc_connection_t *c, /* {{{ */
lcc_response_t *ret_res)
{
- lcc_response_t res;
+ lcc_response_t res = { 0 };
char *ptr;
char buffer[4096];
size_t i;
- memset (&res, 0, sizeof (res));
-
/* Read the first line, containing the status and a message */
ptr = fgets (buffer, sizeof (buffer), c->fh);
if (ptr == NULL)
static int lcc_sendreceive (lcc_connection_t *c, /* {{{ */
const char *command, lcc_response_t *ret_res)
{
- lcc_response_t res;
+ lcc_response_t res = { 0 };
int status;
if (c->fh == NULL)
if (status != 0)
return (status);
- memset (&res, 0, sizeof (res));
status = lcc_receive (c, &res);
if (status == 0)
memcpy (ret_res, &res, sizeof (*ret_res));
static int lcc_open_unixsocket (lcc_connection_t *c, const char *path) /* {{{ */
{
- struct sockaddr_un sa;
+ struct sockaddr_un sa = { 0 };
int fd;
int status;
return (-1);
}
- memset (&sa, 0, sizeof (sa));
sa.sun_family = AF_UNIX;
strncpy (sa.sun_path, path, sizeof (sa.sun_path) - 1);
static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */
const char *addr_orig)
{
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_res;
struct addrinfo *ai_ptr;
char addr_copy[NI_MAXHOST];
addr_copy[sizeof(addr_copy) - 1] = '\0';
addr = addr_copy;
- memset (&ai_hints, 0, sizeof (ai_hints));
- ai_hints.ai_flags = 0;
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
static int server_send_buffer (lcc_server_t *srv) /* {{{ */
{
- char buffer[LCC_NETWORK_BUFFER_SIZE_DEFAULT];
+ char buffer[LCC_NETWORK_BUFFER_SIZE_DEFAULT] = { 0 };
size_t buffer_size;
int status;
return (status);
}
- memset (buffer, 0, sizeof (buffer));
buffer_size = sizeof (buffer);
status = lcc_network_buffer_finalize (srv->buffer);
* index is preferred here, because of its similarity
* to the way IPv6 handles this. Unfortunately, it
* appears not to be portable. */
- struct ip_mreqn mreq;
-
- memset (&mreq, 0, sizeof (mreq));
- mreq.imr_multiaddr.s_addr = addr->sin_addr.s_addr;
- mreq.imr_address.s_addr = ntohl (INADDR_ANY);
- mreq.imr_ifindex = (int) if_index;
+ struct ip_mreqn mreq = {
+ .imr_multiaddr.s_addr = addr->sin_addr.s_addr,
+ .imr_address.s_addr = ntohl (INADDR_ANY),
+ .imr_ifindex = (int) if_index
+ };
#else
- struct ip_mreq mreq;
-
- memset (&mreq, 0, sizeof (mreq));
- mreq.imr_multiaddr.s_addr = addr->sin_addr.s_addr;
- mreq.imr_interface.s_addr = ntohl (INADDR_ANY);
+ struct ip_mreq mreq = {
+ .imr_multiaddr.s_addr = addr->sin_addr.s_addr,
+ .imr_interface.s_addr = ntohl (INADDR_ANY)
+ }
#endif
status = setsockopt (srv->fd, IPPROTO_IP, IP_MULTICAST_IF,
uint16_t pkg_type = htons (TYPE_ENCR_AES256);
uint16_t pkg_length = 0; /* Filled in in finalize. */
uint16_t pkg_user_len = htons ((uint16_t) username_length);
- char hash[20];
+ /* Filled in in finalize. */
+ char hash[20] = { 0 };
nb->encr_header_len = username_length;
nb->encr_header_len += PART_ENCRYPTION_AES256_SIZE;
gcry_randomize ((void *) &nb->encr_iv, sizeof (nb->encr_iv),
GCRY_STRONG_RANDOM);
- /* Filled in in finalize. */
- memset (hash, 0, sizeof (hash));
-
ADD_STATIC (nb, pkg_type);
ADD_STATIC (nb, pkg_length);
ADD_STATIC (nb, pkg_user_len);
static int
process_station (int sk, const char *dev, struct ieee80211req_sta_info *si)
{
- struct iwreq iwr;
static char mac[DATA_MAX_NAME_LEN];
struct ieee80211req_sta_stats stats;
const struct ieee80211_nodestats *ns = &stats.is_stats;
if (item_watched (STAT_NODE_RSSI))
submit_gauge (dev, "node_rssi", mac, NULL, si->isi_rssi);
- memset (&iwr, 0, sizeof (iwr));
+ struct iwreq iwr = {
+ .u.data.pointer = (void *) &stats,
+ .u.data.length = sizeof (stats)
+ };
sstrncpy(iwr.ifr_name, dev, sizeof (iwr.ifr_name));
- iwr.u.data.pointer = (void *) &stats;
- iwr.u.data.length = sizeof (stats);
+
memcpy(stats.is_u.macaddr, si->isi_macaddr, IEEE80211_ADDR_LEN);
status = ioctl(sk, IEEE80211_IOCTL_STA_STATS, &iwr);
if (status < 0)
process_stations (int sk, const char *dev)
{
uint8_t buf[24*1024];
- struct iwreq iwr;
uint8_t *cp;
int nodes;
size_t len;
int status;
- memset (&iwr, 0, sizeof (iwr));
+ struct iwreq iwr = {
+ .u.data.pointer = (void *) buf,
+ .u.data.length = sizeof (buf)
+ };
sstrncpy (iwr.ifr_name, dev, sizeof (iwr.ifr_name));
- iwr.u.data.pointer = (void *) buf;
- iwr.u.data.length = sizeof (buf);
status = ioctl (sk, IEEE80211_IOCTL_STA_INFO, &iwr);
if (status < 0)
void module_register (void)
{
- match_proc_t mproc;
+ match_proc_t mproc = { 0 };
- memset (&mproc, 0, sizeof (mproc));
mproc.create = mh_create;
mproc.destroy = mh_destroy;
mproc.match = mh_match;
void module_register (void)
{
- match_proc_t mproc;
+ match_proc_t mproc = { 0 };
- memset (&mproc, 0, sizeof (mproc));
mproc.create = mr_create;
mproc.destroy = mr_destroy;
mproc.match = mr_match;
void module_register (void)
{
- match_proc_t mproc;
+ match_proc_t mproc = { 0 };
- memset (&mproc, 0, sizeof (mproc));
mproc.create = mt_create;
mproc.destroy = mt_destroy;
mproc.match = mt_match;
void module_register (void)
{
- match_proc_t mproc;
+ match_proc_t mproc = { 0 };
- memset (&mproc, 0, sizeof (mproc));
mproc.create = mv_create;
mproc.destroy = mv_destroy;
mproc.match = mv_match;
const char *host;
const char *port;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list, *ai_ptr;
int ai_return;
- memset (&ai_hints, '\0', sizeof (ai_hints));
- ai_hints.ai_flags = 0;
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
static int memcached_connect_unix (memcached_t *st)
{
- struct sockaddr_un serv_addr;
+ struct sockaddr_un serv_addr = { 0 };
int fd;
- memset (&serv_addr, 0, sizeof (serv_addr));
serv_addr.sun_family = AF_UNIX;
sstrncpy (serv_addr.sun_path, st->socket,
sizeof (serv_addr.sun_path));
const char *host;
const char *port;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list, *ai_ptr;
int status;
int fd = -1;
- memset (&ai_hints, 0, sizeof (ai_hints));
- ai_hints.ai_flags = 0;
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
static int memcached_add_read_callback (memcached_t *st)
{
- user_data_t ud;
+ user_data_t ud = { 0 };
char callback_name[3*DATA_MAX_NAME_LEN];
int status;
- memset (&ud, 0, sizeof (ud));
ud.data = st;
ud.free_func = memcached_free;
#elif HAVE_SYSCTL
int mib[] = {CTL_VM, VM_METER};
- struct vmtotal vmtotal;
+ struct vmtotal vmtotal = { 0 };
gauge_t mem_active;
gauge_t mem_inactive;
gauge_t mem_free;
size_t size;
- memset (&vmtotal, 0, sizeof (vmtotal));
size = sizeof (vmtotal);
if (sysctl (mib, 2, &vmtotal, &size, NULL, 0) < 0) {
/* #endif HAVE_LIBSTATGRAB */
#elif HAVE_PERFSTAT
- perfstat_memory_total_t pmemory;
+ perfstat_memory_total_t pmemory = { 0 };
- memset (&pmemory, 0, sizeof (pmemory));
if (perfstat_memory_total(NULL, &pmemory, sizeof(pmemory), 1) < 0)
{
char errbuf[1024];
static int mb_read_data (mb_host_t *host, mb_slave_t *slave, /* {{{ */
mb_data_t *data)
{
- uint16_t values[2];
+ uint16_t values[2] = { 0 };
int values_num;
const data_set_t *ds;
int status = 0;
"is not UINT32.", data->type, DS_TYPE_TO_STRING (ds->ds[0].type));
}
- memset (values, 0, sizeof (values));
if ((data->register_type == REG_TYPE_INT32)
|| (data->register_type == REG_TYPE_UINT32)
|| (data->register_type == REG_TYPE_FLOAT))
static int mb_config_add_data (oconfig_item_t *ci) /* {{{ */
{
- mb_data_t data;
+ mb_data_t data = { 0 };
int status;
int i;
- memset (&data, 0, sizeof (data));
data.name = NULL;
data.register_type = REG_TYPE_UINT16;
data.next = NULL;
{
struct addrinfo *ai_list;
struct addrinfo *ai_ptr;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
int status;
if ((host == NULL) || (address == NULL))
return (EINVAL);
- memset (&ai_hints, 0, sizeof (ai_hints));
#if AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
{
mqtt_client_conf_t *conf;
char cb_name[1024];
- user_data_t user_data;
+ user_data_t user_data = { 0 };
int status;
int i;
}
ssnprintf (cb_name, sizeof (cb_name), "mqtt/%s", conf->name);
- memset (&user_data, 0, sizeof (user_data));
user_data.data = conf;
plugin_register_write (cb_name, mqtt_write, &user_data);
if ((fd = open(device, O_RDWR | O_NOCTTY)) != -1)
{
- struct termios tios;
+ struct termios tios = { 0 };
int rts = TIOCM_RTS;
double value;
- memset (&tios, 0, sizeof (tios));
tios.c_cflag = B1200 | CS7 | CSTOPB | CREAD | CLOCAL;
tios.c_iflag = IGNBRK | IGNPAR;
tios.c_oflag = 0;
/* If all went well, register this database for reading */
if (status == 0)
{
- user_data_t ud;
+ user_data_t ud = { 0 };
char cb_name[DATA_MAX_NAME_LEN];
DEBUG ("mysql plugin: Registering new read callback: %s",
(db->database != NULL) ? db->database : "<default>");
- memset (&ud, 0, sizeof (ud));
ud.data = (void *) db;
ud.free_func = mysql_database_free;
static int cna_handle_wafl_data (const char *hostname, cfg_wafl_t *cfg_wafl, /* {{{ */
na_elem_t *data, cdtime_t interval)
{
- cfg_wafl_t perf_data;
+ cfg_wafl_t perf_data = { 0 };
const char *plugin_inst;
na_elem_t *instances;
na_elem_t *counter;
na_elem_iter_t counter_iter;
- memset (&perf_data, 0, sizeof (perf_data));
-
perf_data.timestamp = cna_child_get_cdtime (data);
instances = na_elem_child(na_elem_child (data, "instances"), "instance-data");
instance = na_iterator_next(&instance_iter))
{
disk_t *old_data;
- disk_t new_data;
+ disk_t new_data = { 0 };
na_elem_iter_t counter_iterator;
na_elem_t *counter;
- memset (&new_data, 0, sizeof (new_data));
new_data.timestamp = timestamp;
new_data.disk_busy_percent = NAN;
{
const char *name;
- data_volume_perf_t perf_data;
+ data_volume_perf_t perf_data = { 0 };
data_volume_perf_t *v;
na_elem_t *elem_counters;
na_elem_iter_t iter_counters;
na_elem_t *elem_counter;
- memset (&perf_data, 0, sizeof (perf_data));
perf_data.timestamp = timestamp;
name = na_child_get_string (elem_instance, "name");
static int cna_change_volume_status (const char *hostname, /* {{{ */
data_volume_usage_t *v)
{
- notification_t n;
+ notification_t n = { 0 };
- memset (&n, 0, sizeof (n));
n.time = cdtime ();
sstrncpy (n.host, hostname, sizeof (n.host));
sstrncpy (n.plugin, "netapp", sizeof (n.plugin));
static int cna_register_host (host_config_t *host) /* {{{ */
{
char cb_name[256];
- user_data_t ud;
+ user_data_t ud = { 0 };
if (host->vfiler)
ssnprintf (cb_name, sizeof (cb_name), "netapp-%s-%s",
else
ssnprintf (cb_name, sizeof (cb_name), "netapp-%s", host->name);
- memset (&ud, 0, sizeof (ud));
ud.data = host;
ud.free_func = (void (*) (void *)) free_host_config;
static int cna_init (void) /* {{{ */
{
- char err[256];
+ char err[256] = { 0 };
- memset (err, 0, sizeof (err));
if (!na_startup(err, sizeof(err))) {
err[sizeof (err) - 1] = 0;
ERROR("netapp plugin: Error initializing netapp API: %s", err);
size_t buffer_offset;
uint16_t username_len;
part_encryption_aes256_t pea;
- unsigned char hash[sizeof (pea.hash)];
+ unsigned char hash[sizeof (pea.hash)] = { 0 };
gcry_cipher_hd_t cypher;
gcry_error_t err;
assert (buffer_offset == (part_size - payload_len));
/* Check hash sum */
- memset (hash, 0, sizeof (hash));
gcry_md_hash_buffer (GCRY_MD_SHA1, hash,
buffer + buffer_offset, payload_len);
if (memcmp (hash, pea.hash, sizeof (hash)) != 0)
int status;
value_list_t vl = VALUE_LIST_INIT;
- notification_t n;
+ notification_t n = { 0 };
#if HAVE_LIBGCRYPT
int packet_was_signed = (flags & PP_SIGNED);
memset (&vl, '\0', sizeof (vl));
- memset (&n, '\0', sizeof (n));
status = 0;
while ((status == 0) && (0 < buffer_size)
* index is preferred here, because of its similarity
* to the way IPv6 handles this. Unfortunately, it
* appears not to be portable. */
- struct ip_mreqn mreq;
-
- memset (&mreq, 0, sizeof (mreq));
- mreq.imr_multiaddr.s_addr = addr->sin_addr.s_addr;
- mreq.imr_address.s_addr = ntohl (INADDR_ANY);
- mreq.imr_ifindex = se->interface;
+ struct ip_mreqn mreq = {
+ .imr_multiaddr.s_addr = addr->sin_addr.s_addr,
+ .imr_address.s_addr = ntohl (INADDR_ANY),
+ .imr_ifindex = se->interface
+ };
#else
- struct ip_mreq mreq;
-
- memset (&mreq, 0, sizeof (mreq));
- mreq.imr_multiaddr.s_addr = addr->sin_addr.s_addr;
- mreq.imr_interface.s_addr = ntohl (INADDR_ANY);
+ struct ip_mreq mreq = {
+ .imr_multiaddr.s_addr = addr->sin_addr.s_addr,
+ .imr_interface.s_addr = ntohl (INADDR_ANY)
+ };
#endif
if (setsockopt (se->data.client.fd, IPPROTO_IP, IP_MULTICAST_IF,
static c_complain_t complaint = C_COMPLAIN_INIT_STATIC;
struct sockent_client *client;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list = NULL, *ai_ptr;
int status;
_Bool reconnect = 0;
if (client->fd >= 0 && !reconnect) /* already connected and not stale*/
return (0);
- memset (&ai_hints, 0, sizeof (ai_hints));
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
/* Open the file descriptors for a initialized sockent structure. */
static int sockent_server_listen (sockent_t *se) /* {{{ */
{
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list, *ai_ptr;
int status;
DEBUG ("network plugin: sockent_server_listen: node = %s; service = %s;",
node, service);
- memset (&ai_hints, 0, sizeof (ai_hints));
- ai_hints.ai_flags = 0;
#ifdef AI_PASSIVE
ai_hints.ai_flags |= AI_PASSIVE;
#endif
static void network_send_buffer_signed (sockent_t *se, /* {{{ */
const char *in_buffer, size_t in_buffer_size)
{
- part_signature_sha256_t ps;
char buffer[BUFF_SIG_SIZE + in_buffer_size];
size_t buffer_offset;
size_t username_len;
in_buffer, in_buffer_size);
/* Initialize the `ps' structure. */
- memset (&ps, 0, sizeof (ps));
- ps.head.type = htons (TYPE_SIGN_SHA256);
- ps.head.length = htons (PART_SIGNATURE_SHA256_SIZE + username_len);
+ part_signature_sha256_t ps = {
+ .head.type = htons (TYPE_SIGN_SHA256),
+ .head.length = htons (PART_SIGNATURE_SHA256_SIZE + username_len)
+ };
/* Calculate the hash value. */
gcry_md_write (hd, buffer + PART_SIGNATURE_SHA256_SIZE,
static void network_send_buffer_encrypted (sockent_t *se, /* {{{ */
const char *in_buffer, size_t in_buffer_size)
{
- part_encryption_aes256_t pea;
char buffer[BUFF_SIG_SIZE + in_buffer_size];
size_t buffer_size;
size_t buffer_offset;
gcry_cipher_hd_t cypher;
/* Initialize the header fields */
- memset (&pea, 0, sizeof (pea));
- pea.head.type = htons (TYPE_ENCR_AES256);
-
- pea.username = se->data.client.username;
+ part_encryption_aes256_t pea = {
+ .head.type = htons (TYPE_ENCR_AES256),
+ .username = se->data.client.username
+ };
username_len = strlen (pea.username);
if ((PART_ENCRYPTION_AES256_SIZE + username_len) > BUFF_SIG_SIZE)
char const *file = NAGIOS_COMMAND_FILE;
int fd;
int status;
- struct flock lock;
+ struct flock lock = { 0 };
if (nagios_command_file != NULL)
file = nagios_command_file;
return status;
}
- memset (&lock, 0, sizeof (lock));
lock.l_type = F_WRLCK;
lock.l_whence = SEEK_END;
- lock.l_start = 0;
- lock.l_len = 0; /* to end of file */
status = fcntl (fd, F_GETLK, &lock);
if (status != 0)
const char *host;
const char *port;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list;
struct addrinfo *ai_ptr;
int status;
if (strlen (port) == 0)
port = NTPD_DEFAULT_PORT;
- memset (&ai_hints, '\0', sizeof (ai_hints));
- ai_hints.ai_flags = 0;
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
struct timeval time_now;
int timeout;
- int pkt_item_num; /* items in this packet */
- int pkt_item_len; /* size of the items in this packet */
+ int pkt_item_num; /* items in this packet */
+ int pkt_item_len; /* size of the items in this packet */
int pkt_sequence;
- char pkt_recvd[MAXSEQ+1]; /* sequence numbers that have been received */
- int pkt_recvd_num; /* number of packets that have been received */
- int pkt_lastseq; /* the last sequence number */
- ssize_t pkt_padding; /* Padding in this packet */
+ char pkt_recvd[MAXSEQ+1] = { 0 }; /* sequence numbers that have been received */
+ int pkt_recvd_num; /* number of packets that have been received */
+ int pkt_lastseq; /* the last sequence number */
+ ssize_t pkt_padding; /* Padding in this packet */
if ((sd = ntpd_connect ()) < 0)
return (-1);
items = NULL;
items_num = 0;
- memset (pkt_recvd, '\0', sizeof (pkt_recvd));
pkt_recvd_num = 0;
pkt_lastseq = -1;
static int ntpd_send_request (int req_code, int req_items, int req_size, char *req_data)
{
int sd;
- struct req_pkt req;
+ struct req_pkt req = { 0 };
size_t req_data_len;
int status;
if ((sd = ntpd_connect ()) < 0)
return (-1);
- memset (&req, '\0', sizeof (req));
req.rm_vn_mode = RM_VN_MODE(0, 0, 0);
req.auth_seq = AUTH_SEQ (0, 0);
req.implementation = IMPL_XNTPD;
static int ntpd_get_name_from_address (char *buffer, size_t buffer_size,
struct info_peer_summary const *peer_info, _Bool do_reverse_lookup)
{
- struct sockaddr_storage sa;
+ struct sockaddr_storage sa = { 0 };
socklen_t sa_len;
int flags = 0;
int status;
- memset (&sa, 0, sizeof (sa));
-
if (peer_info->v6_flag)
{
- struct sockaddr_in6 sa6;
+ struct sockaddr_in6 sa6 = { 0 };
assert (sizeof (sa) >= sizeof (sa6));
- memset (&sa6, 0, sizeof (sa6));
sa6.sin6_family = AF_INET6;
sa6.sin6_port = htons (123);
memcpy (&sa6.sin6_addr, &peer_info->srcadr6,
}
else
{
- struct sockaddr_in sa4;
+ struct sockaddr_in sa4 = { 0 };
assert (sizeof (sa) >= sizeof (sa4));
- memset (&sa4, 0, sizeof (sa4));
sa4.sin_family = AF_INET;
sa4.sin_port = htons (123);
memcpy (&sa4.sin_addr, &peer_info->srcadr,
while (42)
{
char path[PATH_MAX];
- struct stat statbuf;
+ struct stat statbuf = { 0 };
int status;
ssnprintf (path, sizeof (path), NUMA_ROOT_DIR "/node%i", max_node + 1);
- memset (&statbuf, 0, sizeof (statbuf));
status = stat (path, &statbuf);
if (status == 0)
static FILE *olsrd_connect (void) /* {{{ */
{
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list, *ai_ptr;
int ai_return;
FILE *fh;
- memset (&ai_hints, 0, sizeof (ai_hints));
- ai_hints.ai_flags = 0;
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
if (config_want_topology == OLSRD_WANT_DETAIL)
{
- char type_instance[DATA_MAX_NAME_LEN];
+ char type_instance[DATA_MAX_NAME_LEN] = { 0 };
- memset (type_instance, 0, sizeof (type_instance));
ssnprintf (type_instance, sizeof (type_instance), "%s-%s-lq",
fields[0], fields[1]);
DEBUG ("olsrd plugin: type_instance = %s; lq = %g;", type_instance, lq);
}
else
{
- char type_instance[DATA_MAX_NAME_LEN];
+ char type_instance[DATA_MAX_NAME_LEN] = { 0 };
- memset (type_instance, 0, sizeof (type_instance));
ssnprintf (type_instance, sizeof (type_instance), "%s-%s-nlq",
fields[0], fields[1]);
DEBUG ("olsrd plugin: type_instance = %s; nlq = %g;", type_instance, nlq);
}
else
{
- user_data_t ud;
- char callback_name[3*DATA_MAX_NAME_LEN];
+ user_data_t ud = { 0 };
+ char callback_name[3*DATA_MAX_NAME_LEN] = { 0 };
databases = temp;
databases[databases_num] = st;
databases_num++;
- memset (&ud, 0, sizeof (ud));
ud.data = st;
- memset (callback_name, 0, sizeof (callback_name));
ssnprintf (callback_name, sizeof (callback_name),
"openldap/%s/%s",
(st->host != NULL) ? st->host : hostname_g,
*/
static int pplugin_dispatch_notification (pTHX_ HV *notif)
{
- notification_t n;
+ notification_t n = { 0 };
int ret;
if (NULL == notif)
return -1;
- memset (&n, 0, sizeof (n));
-
if (0 != hv2notification (aTHX_ notif, &n))
return -1;
static int pf_read (void)
{
- struct pf_status state;
+ struct pf_status state = { 0 };
int fd;
int status;
int i;
return (-1);
}
- memset (&state, 0, sizeof (state));
status = ioctl (fd, DIOCGETSTATUS, &state);
if (status != 0)
{
pinba_socket_t *s;
struct addrinfo *ai_list;
struct addrinfo *ai_ptr;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
int status;
- memset (&ai_hints, 0, sizeof (ai_hints));
ai_hints.ai_flags = AI_PASSIVE;
ai_hints.ai_family = AF_UNSPEC;
ai_hints.ai_socktype = SOCK_DGRAM;
c_psql_database_t *db;
char cb_name[DATA_MAX_NAME_LEN];
- user_data_t ud;
+ user_data_t ud = { 0 };
static _Bool have_flush = 0;
return 1;
}
- memset (&ud, 0, sizeof (ud));
-
db = c_psql_database_new (ci->values[0].value.string);
if (db == NULL)
return -1;
char *buffer = NULL;
size_t buffer_size = 0;
- struct sockaddr_un sa_unix;
+ struct sockaddr_un sa_unix = { 0 };
struct timeval stv_timeout;
cdtime_t cdt_timeout;
return (-1);
}
- memset (&sa_unix, 0, sizeof (sa_unix));
sa_unix.sun_family = AF_UNIX;
sstrncpy (sa_unix.sun_path,
(local_sockpath != NULL) ? local_sockpath : PDNS_LOCAL_SOCKPATH,
char buf[512];
reg_function_t *register_function = (reg_function_t *) reg;
cpy_callback_t *c = NULL;
- user_data_t user_data;
+ user_data_t user_data = { 0 };
char *name = NULL;
PyObject *callback = NULL, *data = NULL;
static char *kwlist[] = {"callback", "data", "name", NULL};
c->data = data;
c->next = NULL;
- memset (&user_data, 0, sizeof (user_data));
user_data.free_func = cpy_destroy_user_data;
user_data.data = c;
static PyObject *cpy_register_read(PyObject *self, PyObject *args, PyObject *kwds) {
char buf[512];
cpy_callback_t *c = NULL;
- user_data_t user_data;
+ user_data_t user_data = { 0 };
double interval = 0;
char *name = NULL;
PyObject *callback = NULL, *data = NULL;
c->data = data;
c->next = NULL;
- memset (&user_data, 0, sizeof (user_data));
user_data.free_func = cpy_destroy_user_data;
user_data.data = c;
static void *cpy_interactive(void *data) {
sigset_t sigset;
- struct sigaction sig_int_action, old;
+ struct sigaction old;
/* Signal handler in a plugin? Bad stuff, but the best way to
* handle it I guess. In an interactive session people will
* still interrupt syscalls like sleep and pause.
* It does not raise a KeyboardInterrupt exception because so
* far nobody managed to figure out how to do that. */
- memset (&sig_int_action, '\0', sizeof (sig_int_action));
- sig_int_action.sa_handler = cpy_int_handler;
+ struct sigaction sig_int_action = {
+ .sa_handler = cpy_int_handler
+ };
sigaction (SIGINT, &sig_int_action, &old);
sigemptyset(&sigset);
static int redis_config_node (oconfig_item_t *ci) /* {{{ */
{
- redis_node_t rn;
redis_query_t *rq;
int i;
int status;
int timeout;
- memset (&rn, 0, sizeof (rn));
+ redis_node_t rn = {
+ .port = REDIS_DEF_PORT,
+ .timeout.tv_usec = REDIS_DEF_TIMEOUT
+ };
+
sstrncpy (rn.host, REDIS_DEF_HOST, sizeof (rn.host));
- rn.port = REDIS_DEF_PORT;
- rn.timeout.tv_usec = REDIS_DEF_TIMEOUT;
- rn.queries = NULL;
status = cf_util_get_string_buffer (ci, rn.name, sizeof (rn.name));
if (status != 0)
/* Registration stuff. */
char cb_name[DATA_MAX_NAME_LEN];
- user_data_t cb_data;
+ user_data_t cb_data = { 0 };
hd = calloc (1, sizeof (*hd));
if (hd == NULL)
ssnprintf (cb_name, sizeof (cb_name), "snmp-%s", hd->name);
- memset (&cb_data, 0, sizeof (cb_data));
cb_data.data = hd;
cb_data.free_func = csnmp_host_definition_destroy;
}
else
{
- char oid_buffer[1024];
+ char oid_buffer[1024] = { 0 };
- memset (oid_buffer, 0, sizeof (oid_buffer));
snprint_objid (oid_buffer, sizeof (oid_buffer) - 1,
vl->name, vl->name_length);
vl.interval = host->interval;
have_more = 1;
- memset (¤t_suffix, 0, sizeof (current_suffix));
while (have_more)
{
_Bool suffix_skipped = 0;
struct pollfd *fds = NULL;
size_t fds_num = 0;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list = NULL;
struct addrinfo *ai_ptr;
int status;
char const *service = (conf_service != NULL)
? conf_service : STATSD_DEFAULT_SERVICE;
- memset (&ai_hints, 0, sizeof (ai_hints));
ai_hints.ai_flags = AI_PASSIVE;
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#elif HAVE_PERFSTAT
static int swap_read (void) /* {{{ */
{
- perfstat_memory_total_t pmemory;
+ perfstat_memory_total_t pmemory = { 0 };
int status;
gauge_t total;
gauge_t free;
gauge_t reserved;
- memset (&pmemory, 0, sizeof (pmemory));
status = perfstat_memory_total (NULL, &pmemory, sizeof(perfstat_memory_total_t), 1);
if (status < 0)
{
static int ctail_config_add_match (cu_tail_match_t *tm,
const char *plugin_instance, oconfig_item_t *ci, cdtime_t interval)
{
- ctail_config_match_t cm;
+ ctail_config_match_t cm = { 0 };
int status;
int i;
- memset (&cm, '\0', sizeof (cm));
-
if (ci->values_num != 0)
{
WARNING ("tail plugin: Ignoring arguments for the `Match' block.");
static int ctail_init (void)
{
char str[255];
- user_data_t ud;
+ user_data_t ud = { 0 };
size_t i;
if (tail_match_list_num == 0)
return (-1);
}
- memset(&ud, '\0', sizeof(ud));
-
for (i = 0; i < tail_match_list_num; i++)
{
ud.data = (void *)tail_match_list[i];
/* Registration variables */
char cb_name[DATA_MAX_NAME_LEN];
- user_data_t cb_data;
+ user_data_t cb_data = { 0 };
id = calloc(1, sizeof(*id));
if (id == NULL)
}
ssnprintf (cb_name, sizeof (cb_name), "tail_csv/%s", id->path);
- memset(&cb_data, 0, sizeof(cb_data));
cb_data.data = id;
cb_data.free_func = tcsv_instance_definition_destroy;
status = plugin_register_complex_read(NULL, cb_name, tcsv_read, id->interval, &cb_data);
notification_meta_t __attribute__((unused)) **meta, void **user_data)
{
tn_data_t *data;
- notification_t n;
+ notification_t n = { 0 };
char temp[NOTIF_MAX_MSG_LEN];
gauge_t *rates;
}
/* Initialize the structure. */
- memset (&n, 0, sizeof (n));
n.severity = data->severity;
n.time = cdtime ();
sstrncpy (n.message, data->message, sizeof (n.message));
void module_register (void)
{
- target_proc_t tproc;
+ target_proc_t tproc = { 0 };
- memset (&tproc, 0, sizeof (tproc));
tproc.create = tn_create;
tproc.destroy = tn_destroy;
tproc.invoke = tn_invoke;
tr_action_t *act;
int status;
char buffer[DATA_MAX_NAME_LEN];
- regmatch_t matches[8];
+ regmatch_t matches[8] = { [0] = { 0 } };
if (act_head == NULL)
return (-EINVAL);
sstrncpy (buffer, buffer_in, sizeof (buffer));
- memset (matches, 0, sizeof (matches));
DEBUG ("target_replace plugin: tr_action_invoke: <- buffer = %s;", buffer);
void module_register (void)
{
- target_proc_t tproc;
+ target_proc_t tproc = { 0 };
- memset (&tproc, 0, sizeof (tproc));
tproc.create = tr_create;
tproc.destroy = tr_destroy;
tproc.invoke = tr_invoke;
void module_register (void)
{
- target_proc_t tproc;
+ target_proc_t tproc = { 0 };
- memset (&tproc, 0, sizeof (tproc));
tproc.create = ts_create;
tproc.destroy = ts_destroy;
tproc.invoke = ts_invoke;
void module_register (void)
{
- target_proc_t tproc;
+ target_proc_t tproc = { 0 };
- memset (&tproc, 0, sizeof (tproc));
tproc.create = ts_create;
tproc.destroy = ts_destroy;
tproc.invoke = ts_invoke;
void module_register (void)
{
- target_proc_t tproc;
+ target_proc_t tproc = { 0 };
- memset (&tproc, 0, sizeof (tproc));
tproc.create = v5_create;
tproc.destroy = v5_destroy;
tproc.invoke = v5_invoke;
{
#if HAVE_STRUCT_LINUX_INET_DIAG_REQ
int fd;
- struct sockaddr_nl nladdr;
- struct nlreq req;
- struct msghdr msg;
- struct iovec iov;
struct inet_diag_msg *r;
char buf[8192];
return (-1);
}
- memset(&nladdr, 0, sizeof(nladdr));
- nladdr.nl_family = AF_NETLINK;
-
- memset(&req, 0, sizeof(req));
- req.nlh.nlmsg_len = sizeof(req);
- req.nlh.nlmsg_type = TCPDIAG_GETSOCK;
- /* NLM_F_ROOT: return the complete table instead of a single entry.
- * NLM_F_MATCH: return all entries matching criteria (not implemented)
- * NLM_F_REQUEST: must be set on all request messages */
- req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
- req.nlh.nlmsg_pid = 0;
- /* The sequence_number is used to track our messages. Since netlink is not
- * reliable, we don't want to end up with a corrupt or incomplete old
- * message in case the system is/was out of memory. */
- req.nlh.nlmsg_seq = ++sequence_number;
- req.r.idiag_family = AF_INET;
- req.r.idiag_states = 0xfff;
- req.r.idiag_ext = 0;
-
- memset(&iov, 0, sizeof(iov));
- iov.iov_base = &req;
- iov.iov_len = sizeof(req);
-
- memset(&msg, 0, sizeof(msg));
- msg.msg_name = (void*)&nladdr;
- msg.msg_namelen = sizeof(nladdr);
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
+ struct sockaddr_nl nladdr = {
+ .nl_family = AF_NETLINK
+ };
+
+ struct nlreq req = {
+ .nlh.nlmsg_len = sizeof(req),
+ .nlh.nlmsg_type = TCPDIAG_GETSOCK,
+ /* NLM_F_ROOT: return the complete table instead of a single entry.
+ * NLM_F_MATCH: return all entries matching criteria (not implemented)
+ * NLM_F_REQUEST: must be set on all request messages */
+ .nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST,
+ .nlh.nlmsg_pid = 0,
+ /* The sequence_number is used to track our messages. Since netlink is not
+ * reliable, we don't want to end up with a corrupt or incomplete old
+ * message in case the system is/was out of memory. */
+ .nlh.nlmsg_seq = ++sequence_number,
+ .r.idiag_family = AF_INET,
+ .r.idiag_states = 0xfff,
+ .r.idiag_ext = 0
+ };
+
+ struct iovec iov = {
+ .iov_base = &req,
+ .iov_len = sizeof(req)
+ };
+
+ struct msghdr msg = {
+ .msg_name = (void*)&nladdr,
+ .msg_namelen = sizeof(nladdr),
+ .msg_iov = &iov,
+ .msg_iovlen = 1
+ };
if (sendmsg (fd, &msg, 0) < 0)
{
* Returns connected file objects or establishes the connection
* if it's not already present
*/
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_head;
struct addrinfo *ai_ptr;
int sd = -1;
}
/* Get all addrs for this hostname */
- memset (&ai_hints, 0, sizeof (ai_hints));
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
gauge_t packet_loss = NAN;
int valid = 0;
- char plugin_instance[DATA_MAX_NAME_LEN];
+ char plugin_instance[DATA_MAX_NAME_LEN] = { 0 };
FILE *read_fh;
FILE *write_fh;
if (vserver == NULL)
{
/* Request global information */
- memset (plugin_instance, 0, sizeof (plugin_instance));
-
status = tss2_send_request (write_fh, "gi\r\n");
}
else
int package_buffer_pos;
fd_set input;
- struct timeval timeout;
+
+ /* Initialize timeout structure, set to 2 seconds */
+ struct timeval timeout = {
+ .tv_sec = 2
+ };
int end_flag;
int escape_flag;
FD_ZERO (&input);
FD_SET (fd, &input);
- /* Initialize timeout structure, set to 2 seconds */
- memset (&timeout, 0, sizeof (timeout));
- timeout.tv_sec = 2;
- timeout.tv_usec = 0;
-
/* clear out anything in the buffer */
tcflush (fd, TCIFLUSH);
int status = 0;
int old_size = c_avl_size (threshold_tree);
- threshold_t th;
-
if (threshold_tree == NULL)
{
threshold_tree = c_avl_create ((int (*) (const void *, const void *)) strcmp);
}
}
- memset (&th, '\0', sizeof (th));
- th.warning_min = NAN;
- th.warning_max = NAN;
- th.failure_min = NAN;
- th.failure_max = NAN;
-
- th.hits = 0;
- th.hysteresis = 0;
- th.flags = UT_FLAG_INTERESTING; /* interesting by default */
+ threshold_t th = {
+ .warning_min = NAN,
+ .warning_max = NAN,
+ .failure_min = NAN,
+ .failure_max = NAN,
+ .flags = UT_FLAG_INTERESTING /* interesting by default */
+ };
for (i = 0; i < ci->children_num; i++)
{
*/
static int us_open_socket (void)
{
- struct sockaddr_un sa;
+ struct sockaddr_un sa = { 0 };
int status;
sock_fd = socket (PF_UNIX, SOCK_STREAM, 0);
return (-1);
}
- memset (&sa, '\0', sizeof (sa));
sa.sun_family = AF_UNIX;
sstrncpy (sa.sun_path, (sock_file != NULL) ? sock_file : US_DEFAULT_PATH,
sizeof (sa.sun_path));
/* #endif HAVE_LIBKSTAT */
# elif HAVE_SYS_SYSCTL_H
- struct timeval boottv;
+ struct timeval boottv = { 0 };
size_t boottv_len;
int status;
- int mib[2];
-
- mib[0] = CTL_KERN;
- mib[1] = KERN_BOOTTIME;
+ int mib[] = { CTL_KERN, KERN_BOOTTIME };
boottv_len = sizeof (boottv);
- memset (&boottv, 0, boottv_len);
status = sysctl (mib, STATIC_ARRAY_SIZE (mib), &boottv, &boottv_len,
/* new_value = */ NULL, /* new_length = */ 0);
char *type;
char *type_instance;
- value_list_t vl;
threshold_t threshold;
int status;
return (-1);
}
- memset (&vl, 0, sizeof (vl));
+ value_list_t vl = {
+ .values = NULL
+ };
sstrncpy (vl.host, host, sizeof (vl.host));
sstrncpy (vl.plugin, plugin, sizeof (vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
sfree (identifier_copy);
- memset (&threshold, 0, sizeof (threshold));
status = ut_search_threshold (&vl, &threshold);
if (status == ENOENT)
{
int handle_putnotif (FILE *fh, char *buffer)
{
char *command;
- notification_t n;
+ notification_t n = { 0 };
int status;
if ((fh == NULL) || (buffer == NULL))
return (-1);
}
- memset (&n, '\0', sizeof (n));
-
status = 0;
while (*buffer != 0)
{
{
FILE *fh;
char buffer[4096];
- struct flock fl;
+ struct flock fl = { 0 };
c_avl_tree_t *tree;
int status;
if (fh == NULL)
return (-1);
- memset (&fl, 0, sizeof (fl));
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
- fl.l_start = 0;
- fl.l_len = 0; /* == entire file */
/* TODO: Lock file? -> fcntl */
status = fcntl (fileno (fh), F_SETLK, &fl);
static int fbh_check_file (fbhash_t *h) /* {{{ */
{
- struct stat statbuf;
+ struct stat statbuf = { 0 };
int status;
- memset (&statbuf, 0, sizeof (statbuf));
-
status = stat (h->filename, &statbuf);
if (status != 0)
return (-1);
identifier_t ident;
void *user_class;
- memset (&ident, 0, sizeof (ident));
strncpy (ident.host, host, sizeof (ident.host));
strncpy (ident.plugin, plugin, sizeof (ident.plugin));
strncpy (ident.plugin_instance, plugin_instance, sizeof (ident.plugin_instance));
static int wg_callback_init (struct wg_callback *cb)
{
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list;
struct addrinfo *ai_ptr;
cdtime_t now;
return (EAGAIN);
cb->last_connect_time = now;
- memset (&ai_hints, 0, sizeof (ai_hints));
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
static int wg_write_messages (const data_set_t *ds, const value_list_t *vl,
struct wg_callback *cb)
{
- char buffer[WG_SEND_BUF_SIZE];
+ char buffer[WG_SEND_BUF_SIZE] = { 0 };
int status;
if (0 != strcmp (ds->type, vl->type))
return -1;
}
- memset (buffer, 0, sizeof (buffer));
status = format_graphite (buffer, sizeof (buffer), ds, vl,
cb->prefix, cb->postfix, cb->escape_char, cb->format_flags);
if (status != 0) /* error message has been printed already. */
static int config_set_char (char *dest,
oconfig_item_t *ci)
{
- char buffer[4];
+ char buffer[4] = { 0 };
int status;
- memset (buffer, 0, sizeof (buffer));
-
status = cf_util_get_string_buffer (ci, buffer, sizeof (buffer));
if (status != 0)
return (status);
static int wg_config_node (oconfig_item_t *ci)
{
struct wg_callback *cb;
- user_data_t user_data;
+ user_data_t user_data = { 0 };
char callback_name[DATA_MAX_NAME_LEN];
int i;
int status = 0;
ssnprintf (callback_name, sizeof (callback_name), "write_graphite/%s",
cb->name);
- memset (&user_data, 0, sizeof (user_data));
user_data.data = cb;
user_data.free_func = wg_callback_free;
plugin_register_write (callback_name, wg_write, &user_data);
{
wh_callback_t *cb;
int buffer_size = 0;
- user_data_t user_data;
+ user_data_t user_data = { 0 };
char callback_name[DATA_MAX_NAME_LEN];
int status = 0;
int i;
DEBUG ("write_http: Registering write callback '%s' with URL '%s'",
callback_name, cb->location);
- memset (&user_data, 0, sizeof (user_data));
user_data.data = cb;
- user_data.free_func = NULL;
plugin_register_flush (callback_name, wh_flush, &user_data);
user_data.free_func = wh_callback_free;
static int wl_write_messages (const data_set_t *ds, const value_list_t *vl)
{
- char buffer[WL_BUF_SIZE];
+ char buffer[WL_BUF_SIZE] = { 0 };
int status;
if (0 != strcmp (ds->type, vl->type))
return -1;
}
- memset (buffer, 0, sizeof (buffer));
status = format_graphite (buffer, sizeof (buffer), ds, vl,
NULL, NULL, '_', 0);
if (status != 0) /* error message has been printed already. */
wr_node_t *node = ud->data;
char ident[512];
char key[512];
- char value[512];
+ char value[512] = { 0 };
char time[24];
size_t value_size;
char *value_ptr;
ident);
ssnprintf (time, sizeof (time), "%.9f", CDTIME_T_TO_DOUBLE(vl->time));
- memset (value, 0, sizeof (value));
value_size = sizeof (value);
value_ptr = &value[0];
status = format_values (value_ptr, value_size, ds, vl, node->store_rates);
static int wt_callback_init(struct wt_callback *cb)
{
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list;
struct addrinfo *ai_ptr;
int status;
if (cb->sock_fd > 0)
return 0;
- memset(&ai_hints, 0, sizeof(ai_hints));
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
static int wt_config_tsd(oconfig_item_t *ci)
{
struct wt_callback *cb;
- user_data_t user_data;
+ user_data_t user_data = { 0 };
char callback_name[DATA_MAX_NAME_LEN];
int i;
cb->node != NULL ? cb->node : WT_DEFAULT_NODE,
cb->service != NULL ? cb->service : WT_DEFAULT_SERVICE);
- memset(&user_data, 0, sizeof(user_data));
user_data.data = cb;
user_data.free_func = wt_callback_free;
plugin_register_write(callback_name, wt_write, &user_data);
{
int sk = -1;
int status;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints = { 0 };
struct addrinfo *ai;
struct addrinfo *ai_list;
const char *host;
const char *port;
- memset (&ai_hints, '\0', sizeof (ai_hints));
ai_hints.ai_family = AF_UNSPEC;
ai_hints.ai_socktype = SOCK_STREAM;