From: Gerhard Sittig Date: Sat, 25 Feb 2023 15:36:45 +0000 (+0100) Subject: korad-kaxxxxp: address style nits, redundant data type in malloc X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ebe05177463ced7ef160406cbe4b7e17c6df5114;p=libsigrok.git korad-kaxxxxp: address style nits, redundant data type in malloc Rephrase malloc calls, eliminate a redundant yet unnecessary data type duplication. Just get how much space the variable happens to require. --- diff --git a/src/hardware/korad-kaxxxxp/api.c b/src/hardware/korad-kaxxxxp/api.c index d36dc358..8cbd1cce 100644 --- a/src/hardware/korad-kaxxxxp/api.c +++ b/src/hardware/korad-kaxxxxp/api.c @@ -310,7 +310,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sr_dbg("Found: %s %s (idx %zu).", model->vendor, model->name, model - &models[0]); - sdi = g_malloc0(sizeof(struct sr_dev_inst)); + sdi = g_malloc0(sizeof(*sdi)); sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup(model->vendor); sdi->model = g_strdup(model->name); @@ -323,7 +323,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "V"); sr_channel_new(sdi, 1, SR_CHANNEL_ANALOG, TRUE, "I"); - devc = g_malloc0(sizeof(struct dev_context)); + devc = g_malloc0(sizeof(*devc)); sr_sw_limits_init(&devc->limits); g_mutex_init(&devc->rw_mutex); devc->model = model;