From 4469e69a44cfe2df8ac6394190de45fd364594f5 Mon Sep 17 00:00:00 2001 From: Jakob Olsson <jakobols@kth.se> Date: Mon, 4 Jun 2018 13:58:27 +0200 Subject: [PATCH] change sizeof(<var_type>) to <var> --- common_zte.c | 2 +- dongle_infrastructure.c | 2 +- libmobile_hilink.c | 6 +++--- libmobile_zte.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common_zte.c b/common_zte.c index fd9dc29..1e42a83 100644 --- a/common_zte.c +++ b/common_zte.c @@ -4,7 +4,7 @@ int print_to_ubus(struct json_object *parsed_response, struct ubus_context *ctx, { struct blob_buf bb; - memset(&bb, 0, sizeof(struct blob_buf)); + memset(&bb, 0, sizeof(bb)); blob_buf_init(&bb, 0); bb = json_to_blob(parsed_response, bb); ubus_send_reply(ctx, req, bb.head); diff --git a/dongle_infrastructure.c b/dongle_infrastructure.c index 9cb71c0..71d0c53 100644 --- a/dongle_infrastructure.c +++ b/dongle_infrastructure.c @@ -443,7 +443,7 @@ int print_list(struct ubus_context *ctx, struct ubus_object *obj, void *arr, *table; int rv; - memset(&bb, 0, sizeof(struct blob_buf)); + memset(&bb, 0, sizeof(bb)); rv = blob_buf_init(&bb, 0); if (rv != 0) goto fail; diff --git a/libmobile_hilink.c b/libmobile_hilink.c index c4a7499..c29480b 100644 --- a/libmobile_hilink.c +++ b/libmobile_hilink.c @@ -18,7 +18,7 @@ char *parser(char *data, char *keyword) char *session_token; char *ptr = NULL; - session_token = (char *)calloc(1024, sizeof(char)); + session_token = (char *)calloc(1024, sizeof(*session_token)); if (!session_token) goto leave_token; @@ -64,11 +64,11 @@ static size_t write_response(void *ptr, size_t size, size_t nmemb, void *stream) struct write_result *memalloc_write_result(void) { - struct write_result *wr = (struct write_result *) calloc(1, sizeof(struct write_result)); + struct write_result *wr = (struct write_result *) calloc(1, sizeof(*wr)); if (!wr) goto leave; - wr->data = calloc(BUFFER_SIZE, sizeof(char)); + wr->data = calloc(BUFFER_SIZE, sizeof(wr->data)); if (!wr->data) goto leave; diff --git a/libmobile_zte.c b/libmobile_zte.c index 8ff52cb..1ee559b 100644 --- a/libmobile_zte.c +++ b/libmobile_zte.c @@ -282,7 +282,7 @@ static struct json_object *prepare_request(char *ip_addr, char *query, int optio struct string str = {NULL, 0}; struct json_object *parsed_response; - str.ptr = calloc(1, 1); + str.ptr = (char *)calloc(1, 1); if (!str.ptr) { //debug_print("Error allocating memory with calloc"); goto fail; -- GitLab