summaryrefslogtreecommitdiffstats
path: root/usr.sbin/nscd
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2009-06-13 13:07:56 +0000
committerdes <des@FreeBSD.org>2009-06-13 13:07:56 +0000
commitfeee7c0482f0d8cc0f167db30f14db19552cfb66 (patch)
tree938166a168a8b3b655695f86589862545145f186 /usr.sbin/nscd
parent51194019fc09872f7a745dffc7f000c58a8de5d1 (diff)
downloadFreeBSD-src-feee7c0482f0d8cc0f167db30f14db19552cfb66.zip
FreeBSD-src-feee7c0482f0d8cc0f167db30f14db19552cfb66.tar.gz
Remove casts from {c,m,re}alloc() and simplify sizeof().
MFC after: 1 week
Diffstat (limited to 'usr.sbin/nscd')
-rw-r--r--usr.sbin/nscd/agent.c4
-rw-r--r--usr.sbin/nscd/agents/group.c12
-rw-r--r--usr.sbin/nscd/agents/passwd.c12
-rw-r--r--usr.sbin/nscd/agents/services.c14
-rw-r--r--usr.sbin/nscd/cachelib.c44
-rw-r--r--usr.sbin/nscd/cacheplcs.c16
-rw-r--r--usr.sbin/nscd/config.c22
-rw-r--r--usr.sbin/nscd/hashtable.h12
-rw-r--r--usr.sbin/nscd/mp_rs_query.c4
-rw-r--r--usr.sbin/nscd/mp_ws_query.c4
-rw-r--r--usr.sbin/nscd/nscd.c10
-rw-r--r--usr.sbin/nscd/nscdcli.c2
-rw-r--r--usr.sbin/nscd/query.c18
13 files changed, 87 insertions, 87 deletions
diff --git a/usr.sbin/nscd/agent.c b/usr.sbin/nscd/agent.c
index 2102012..55b1565 100644
--- a/usr.sbin/nscd/agent.c
+++ b/usr.sbin/nscd/agent.c
@@ -61,7 +61,7 @@ init_agent_table(void)
struct agent_table *retval;
TRACE_IN(init_agent_table);
- retval = (struct agent_table *)calloc(1, sizeof(struct agent_table));
+ retval = calloc(1, sizeof(*retval));
assert(retval != NULL);
TRACE_OUT(init_agent_table);
@@ -78,7 +78,7 @@ register_agent(struct agent_table *at, struct agent *a)
assert(at != NULL);
assert(a != NULL);
new_agents_num = at->agents_num + 1;
- new_agents = (struct agent **)malloc(sizeof(struct agent *) *
+ new_agents = malloc(sizeof(*new_agents) *
new_agents_num);
assert(new_agents != NULL);
memcpy(new_agents, at->agents, at->agents_num * sizeof(struct agent *));
diff --git a/usr.sbin/nscd/agents/group.c b/usr.sbin/nscd/agents/group.c
index b9d7fca..92be7ed 100644
--- a/usr.sbin/nscd/agents/group.c
+++ b/usr.sbin/nscd/agents/group.c
@@ -141,7 +141,7 @@ group_lookup_func(const char *key, size_t key_size, char **buffer,
switch (lookup_type) {
case nss_lt_name:
size = key_size - sizeof(enum nss_lookup_type) + 1;
- name = (char *)calloc(1, size);
+ name = calloc(1, size);
assert(name != NULL);
memcpy(name, key + sizeof(enum nss_lookup_type), size - 1);
break;
@@ -175,7 +175,7 @@ group_lookup_func(const char *key, size_t key_size, char **buffer,
if (result != NULL) {
group_marshal_func(result, NULL, buffer_size);
- *buffer = (char *)malloc(*buffer_size);
+ *buffer = malloc(*buffer_size);
assert(*buffer != NULL);
group_marshal_func(result, *buffer, buffer_size);
}
@@ -203,7 +203,7 @@ group_mp_lookup_func(char **buffer, size_t *buffer_size, void *mdata)
result = getgrent();
if (result != NULL) {
group_marshal_func(result, NULL, buffer_size);
- *buffer = (char *)malloc(*buffer_size);
+ *buffer = malloc(*buffer_size);
assert(*buffer != NULL);
group_marshal_func(result, *buffer, buffer_size);
}
@@ -225,7 +225,7 @@ init_group_agent(void)
struct common_agent *retval;
TRACE_IN(init_group_agent);
- retval = (struct common_agent *)calloc(1, sizeof(struct common_agent));
+ retval = calloc(1, sizeof(*retval));
assert(retval != NULL);
retval->parent.name = strdup("group");
@@ -244,8 +244,8 @@ init_group_mp_agent(void)
struct multipart_agent *retval;
TRACE_IN(init_group_mp_agent);
- retval = (struct multipart_agent *)calloc(1,
- sizeof(struct multipart_agent));
+ retval = calloc(1,
+ sizeof(*retval));
assert(retval != NULL);
retval->parent.name = strdup("group");
diff --git a/usr.sbin/nscd/agents/passwd.c b/usr.sbin/nscd/agents/passwd.c
index fbc3e46..247444f 100644
--- a/usr.sbin/nscd/agents/passwd.c
+++ b/usr.sbin/nscd/agents/passwd.c
@@ -150,7 +150,7 @@ passwd_lookup_func(const char *key, size_t key_size, char **buffer,
switch (lookup_type) {
case nss_lt_name:
size = key_size - sizeof(enum nss_lookup_type) + 1;
- login = (char *)calloc(1, size);
+ login = calloc(1, size);
assert(login != NULL);
memcpy(login, key + sizeof(enum nss_lookup_type), size - 1);
break;
@@ -183,7 +183,7 @@ passwd_lookup_func(const char *key, size_t key_size, char **buffer,
if (result != NULL) {
passwd_marshal_func(result, NULL, buffer_size);
- *buffer = (char *)malloc(*buffer_size);
+ *buffer = malloc(*buffer_size);
assert(*buffer != NULL);
passwd_marshal_func(result, *buffer, buffer_size);
}
@@ -211,7 +211,7 @@ passwd_mp_lookup_func(char **buffer, size_t *buffer_size, void *mdata)
result = getpwent();
if (result != NULL) {
passwd_marshal_func(result, NULL, buffer_size);
- *buffer = (char *)malloc(*buffer_size);
+ *buffer = malloc(*buffer_size);
assert(*buffer != NULL);
passwd_marshal_func(result, *buffer, buffer_size);
}
@@ -233,7 +233,7 @@ init_passwd_agent(void)
struct common_agent *retval;
TRACE_IN(init_passwd_agent);
- retval = (struct common_agent *)calloc(1, sizeof(struct common_agent));
+ retval = calloc(1, sizeof(*retval));
assert(retval != NULL);
retval->parent.name = strdup("passwd");
@@ -252,8 +252,8 @@ init_passwd_mp_agent(void)
struct multipart_agent *retval;
TRACE_IN(init_passwd_mp_agent);
- retval = (struct multipart_agent *)calloc(1,
- sizeof(struct multipart_agent));
+ retval = calloc(1,
+ sizeof(*retval));
assert(retval != NULL);
retval->parent.name = strdup("passwd");
diff --git a/usr.sbin/nscd/agents/services.c b/usr.sbin/nscd/agents/services.c
index d38675e..7b02e50 100644
--- a/usr.sbin/nscd/agents/services.c
+++ b/usr.sbin/nscd/agents/services.c
@@ -146,7 +146,7 @@ services_lookup_func(const char *key, size_t key_size, char **buffer,
switch (lookup_type) {
case nss_lt_name:
size = key_size - sizeof(enum nss_lookup_type);
- name = (char *)calloc(1, size + 1);
+ name = calloc(1, size + 1);
assert(name != NULL);
memcpy(name, key + sizeof(enum nss_lookup_type), size);
@@ -169,7 +169,7 @@ services_lookup_func(const char *key, size_t key_size, char **buffer,
size = key_size - sizeof(enum nss_lookup_type) - sizeof(int);
if (size > 0) {
- proto = (char *)calloc(1, size + 1);
+ proto = calloc(1, size + 1);
assert(proto != NULL);
memcpy(proto, key + sizeof(enum nss_lookup_type) +
sizeof(int), size);
@@ -196,7 +196,7 @@ services_lookup_func(const char *key, size_t key_size, char **buffer,
if (result != NULL) {
services_marshal_func(result, NULL, buffer_size);
- *buffer = (char *)malloc(*buffer_size);
+ *buffer = malloc(*buffer_size);
assert(*buffer != NULL);
services_marshal_func(result, *buffer, buffer_size);
}
@@ -224,7 +224,7 @@ services_mp_lookup_func(char **buffer, size_t *buffer_size, void *mdata)
result = getservent();
if (result != NULL) {
services_marshal_func(result, NULL, buffer_size);
- *buffer = (char *)malloc(*buffer_size);
+ *buffer = malloc(*buffer_size);
assert(*buffer != NULL);
services_marshal_func(result, *buffer, buffer_size);
}
@@ -246,7 +246,7 @@ init_services_agent(void)
struct common_agent *retval;
TRACE_IN(init_services_agent);
- retval = (struct common_agent *)calloc(1, sizeof(struct common_agent));
+ retval = calloc(1, sizeof(*retval));
assert(retval != NULL);
retval->parent.name = strdup("services");
@@ -265,8 +265,8 @@ init_services_mp_agent(void)
struct multipart_agent *retval;
TRACE_IN(init_services_mp_agent);
- retval = (struct multipart_agent *)calloc(1,
- sizeof(struct multipart_agent));
+ retval = calloc(1,
+ sizeof(*retval));
assert(retval != NULL);
retval->parent.name = strdup("services");
diff --git a/usr.sbin/nscd/cachelib.c b/usr.sbin/nscd/cachelib.c
index 5817255..afdbc0a 100644
--- a/usr.sbin/nscd/cachelib.c
+++ b/usr.sbin/nscd/cachelib.c
@@ -481,14 +481,14 @@ init_cache(struct cache_params const *params)
TRACE_IN(init_cache);
assert(params != NULL);
- retval = (struct cache_ *)calloc(1, sizeof(struct cache_));
+ retval = calloc(1, sizeof(*retval));
assert(retval != NULL);
assert(params != NULL);
memcpy(&retval->params, params, sizeof(struct cache_params));
- retval->entries = (struct cache_entry_ **)calloc(1,
- sizeof(struct cache_entry_ *) * INITIAL_ENTRIES_CAPACITY);
+ retval->entries = calloc(1,
+ sizeof(*retval->entries) * INITIAL_ENTRIES_CAPACITY);
assert(retval->entries != NULL);
retval->entries_capacity = INITIAL_ENTRIES_CAPACITY;
@@ -540,8 +540,8 @@ register_cache_entry(struct cache_ *the_cache,
new_capacity = the_cache->entries_capacity +
ENTRIES_CAPACITY_STEP;
- new_entries = (struct cache_entry_ **)calloc(1,
- sizeof(struct cache_entry_ *) * new_capacity);
+ new_entries = calloc(1,
+ sizeof(*new_entries) * new_capacity);
assert(new_entries != NULL);
memcpy(new_entries, the_cache->entries,
@@ -556,8 +556,8 @@ register_cache_entry(struct cache_ *the_cache,
switch (params->entry_type)
{
case CET_COMMON:
- new_common_entry = (struct cache_common_entry_ *)calloc(1,
- sizeof(struct cache_common_entry_));
+ new_common_entry = calloc(1,
+ sizeof(*new_common_entry));
assert(new_common_entry != NULL);
memcpy(&new_common_entry->common_params, params,
@@ -565,7 +565,7 @@ register_cache_entry(struct cache_ *the_cache,
new_common_entry->params =
(struct cache_entry_params *)&new_common_entry->common_params;
- new_common_entry->common_params.cep.entry_name = (char *)calloc(1,
+ new_common_entry->common_params.cep.entry_name = calloc(1,
entry_name_size);
assert(new_common_entry->common_params.cep.entry_name != NULL);
strlcpy(new_common_entry->common_params.cep.entry_name,
@@ -582,8 +582,8 @@ register_cache_entry(struct cache_ *the_cache,
else
policies_size = 2;
- new_common_entry->policies = (struct cache_policy_ **)calloc(1,
- sizeof(struct cache_policy_ *) * policies_size);
+ new_common_entry->policies = calloc(1,
+ sizeof(*new_common_entry->policies) * policies_size);
assert(new_common_entry->policies != NULL);
new_common_entry->policies_size = policies_size;
@@ -610,8 +610,8 @@ register_cache_entry(struct cache_ *the_cache,
(struct cache_entry_ *)new_common_entry;
break;
case CET_MULTIPART:
- new_mp_entry = (struct cache_mp_entry_ *)calloc(1,
- sizeof(struct cache_mp_entry_));
+ new_mp_entry = calloc(1,
+ sizeof(*new_mp_entry));
assert(new_mp_entry != NULL);
memcpy(&new_mp_entry->mp_params, params,
@@ -619,7 +619,7 @@ register_cache_entry(struct cache_ *the_cache,
new_mp_entry->params =
(struct cache_entry_params *)&new_mp_entry->mp_params;
- new_mp_entry->mp_params.cep.entry_name = (char *)calloc(1,
+ new_mp_entry->mp_params.cep.entry_name = calloc(1,
entry_name_size);
assert(new_mp_entry->mp_params.cep.entry_name != NULL);
strlcpy(new_mp_entry->mp_params.cep.entry_name, params->entry_name,
@@ -830,10 +830,10 @@ cache_write(struct cache_entry_ *entry, const char *key, size_t key_size,
return (-1);
}
- item_data.key = (char *)malloc(key_size);
+ item_data.key = malloc(key_size);
memcpy(item_data.key, key, key_size);
- item_data.value = (char *)malloc(value_size);
+ item_data.value = malloc(value_size);
assert(item_data.value != NULL);
memcpy(item_data.value, value, value_size);
@@ -912,8 +912,8 @@ open_cache_mp_write_session(struct cache_entry_ *entry)
return (NULL);
}
- retval = (struct cache_mp_write_session_ *)calloc(1,
- sizeof(struct cache_mp_write_session_));
+ retval = calloc(1,
+ sizeof(*retval));
assert(retval != NULL);
TAILQ_INIT(&retval->items);
@@ -947,11 +947,11 @@ cache_mp_write(struct cache_mp_write_session_ *ws, char *data,
return (-1);
}
- new_item = (struct cache_mp_data_item_ *)calloc(1,
- sizeof(struct cache_mp_data_item_));
+ new_item = calloc(1,
+ sizeof(*new_item));
assert(new_item != NULL);
- new_item->value = (char *)malloc(data_size);
+ new_item->value = malloc(data_size);
assert(new_item->value != NULL);
memcpy(new_item->value, data, data_size);
new_item->value_size = data_size;
@@ -1050,8 +1050,8 @@ open_cache_mp_read_session(struct cache_entry_ *entry)
}
}
- retval = (struct cache_mp_read_session_ *)calloc(1,
- sizeof(struct cache_mp_read_session_));
+ retval = calloc(1,
+ sizeof(*retval));
assert(retval != NULL);
retval->parent_entry = mp_entry;
diff --git a/usr.sbin/nscd/cacheplcs.c b/usr.sbin/nscd/cacheplcs.c
index 6f45b5a..37cf765 100644
--- a/usr.sbin/nscd/cacheplcs.c
+++ b/usr.sbin/nscd/cacheplcs.c
@@ -86,8 +86,8 @@ cache_queue_policy_create_item(void)
struct cache_queue_policy_item_ *retval;
TRACE_IN(cache_queue_policy_create_item);
- retval = (struct cache_queue_policy_item_ *)calloc(1,
- sizeof(struct cache_queue_policy_item_));
+ retval = calloc(1,
+ sizeof(*retval));
assert(retval != NULL);
TRACE_OUT(cache_queue_policy_create_item);
@@ -196,8 +196,8 @@ init_cache_queue_policy(void)
struct cache_queue_policy_ *retval;
TRACE_IN(init_cache_queue_policy);
- retval = (struct cache_queue_policy_ *)calloc(1,
- sizeof(struct cache_queue_policy_));
+ retval = calloc(1,
+ sizeof(*retval));
assert(retval != NULL);
retval->parent_data.create_item_func = cache_queue_policy_create_item;
@@ -336,8 +336,8 @@ cache_lfu_policy_create_item(void)
struct cache_lfu_policy_item_ *retval;
TRACE_IN(cache_lfu_policy_create_item);
- retval = (struct cache_lfu_policy_item_ *)calloc(1,
- sizeof(struct cache_lfu_policy_item_));
+ retval = calloc(1,
+ sizeof(*retval));
assert(retval != NULL);
TRACE_OUT(cache_lfu_policy_create_item);
@@ -540,8 +540,8 @@ init_cache_lfu_policy(void)
struct cache_lfu_policy_ *retval;
TRACE_IN(init_cache_lfu_policy);
- retval = (struct cache_lfu_policy_ *)calloc(1,
- sizeof(struct cache_lfu_policy_));
+ retval = calloc(1,
+ sizeof(*retval));
assert(retval != NULL);
retval->parent_data.create_item_func = cache_lfu_policy_create_item;
diff --git a/usr.sbin/nscd/config.c b/usr.sbin/nscd/config.c
index 367ea23..856cf97 100644
--- a/usr.sbin/nscd/config.c
+++ b/usr.sbin/nscd/config.c
@@ -125,8 +125,8 @@ create_configuration_entry(const char *name,
assert(negative_params != NULL);
assert(mp_params != NULL);
- retval = (struct configuration_entry *)calloc(1,
- sizeof(struct configuration_entry));
+ retval = calloc(1,
+ sizeof(*retval));
assert(retval != NULL);
res = pthread_mutex_init(&retval->positive_cache_lock, NULL);
@@ -167,7 +167,7 @@ create_configuration_entry(const char *name,
sizeof(struct mp_cache_entry_params));
size = strlen(name);
- retval->name = (char *)calloc(1, size + 1);
+ retval->name = calloc(1, size + 1);
assert(retval->name != NULL);
memcpy(retval->name, name, size);
@@ -272,8 +272,8 @@ add_configuration_entry(struct configuration *config,
struct configuration_entry **new_entries;
config->entries_capacity *= 2;
- new_entries = (struct configuration_entry **)calloc(1,
- sizeof(struct configuration_entry *) *
+ new_entries = calloc(1,
+ sizeof(*new_entries) *
config->entries_capacity);
assert(new_entries != NULL);
memcpy(new_entries, config->entries,
@@ -340,7 +340,7 @@ configuration_entry_add_mp_cache_entry(struct configuration_entry *config_entry,
TRACE_IN(configuration_entry_add_mp_cache_entry);
++config_entry->mp_cache_entries_size;
- new_mp_entries = (cache_entry *)malloc(sizeof(cache_entry) *
+ new_mp_entries = malloc(sizeof(*new_mp_entries) *
config_entry->mp_cache_entries_size);
assert(new_mp_entries != NULL);
new_mp_entries[0] = c_entry;
@@ -516,12 +516,12 @@ init_configuration(void)
struct configuration *retval;
TRACE_IN(init_configuration);
- retval = (struct configuration *)calloc(1, sizeof(struct configuration));
+ retval = calloc(1, sizeof(*retval));
assert(retval != NULL);
retval->entries_capacity = INITIAL_ENTRIES_CAPACITY;
- retval->entries = (struct configuration_entry **)calloc(1,
- sizeof(struct configuration_entry *) *
+ retval->entries = calloc(1,
+ sizeof(*retval->entries) *
retval->entries_capacity);
assert(retval->entries != NULL);
@@ -543,12 +543,12 @@ fill_configuration_defaults(struct configuration *config)
free(config->socket_path);
len = strlen(DEFAULT_SOCKET_PATH);
- config->socket_path = (char *)calloc(1, len + 1);
+ config->socket_path = calloc(1, len + 1);
assert(config->socket_path != NULL);
memcpy(config->socket_path, DEFAULT_SOCKET_PATH, len);
len = strlen(DEFAULT_PIDFILE_PATH);
- config->pidfile_path = (char *)calloc(1, len + 1);
+ config->pidfile_path = calloc(1, len + 1);
assert(config->pidfile_path != NULL);
memcpy(config->pidfile_path, DEFAULT_PIDFILE_PATH, len);
diff --git a/usr.sbin/nscd/hashtable.h b/usr.sbin/nscd/hashtable.h
index 5f8da82..4ad9e3e 100644
--- a/usr.sbin/nscd/hashtable.h
+++ b/usr.sbin/nscd/hashtable.h
@@ -74,16 +74,16 @@ typedef unsigned int hashtable_index_t;
#define HASHTABLE_INIT(table, type, field, _entries_size) \
do { \
hashtable_index_t var; \
- (table)->entries = (void *)calloc(1, \
+ (table)->entries = calloc(1, \
sizeof(*(table)->entries) * (_entries_size)); \
(table)->entries_size = (_entries_size); \
for (var = 0; var < HASHTABLE_ENTRIES_COUNT(table); ++var) {\
(table)->entries[var].field.capacity = \
HASHTABLE_INITIAL_ENTRIES_CAPACITY; \
(table)->entries[var].field.size = 0; \
- (table)->entries[var].field.values = (type *)malloc(\
- sizeof(type) * \
- HASHTABLE_INITIAL_ENTRIES_CAPACITY); \
+ (table)->entries[var].field.values = malloc( \
+ sizeof(type) * \
+ HASHTABLE_INITIAL_ENTRIES_CAPACITY); \
assert((table)->entries[var].field.values != NULL);\
} \
} while (0)
@@ -128,12 +128,12 @@ typedef unsigned int hashtable_index_t;
#define HASHTABLE_ENTRY_CAPACITY_INCREASE(entry, field, type) \
(entry)->field.capacity *= 2; \
- (entry)->field.values = (type *)realloc((entry)->field.values, \
+ (entry)->field.values = realloc((entry)->field.values, \
(entry)->field.capacity * sizeof(type));
#define HASHTABLE_ENTRY_CAPACITY_DECREASE(entry, field, type) \
(entry)->field.capacity /= 2; \
- (entry)->field.values = (type *)realloc((entry)->field.values, \
+ (entry)->field.values = realloc((entry)->field.values, \
(entry)->field.capacity * sizeof(type));
/*
diff --git a/usr.sbin/nscd/mp_rs_query.c b/usr.sbin/nscd/mp_rs_query.c
index 81f128e..4bec517 100644
--- a/usr.sbin/nscd/mp_rs_query.c
+++ b/usr.sbin/nscd/mp_rs_query.c
@@ -117,7 +117,7 @@ on_mp_read_session_request_read1(struct query_state *qstate)
return (-1);
}
- c_mp_rs_request->entry = (char *)calloc(1,
+ c_mp_rs_request->entry = calloc(1,
c_mp_rs_request->entry_length + 1);
assert(c_mp_rs_request->entry != NULL);
@@ -428,7 +428,7 @@ on_mp_read_session_read_request_process(struct query_state *qstate)
&read_response->data_size);
if (read_response->error_code == 0) {
- read_response->data = (char *)malloc(read_response->data_size);
+ read_response->data = malloc(read_response->data_size);
assert(read_response != NULL);
read_response->error_code = cache_mp_read(
(cache_mp_read_session)qstate->mdata,
diff --git a/usr.sbin/nscd/mp_ws_query.c b/usr.sbin/nscd/mp_ws_query.c
index 5ac4c0c..5e29748 100644
--- a/usr.sbin/nscd/mp_ws_query.c
+++ b/usr.sbin/nscd/mp_ws_query.c
@@ -122,7 +122,7 @@ on_mp_write_session_request_read1(struct query_state *qstate)
return (-1);
}
- c_mp_ws_request->entry = (char *)calloc(1,
+ c_mp_ws_request->entry = calloc(1,
c_mp_ws_request->entry_length + 1);
assert(c_mp_ws_request->entry != NULL);
@@ -375,7 +375,7 @@ on_mp_write_session_write_request_read1(struct query_state *qstate)
return (-1);
}
- write_request->data = (char *)calloc(1, write_request->data_size);
+ write_request->data = calloc(1, write_request->data_size);
assert(write_request->data != NULL);
qstate->kevent_watermark = write_request->data_size;
diff --git a/usr.sbin/nscd/nscd.c b/usr.sbin/nscd/nscd.c
index 59b3c12..6b5af94 100644
--- a/usr.sbin/nscd/nscd.c
+++ b/usr.sbin/nscd/nscd.c
@@ -164,7 +164,7 @@ init_runtime_env(struct configuration *config)
struct runtime_env *retval;
TRACE_IN(init_runtime_env);
- retval = (struct runtime_env *)calloc(1, sizeof(struct runtime_env));
+ retval = calloc(1, sizeof(*retval));
assert(retval != NULL);
retval->sockfd = socket(PF_LOCAL, SOCK_STREAM, 0);
@@ -408,7 +408,7 @@ process_socket_event(struct kevent *event_data, struct runtime_env *env,
if (qstate->io_buffer != NULL)
free(qstate->io_buffer);
- qstate->io_buffer = (char *)calloc(1,
+ qstate->io_buffer = calloc(1,
qstate->kevent_watermark);
assert(qstate->io_buffer != NULL);
@@ -828,11 +828,11 @@ main(int argc, char *argv[])
}
if (s_configuration->threads_num > 1) {
- threads = (pthread_t *)calloc(1, sizeof(pthread_t) *
+ threads = calloc(1, sizeof(*threads) *
s_configuration->threads_num);
for (i = 0; i < s_configuration->threads_num; ++i) {
- thread_args = (struct processing_thread_args *)malloc(
- sizeof(struct processing_thread_args));
+ thread_args = malloc(
+ sizeof(*thread_args));
thread_args->the_cache = s_cache;
thread_args->the_runtime_env = s_runtime_env;
thread_args->the_configuration = s_configuration;
diff --git a/usr.sbin/nscd/nscdcli.c b/usr.sbin/nscd/nscdcli.c
index 1f9a459..9b07201 100644
--- a/usr.sbin/nscd/nscdcli.c
+++ b/usr.sbin/nscd/nscdcli.c
@@ -205,7 +205,7 @@ open_nscd_connection__(struct nscd_connection_params const *params)
}
fcntl(client_socket, F_SETFL, O_NONBLOCK);
- retval = calloc(1, sizeof(struct nscd_connection_));
+ retval = calloc(1, sizeof(*retval));
assert(retval != NULL);
retval->sockfd = client_socket;
diff --git a/usr.sbin/nscd/query.c b/usr.sbin/nscd/query.c
index fff6aff..c233e19 100644
--- a/usr.sbin/nscd/query.c
+++ b/usr.sbin/nscd/query.c
@@ -335,11 +335,11 @@ on_write_request_read1(struct query_state *qstate)
return (-1);
}
- write_request->entry = (char *)calloc(1,
+ write_request->entry = calloc(1,
write_request->entry_length + 1);
assert(write_request->entry != NULL);
- write_request->cache_key = (char *)calloc(1,
+ write_request->cache_key = calloc(1,
write_request->cache_key_size +
qstate->eid_str_length);
assert(write_request->cache_key != NULL);
@@ -347,7 +347,7 @@ on_write_request_read1(struct query_state *qstate)
qstate->eid_str_length);
if (write_request->data_size != 0) {
- write_request->data = (char *)calloc(1,
+ write_request->data = calloc(1,
write_request->data_size);
assert(write_request->data != NULL);
}
@@ -608,11 +608,11 @@ on_read_request_read1(struct query_state *qstate)
return (-1);
}
- read_request->entry = (char *)calloc(1,
+ read_request->entry = calloc(1,
read_request->entry_length + 1);
assert(read_request->entry != NULL);
- read_request->cache_key = (char *)calloc(1,
+ read_request->cache_key = calloc(1,
read_request->cache_key_size +
qstate->eid_str_length);
assert(read_request->cache_key != NULL);
@@ -723,8 +723,8 @@ on_read_request_process(struct query_state *qstate)
&read_response->data_size);
if (read_response->error_code == -2) {
- read_response->data = (char *)malloc(
- read_response->data_size);
+ read_response->data = malloc(
+ read_response->data_size);
assert(read_response != NULL);
read_response->error_code = cache_read(c_entry,
read_request->cache_key,
@@ -930,7 +930,7 @@ on_transform_request_read1(struct query_state *qstate)
return (-1);
}
- transform_request->entry = (char *)calloc(1,
+ transform_request->entry = calloc(1,
transform_request->entry_length + 1);
assert(transform_request->entry != NULL);
@@ -1226,7 +1226,7 @@ init_query_state(int sockfd, size_t kevent_watermark, uid_t euid, gid_t egid)
struct query_state *retval;
TRACE_IN(init_query_state);
- retval = (struct query_state *)calloc(1, sizeof(struct query_state));
+ retval = calloc(1, sizeof(*retval));
assert(retval != NULL);
retval->sockfd = sockfd;
OpenPOWER on IntegriCloud