summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9eb3efd)
raw | patch | inline | side by side (parent: 9eb3efd)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Tue, 11 Apr 2017 14:57:57 +0000 (16:57 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Tue, 11 Apr 2017 14:57:57 +0000 (16:57 +0200) |
sizeof(char) is 1 by definition.
src/daemon/common.c | patch | blob | history | |
src/oracle.c | patch | blob | history | |
src/virt.c | patch | blob | history | |
src/write_mongodb.c | patch | blob | history | |
src/write_sensu.c | patch | blob | history |
diff --git a/src/daemon/common.c b/src/daemon/common.c
index c45304e88d88bd34368017edd87e0651e7d9d1f7..a167122cd9dcf6412ebc297fb902b3336a2465e3 100644 (file)
--- a/src/daemon/common.c
+++ b/src/daemon/common.c
ERROR("sstrdup: Out of memory.");
exit(3);
}
- memcpy(r, s, sizeof(char) * sz);
+ memcpy(r, s, sz);
return (r);
} /* char *sstrdup */
diff --git a/src/oracle.c b/src/oracle.c
index b52ea4eef6f318f5b6cee60f810e4a69fff88c0b..cdeebfeffb3152f9503260ce123282b7fcb3dc03 100644 (file)
--- a/src/oracle.c
+++ b/src/oracle.c
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;
diff --git a/src/virt.c b/src/virt.c
index 140b4883cc5fffa3bc86e12b114827c7a79b8d1e..a8f378a2d5b7bef38d859cad6f011f4bbd2f57d4 100644 (file)
--- a/src/virt.c
+++ b/src/virt.c
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.");
diff --git a/src/write_mongodb.c b/src/write_mongodb.c
index 66dc8e07404cc8093a84c453cdb3bfd4f3272c18..44181e9387b9363c3518bb9f957579f773a70b4e 100644 (file)
--- a/src/write_mongodb.c
+++ b/src/write_mongodb.c
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);
diff --git a/src/write_sensu.c b/src/write_sensu.c
index c0c06347d4c6483db9aaaca3ab4a693b3899fc2e..6e6517bdf845cdd836fd76ae36c5f86ba21a7e68 100644 (file)
--- a/src/write_sensu.c
+++ b/src/write_sensu.c
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;