}
column_num = PQnfields(res);
- column_names = (char **)calloc(column_num, sizeof(char *));
- if (NULL == column_names) {
+ column_names = calloc(column_num, sizeof(*column_names));
+ if (column_names == NULL) {
log_err("calloc failed.");
BAIL_OUT(-1);
}
- column_values = (char **)calloc(column_num, sizeof(char *));
- if (NULL == column_values) {
+ column_values = calloc(column_num, sizeof(*column_values));
+ if (column_values == NULL) {
log_err("calloc failed.");
BAIL_OUT(-1);
}
c_psql_param_t *tmp;
data = udb_query_get_user_data(q);
- if (NULL == data) {
+ if (data == NULL) {
data = calloc(1, sizeof(*data));
- if (NULL == data) {
+ if (data == NULL) {
log_err("Out of memory.");
return -1;
}
}
tmp = realloc(data->params, (data->params_num + 1) * sizeof(*data->params));
- if (NULL == tmp) {
+ if (tmp == NULL) {
log_err("Out of memory.");
return -1;
}
}
if (db->queries_num > 0) {
- db->q_prep_areas = (udb_query_preparation_area_t **)calloc(
- db->queries_num, sizeof(*db->q_prep_areas));
-
+ db->q_prep_areas = calloc(db->queries_num, sizeof(*db->q_prep_areas));
if (db->q_prep_areas == NULL) {
log_err("Out of memory.");
c_psql_database_delete(db);