sr_dev_inst_new(): Use NULL (not "") if version unknown/nonexisting.

Unify the whole code-base to use NULL there, not a mix of "" and NULL.
This commit is contained in:
Uwe Hermann 2014-04-02 18:29:36 +02:00
parent cfe01d0607
commit 55f98c6533
8 changed files with 8 additions and 9 deletions

View File

@ -96,7 +96,7 @@ static GSList *scan(GSList *options)
sr_info("Found device on port %s.", conn); sr_info("Found device on port %s.", conn);
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "APPA", "55II", ""))) if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "APPA", "55II", NULL)))
goto scan_cleanup; goto scan_cleanup;
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {

View File

@ -36,7 +36,6 @@
#define USB_DESCRIPTION "ASIX SIGMA" #define USB_DESCRIPTION "ASIX SIGMA"
#define USB_VENDOR_NAME "ASIX" #define USB_VENDOR_NAME "ASIX"
#define USB_MODEL_NAME "SIGMA" #define USB_MODEL_NAME "SIGMA"
#define USB_MODEL_VERSION ""
#define TRIGGER_TYPE "rf10" #define TRIGGER_TYPE "rf10"
#define NUM_CHANNELS 16 #define NUM_CHANNELS 16
@ -458,7 +457,7 @@ static GSList *scan(GSList *options)
/* Register SIGMA device. */ /* Register SIGMA device. */
if (!(sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING, USB_VENDOR_NAME, if (!(sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING, USB_VENDOR_NAME,
USB_MODEL_NAME, USB_MODEL_VERSION))) { USB_MODEL_NAME, NULL))) {
sr_err("%s: sdi was NULL", __func__); sr_err("%s: sdi was NULL", __func__);
goto free; goto free;
} }

View File

@ -75,7 +75,7 @@ static GSList *brymen_scan(const char *conn, const char *serialcomm)
sr_info("Found device on port %s.", conn); sr_info("Found device on port %s.", conn);
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Brymen", "BM85x", ""))) if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Brymen", "BM85x", NULL)))
goto scan_cleanup; goto scan_cleanup;
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {

View File

@ -95,7 +95,7 @@ static GSList *scan(GSList *options)
sr_spew("Conrad DIGI 35 CPU assumed at %s.", conn); sr_spew("Conrad DIGI 35 CPU assumed at %s.", conn);
if (!(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, "Conrad", "DIGI 35 CPU", ""))) if (!(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, "Conrad", "DIGI 35 CPU", NULL)))
return NULL; return NULL;
sdi->conn = serial; sdi->conn = serial;

View File

@ -224,7 +224,7 @@ static GSList *scan_1x_2x_rs232(GSList *options)
if (model != METRAHIT_NONE) { if (model != METRAHIT_NONE) {
sr_spew("%s %s detected!", VENDOR_GMC, gmc_model_str(model)); sr_spew("%s %s detected!", VENDOR_GMC, gmc_model_str(model));
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, VENDOR_GMC, if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, VENDOR_GMC,
gmc_model_str(model), ""))) gmc_model_str(model), NULL)))
return NULL; return NULL;
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
sr_err("Device context malloc failed."); sr_err("Device context malloc failed.");

View File

@ -87,7 +87,7 @@ static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)
/* TODO: Fill in version from protocol response. */ /* TODO: Fill in version from protocol response. */
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, mic_devs[idx].vendor, if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, mic_devs[idx].vendor,
mic_devs[idx].device, ""))) mic_devs[idx].device, NULL)))
goto scan_cleanup; goto scan_cleanup;
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {

View File

@ -392,7 +392,7 @@ static GSList *sdmm_scan(const char *conn, const char *serialcomm, int dmm)
sr_info("Found device on port %s.", conn); sr_info("Found device on port %s.", conn);
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, dmms[dmm].vendor, if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, dmms[dmm].vendor,
dmms[dmm].device, ""))) dmms[dmm].device, NULL)))
goto scan_cleanup; goto scan_cleanup;
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {

View File

@ -92,7 +92,7 @@ static GSList *scan(GSList *options)
sr_info("Found device on port %s.", conn); sr_info("Found device on port %s.", conn);
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "EDF", "Teleinfo", ""))) if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "EDF", "Teleinfo", NULL)))
goto scan_cleanup; goto scan_cleanup;
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {