clear_helper(): Use a cast to shorten all implementations.
This commit is contained in:
parent
8bf18daabb
commit
3553451f1e
|
@ -59,18 +59,14 @@ static const int32_t trigger_matches[] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
|
||||
ftdi_deinit(&devc->ftdic);
|
||||
}
|
||||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||
|
|
|
@ -43,19 +43,15 @@ static const int32_t trigger_matches[] = {
|
|||
SR_TRIGGER_FALLING,
|
||||
};
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
|
||||
ftdi_free(devc->ftdic);
|
||||
g_free(devc->final_buf);
|
||||
}
|
||||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static int add_device(int model, struct libusb_device_descriptor *des,
|
||||
|
|
|
@ -180,14 +180,11 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
return std_scan_complete(di, g_slist_append(NULL, sdi));
|
||||
}
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
GHashTableIter iter;
|
||||
void *value;
|
||||
|
||||
devc = priv;
|
||||
|
||||
/* Analog generators. */
|
||||
g_hash_table_iter_init(&iter, devc->ch_ag);
|
||||
while (g_hash_table_iter_next(&iter, NULL, &value))
|
||||
|
@ -197,7 +194,7 @@ static void clear_helper(void *priv)
|
|||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
|
|
|
@ -240,17 +240,14 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
return std_scan_complete(di, devices);
|
||||
}
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
g_free(devc->data_buf);
|
||||
}
|
||||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
|
|
|
@ -345,17 +345,14 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
return std_scan_complete(di, devices);
|
||||
}
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
g_slist_free(devc->enabled_analog_channels);
|
||||
}
|
||||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
|
|
|
@ -110,21 +110,16 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
return sr_scpi_scan(di->context, options, hmo_probe_serial_device);
|
||||
}
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
|
||||
hmo_scope_state_free(devc->model_state);
|
||||
|
||||
g_free(devc->analog_groups);
|
||||
g_free(devc->digital_groups);
|
||||
}
|
||||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
|
|
|
@ -156,17 +156,14 @@ static int configure_channels(const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
g_slist_free(devc->enabled_channels);
|
||||
}
|
||||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||
|
|
|
@ -232,18 +232,15 @@ static int configure_channels(const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
g_free(devc->triggersource);
|
||||
g_slist_free(devc->enabled_channels);
|
||||
}
|
||||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||
|
|
|
@ -218,10 +218,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
return std_scan_complete(di, devices);
|
||||
}
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc = priv;
|
||||
|
||||
g_slist_free(devc->enabled_channel);
|
||||
}
|
||||
|
||||
|
@ -238,7 +236,7 @@ static int dev_clear(const struct sr_dev_driver *di)
|
|||
}
|
||||
}
|
||||
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
|
|
|
@ -152,19 +152,15 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
return std_scan_complete(di, devices);
|
||||
}
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
|
||||
libusb_free_transfer(devc->xfer_in);
|
||||
libusb_free_transfer(devc->xfer_out);
|
||||
}
|
||||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
|
|
|
@ -43,12 +43,8 @@ static const char *channel_names[] = {
|
|||
/* Note: The IKALOGIC ScanaPLUS always samples at 100MHz. */
|
||||
static const uint64_t samplerates[1] = { SR_MHZ(100) };
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
|
||||
ftdi_free(devc->ftdic);
|
||||
g_free(devc->compressed_buf);
|
||||
g_free(devc->sample_buf);
|
||||
|
@ -56,7 +52,7 @@ static void clear_helper(void *priv)
|
|||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||
|
|
|
@ -115,20 +115,15 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
return sr_scpi_scan(di->context, options, probe_serial_device);
|
||||
}
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
|
||||
lecroy_xstream_state_free(devc->model_state);
|
||||
|
||||
g_free(devc->analog_groups);
|
||||
}
|
||||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
|
|
|
@ -189,19 +189,15 @@ err_free_ftdi_buf:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
|
||||
ftdi_free(devc->ftdic);
|
||||
g_free(devc->ftdi_buf);
|
||||
}
|
||||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
|
|
|
@ -275,12 +275,10 @@ static const struct rigol_ds_model supported_models[] = {
|
|||
|
||||
static struct sr_dev_driver rigol_ds_driver_info;
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
unsigned int i;
|
||||
|
||||
devc = priv;
|
||||
g_free(devc->data);
|
||||
g_free(devc->buffer);
|
||||
for (i = 0; i < ARRAY_SIZE(devc->coupling); i++)
|
||||
|
@ -292,7 +290,7 @@ static void clear_helper(void *priv)
|
|||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
|
||||
|
|
|
@ -288,18 +288,15 @@ static int dev_close(struct sr_dev_inst *sdi)
|
|||
return sr_scpi_close(scpi);
|
||||
}
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
g_free(devc->channels);
|
||||
g_free(devc->channel_groups);
|
||||
}
|
||||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
|
|
|
@ -121,21 +121,16 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
return sr_scpi_scan(di->context, options, probe_usbtmc_device);
|
||||
}
|
||||
|
||||
static void clear_helper(void *priv)
|
||||
static void clear_helper(struct dev_context *devc)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = priv;
|
||||
|
||||
dlm_scope_state_destroy(devc->model_state);
|
||||
|
||||
g_free(devc->analog_groups);
|
||||
g_free(devc->digital_groups);
|
||||
}
|
||||
|
||||
static int dev_clear(const struct sr_dev_driver *di)
|
||||
{
|
||||
return std_dev_clear_with_callback(di, clear_helper);
|
||||
return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
|
||||
}
|
||||
|
||||
static int dev_open(struct sr_dev_inst *sdi)
|
||||
|
|
Loading…
Reference in New Issue