sizeof(char) is 1 by definition.
ERROR("sstrdup: Out of memory.");
exit(3);
}
- memcpy(r, s, sizeof(char) * sz);
+ memcpy(r, s, sz);
return (r);
} /* char *sstrdup */
oci_defines = NULL;
ALLOC_OR_FAIL(column_names, column_num * sizeof(char *));
- ALLOC_OR_FAIL(column_names[0], column_num * DATA_MAX_NAME_LEN * sizeof(char));
+ ALLOC_OR_FAIL(column_names[0], column_num * DATA_MAX_NAME_LEN);
for (size_t i = 1; i < column_num; i++)
column_names[i] = column_names[i - 1] + DATA_MAX_NAME_LEN;
ALLOC_OR_FAIL(column_values, column_num * sizeof(char *));
ALLOC_OR_FAIL(column_values[0],
- column_num * DATA_MAX_NAME_LEN * sizeof(char));
+ column_num * DATA_MAX_NAME_LEN);
for (size_t i = 1; i < column_num; i++)
column_values[i] = column_values[i - 1] + DATA_MAX_NAME_LEN;
if ((domname == NULL) || (devpath == NULL))
return 0;
- n = sizeof(char) * (strlen(domname) + strlen(devpath) + 2);
+ n = strlen(domname) + strlen(devpath) + 2;
name = malloc(n);
if (name == NULL) {
ERROR(PLUGIN_NAME " plugin: malloc failed.");
uri_length = strlen(format_string) + strlen(node->user) +
strlen(node->passwd) + strlen(node->host) + 5 +
strlen(node->db) + 1;
- if ((uri = calloc(sizeof(char), uri_length)) == NULL) {
+ if ((uri = calloc(1, uri_length)) == NULL) {
ERROR("write_mongodb plugin: Not enough memory to assemble "
"authentication string.");
mongoc_client_destroy(node->client);
} else {
format_string = "mongodb://%s:%d";
uri_length = strlen(format_string) + strlen(node->host) + 5 + 1;
- if ((uri = calloc(sizeof(char), uri_length)) == NULL) {
+ if ((uri = calloc(1, uri_length)) == NULL) {
ERROR("write_mongodb plugin: Not enough memory to assemble "
"authentication string.");
mongoc_client_destroy(node->client);
ERROR("write_sensu plugin: Unable to alloc memory");
return -1;
}
- strs->strs = realloc(strs->strs, sizeof(char *) * (strs->nb_strs + 1));
+ strs->strs = realloc(strs->strs, strs->nb_strs + 1);
if (strs->strs == NULL) {
strs->strs = old_strs_ptr;
free(newstr);
char *ret_str = NULL;
char *temp_str;
if (list->nb_strs == 0) {
- ret_str = malloc(sizeof(char));
+ ret_str = malloc(1);
if (ret_str == NULL) {
ERROR("write_sensu plugin: Unable to alloc memory");
return NULL;