]> sigrok.org Git - libsigrok.git/commitdiff
Eliminate sr_dev_inst_new().
authorUwe Hermann <redacted>
Fri, 21 Nov 2014 01:01:36 +0000 (02:01 +0100)
committerUwe Hermann <redacted>
Fri, 21 Nov 2014 01:01:36 +0000 (02:01 +0100)
52 files changed:
src/device.c
src/hardware/agilent-dmm/api.c
src/hardware/appa-55ii/api.c
src/hardware/asix-sigma/asix-sigma.c
src/hardware/atten-pps3xxx/api.c
src/hardware/beaglelogic/api.c
src/hardware/brymen-bm86x/api.c
src/hardware/brymen-dmm/api.c
src/hardware/cem-dt-885x/api.c
src/hardware/center-3xx/api.c
src/hardware/chronovu-la/api.c
src/hardware/colead-slm/api.c
src/hardware/conrad-digi-35-cpu/api.c
src/hardware/demo/demo.c
src/hardware/fluke-dmm/api.c
src/hardware/fx2lafw/api.c
src/hardware/gmc-mh-1x-2x/api.c
src/hardware/hameg-hmo/api.c
src/hardware/hantek-dso/api.c
src/hardware/ikalogic-scanalogic2/api.c
src/hardware/ikalogic-scanaplus/api.c
src/hardware/kecheng-kc-330b/api.c
src/hardware/lascar-el-usb/protocol.c
src/hardware/link-mso19/api.c
src/hardware/manson-hcs-3xxx/api.c
src/hardware/mic-985xx/api.c
src/hardware/motech-lps-30x/api.c
src/hardware/norma-dmm/api.c
src/hardware/openbench-logic-sniffer/api.c
src/hardware/openbench-logic-sniffer/protocol.c
src/hardware/pipistrello-ols/protocol.c
src/hardware/rigol-ds/api.c
src/hardware/saleae-logic16/api.c
src/hardware/scpi-pps/api.c
src/hardware/serial-dmm/api.c
src/hardware/sysclk-lwla/api.c
src/hardware/teleinfo/api.c
src/hardware/testo/api.c
src/hardware/tondaj-sl-814/api.c
src/hardware/uni-t-dmm/api.c
src/hardware/uni-t-ut32x/api.c
src/hardware/victor-dmm/api.c
src/hardware/yokogawa-dlm/api.c
src/hardware/zeroplus-logic-cube/api.c
src/input/binary.c
src/input/chronovu_la8.c
src/input/csv.c
src/input/vcd.c
src/input/wav.c
src/lcr/es51919.c
src/libsigrok-internal.h
src/session_file.c

index a45bd9826e4dd01820c0c0e6760a9978bf96b369..8367ec28c40b9ab67312c762843fb4665dade92a 100644 (file)
@@ -201,44 +201,23 @@ SR_API gboolean sr_dev_has_option(const struct sr_dev_inst *sdi, int key)
        return ret;
 }
 
-/** @private
- *  Allocate and init a new device instance struct.
- *
- *  @retval struct sr_dev_inst *. Dynamically allocated, free using
- *              sr_dev_inst_free().
- */
-SR_PRIV struct sr_dev_inst *sr_dev_inst_new(void)
-{
-       struct sr_dev_inst *sdi;
-
-       sdi = g_malloc0(sizeof(struct sr_dev_inst));
-
-       sdi->driver = NULL;
-       sdi->status = -1;
-       sdi->inst_type = -1;
-       sdi->vendor = NULL;
-       sdi->model = NULL;
-       sdi->version = NULL;
-       sdi->serial_num = NULL;
-       sdi->connection_id = NULL;
-       sdi->channels = NULL;
-       sdi->channel_groups = NULL;
-       sdi->session = NULL;
-       sdi->conn = NULL;
-       sdi->priv = NULL;
-
-       return sdi;
-}
-
 /**
  * Allocate and init a new user-generated device instance.
+ *
+ * @param vendor Device vendor
+ * @param model Device model
+ * @param version Device version
+ *
+ * @retval struct sr_dev_inst *. Dynamically allocated, free using
+ *         sr_dev_inst_free().
  */
 SR_API struct sr_dev_inst *sr_dev_inst_user_new(const char *vendor,
                const char *model, const char *version)
 {
        struct sr_dev_inst *sdi;
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
+
        sdi->vendor = g_strdup(vendor);
        sdi->model = g_strdup(model);
        sdi->version = g_strdup(version);
index edae4bd4abc01d6535490d1a5619f495683b76ca..e8767a61ae7c2c2451ec1ae9c7aff999121492c5 100644 (file)
@@ -139,7 +139,7 @@ static GSList *scan(GSList *options)
                for (i = 0; supported_agdmm[i].model; i++) {
                        if (strcmp(supported_agdmm[i].modelname, tokens[1]))
                                continue;
-                       sdi = sr_dev_inst_new();
+                       sdi = g_malloc0(sizeof(struct sr_dev_inst));
                        sdi->status = SR_ST_INACTIVE;
                        sdi->vendor = g_strdup("Agilent");
                        sdi->model = g_strdup(tokens[1]);
index a8c8a841adff89bb18779dafa8b43cb27ca545f8..6598757b67d8a6b23ec24f6c5f5f9d34a958255d 100644 (file)
@@ -99,7 +99,7 @@ static GSList *scan(GSList *options)
 
        sr_info("Found device on port %s.", conn);
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup("APPA");
        sdi->model = g_strdup("55II");
index cad6b989343c89106766def9fba8198e5eecf0ad..53e35816374614babce2568978c7e844750b3303 100644 (file)
@@ -380,7 +380,7 @@ static GSList *scan(GSList *options)
        devc->use_triggers = 0;
 
        /* Register SIGMA device. */
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INITIALIZING;
        sdi->vendor = g_strdup(USB_VENDOR_NAME);
        sdi->model = g_strdup(USB_MODEL_NAME);
index b42036bfbd147182057226560385420419ba59cc..580bc51d4632edb4e947a9033530d4e3729a290c 100644 (file)
@@ -164,7 +164,7 @@ static GSList *scan(GSList *options, int modelid)
                return NULL;
        }
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup("Atten");
        sdi->model = g_strdup(model->name);
index 910bb843b5919addb45d8bed5704a1f60b8d90d9..9a39e1de9487ec735f82231f5e25bf7866725eb0 100644 (file)
@@ -97,7 +97,7 @@ static GSList *scan(GSList *options)
        if (!g_file_test(BEAGLELOGIC_DEV_NODE, G_FILE_TEST_EXISTS))
                return NULL;
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->model = g_strdup("BeagleLogic");
        sdi->version = g_strdup("1.0");
index c38665c1d8c678aa56da697447cec60fed525860..38c130d290a44e1eebf5dd26364e06debbf89b81 100644 (file)
@@ -73,7 +73,7 @@ static GSList *scan(GSList *options)
        for (l = usb_devices; l; l = l->next) {
                usb = l->data;
 
-               sdi = sr_dev_inst_new();
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                sdi->status = SR_ST_INACTIVE;
                sdi->vendor = g_strdup("Brymen");
                sdi->model = g_strdup("BM869");
index 210d7e617f21e6f16ce36c05417dae3e66696a4a..937135c6c1b77657ec7125beb785105aae519f39 100644 (file)
@@ -75,7 +75,7 @@ static GSList *brymen_scan(const char *conn, const char *serialcomm)
 
        sr_info("Found device on port %s.", conn);
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup("Brymen");
        sdi->model = g_strdup("BM85x");
index 8d5425424cffb760db00354ba1549f47a030a806..c8ca2b8f7a648b9003aa1eb9aee05052a6961ae2 100644 (file)
@@ -109,7 +109,7 @@ static GSList *scan(GSList *options)
        while (g_get_monotonic_time() - start < MAX_SCAN_TIME) {
                if (serial_read_nonblocking(serial, &c, 1) == 1 && c == 0xa5) {
                        /* Found one. */
-                       sdi = sr_dev_inst_new();
+                       sdi = g_malloc0(sizeof(struct sr_dev_inst));
                        sdi->status = SR_ST_INACTIVE;
                        sdi->vendor = g_strdup("CEM");
                        sdi->model = g_strdup("DT-885x");
index d5801ce907c65e3b8cd2cf59bbf8895cfeb556ba..13831c05a9af4b7b90e4771a31e2587e5bd78d61 100644 (file)
@@ -88,7 +88,7 @@ static GSList *center_scan(const char *conn, const char *serialcomm, int idx)
 
        sr_info("Found device on port %s.", conn);
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup(center_devs[idx].vendor);
        sdi->model = g_strdup(center_devs[idx].device);
index 3dc0598ec30aba688b00c712012dff6c3cb31029..b31db039b0f18420e8336349572f22096f41e652 100644 (file)
@@ -120,7 +120,7 @@ static int add_device(int idx, int model, GSList **devices)
        devc->cur_samplerate = devc->prof->max_samplerate;
 
        /* Register the device with libsigrok. */
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INITIALIZING;
        sdi->vendor = g_strdup("ChronoVu");
        sdi->model = g_strdup(devc->prof->modelname);
index fa94119680032c1c6430c600c058d0c2c3cee75a..e879a102189c19ad4f7c8df2091c34c27514d3ff 100644 (file)
@@ -82,7 +82,7 @@ static GSList *scan(GSList *options)
        if (!serialcomm)
                serialcomm = SERIALCOMM;
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup("Colead");
        sdi->model = g_strdup("SL-5868P");
index 8a9650ecc8def2841af255f802906bc7bf21055d..850e29b04c9165733dfca37dcbd075de6afcd8e1 100644 (file)
@@ -94,7 +94,7 @@ static GSList *scan(GSList *options)
 
        sr_spew("Conrad DIGI 35 CPU assumed at %s.", conn);
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_ACTIVE;
        sdi->vendor = g_strdup("Conrad");
        sdi->model = g_strdup("DIGI 35 CPU");
index 3d109c95198599685c50942984a114c8d53bb93d..c93542efeebbf87904339c25933e8d4dadfcc12d 100644 (file)
@@ -290,7 +290,7 @@ static GSList *scan(GSList *options)
 
        devices = NULL;
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_ACTIVE;
        sdi->model = g_strdup("Demo device");
        sdi->driver = di;
index b7638fa2b18b6f355590489dcefcf2cd978fc755..a2208049094648aa5146aacf2d6e5ec0023c9377 100644 (file)
@@ -122,7 +122,7 @@ static GSList *fluke_scan(const char *conn, const char *serialcomm)
                                        continue;
                                /* Skip leading spaces in version number. */
                                for (s = 0; tokens[1][s] == ' '; s++);
-                               sdi = sr_dev_inst_new();
+                               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                                sdi->status = SR_ST_INACTIVE;
                                sdi->vendor = g_strdup("Fluke");
                                sdi->model = g_strdup(tokens[0] + 6);
index 38ca70ff0dd755067985d9fd782178870cee0a5a..64d3bfea574fc4a40129a2866acdd211f0b81565 100644 (file)
@@ -241,7 +241,7 @@ static GSList *scan(GSList *options)
                if (!prof)
                        continue;
 
-               sdi = sr_dev_inst_new();
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                sdi->status = SR_ST_INITIALIZING;
                sdi->vendor = g_strdup(prof->vendor);
                sdi->model = g_strdup(prof->model);
index 464fe5029bec61c76f8912cf979dc12b6f24bfe7..32a471afe4e3cdf10a2acce95ab77ec45b41678f 100644 (file)
@@ -223,7 +223,7 @@ static GSList *scan_1x_2x_rs232(GSList *options)
 
        if (model != METRAHIT_NONE) {
                sr_spew("%s %s detected!", VENDOR_GMC, gmc_model_str(model));
-               sdi = sr_dev_inst_new();
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                sdi->status = SR_ST_INACTIVE;
                sdi->vendor = g_strdup(VENDOR_GMC);
                sdi->model = g_strdup(gmc_model_str(model));
@@ -304,7 +304,7 @@ static GSList *scan_2x_bd232(GSList *options)
                goto exit_err;
        }
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup(VENDOR_GMC);
        sdi->priv = devc;
@@ -355,7 +355,7 @@ static GSList *scan_2x_bd232(GSList *options)
                                goto exit_err;
                        }
 
-                       sdi = sr_dev_inst_new();
+                       sdi = g_malloc0(sizeof(struct sr_dev_inst));
                        sdi->status = SR_ST_INACTIVE;
                        sdi->vendor = g_strdup(VENDOR_GMC);
                }
index b516b2d8f08fd999298cf078913b4f7c4397ef84..d8a0f902ca26a0c53bb53ff4507ced775ec85e8e 100644 (file)
@@ -79,7 +79,7 @@ static struct sr_dev_inst *hmo_probe_serial_device(struct sr_scpi_dev_inst *scpi
        if (check_manufacturer(hw_info->manufacturer) != SR_OK)
                goto fail;
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_ACTIVE;
        sdi->vendor = g_strdup(hw_info->manufacturer);
        sdi->model = g_strdup(hw_info->model);
index 7bf0c5293b7927d0b042ba617316e0ba97c47c3d..efd36853dfc36ea7a1058e9aad31cba810018ff1 100644 (file)
@@ -172,7 +172,7 @@ static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof)
        struct dev_context *devc;
        int i;
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INITIALIZING;
        sdi->vendor = g_strdup(prof->vendor);
        sdi->model = g_strdup(prof->model);
index d459210f12a0cfcfbc7682d7c6ec2a68e9b7691e..380443c48304091d3d07ad4ed3cfcf8c8e8e8ac2 100644 (file)
@@ -112,7 +112,7 @@ static GSList *scan(GSList *options)
                        continue;
                }
 
-               sdi = sr_dev_inst_new();
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                sdi->status = SR_ST_INACTIVE;
                sdi->vendor = g_strdup(VENDOR_NAME);
                sdi->model = g_strdup(MODEL_NAME);
index 5075364624946c4d48563f5c6e6f2b16f540614d..d8165c7d855a33718d3d8ce676151f6c245eb9cc 100644 (file)
@@ -123,7 +123,7 @@ static GSList *scan(GSList *options)
        }
 
        /* Register the device with libsigrok. */
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INITIALIZING;
        sdi->vendor = g_strdup(USB_VENDOR_NAME);
        sdi->model = g_strdup(USB_MODEL_NAME);
index 721ceda12937045c100794fce79147d88d118210..1e5480ac0581c35b3f47b33f54ccadb85f944717 100644 (file)
@@ -129,7 +129,7 @@ static GSList *scan(GSList *options)
                for (l = usb_devices; l; l = l->next) {
                        if (scan_kecheng(l->data, &model) != SR_OK)
                                continue;
-                       sdi = sr_dev_inst_new();
+                       sdi = g_malloc0(sizeof(struct sr_dev_inst));
                        sdi->status = SR_ST_INACTIVE;
                        sdi->vendor = g_strdup(VENDOR);
                        sdi->model = model; /* Already g_strndup()'d. */
index ab5b6734426539b8eec698f3509b08c68aae5754..49ed649b2707f463260db29b23077902e250043e 100644 (file)
@@ -323,7 +323,7 @@ static struct sr_dev_inst *lascar_identify(unsigned char *config)
                        return NULL;
                }
 
-               sdi = sr_dev_inst_new();
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                sdi->status = SR_ST_INACTIVE;
                sdi->vendor = g_strdup(LASCAR_VENDOR);
                sdi->model = g_strdup(profile->modelname);
index 29a5952ac03587a153fa9cfa9ce15b1596984b2d..c1162c982207f2c9f01317edc8b08a8563f343e9 100644 (file)
@@ -203,8 +203,11 @@ static GSList *scan(GSList *options)
                        return devices;
                }
 
-               struct sr_dev_inst *sdi = sr_dev_inst_new(SR_ST_INACTIVE,
-                                               manufacturer, product, hwrev);
+               struct sr_dev_inst *sdi = g_malloc0(sizeof(struct sr_dev_inst));
+               sdi->status = SR_ST_INACTIVE;
+               sdi->vendor = g_strdup(manufacturer);
+               sdi->model = g_strdup(product);
+               sdi->version = g_strdup(hwrev);
 
                if (!sdi) {
                        sr_err("Unable to create device instance for %s",
index b04ab16f9974e9bfdf629c5adaacb49f2575b29a..d287067b195db92b1745274d5368859b91199c19 100644 (file)
@@ -155,7 +155,7 @@ static GSList *scan(GSList *options)
        }
 
        /* Init device instance, etc. */
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup("Manson");
        sdi->model = g_strdup(models[model_id].name);
index d2ce842b07d39b9f88e984ba9e62e0f4207bb15a..ae48fb6e1122c4fbace3b5cfe44b0e36ae640980 100644 (file)
@@ -91,7 +91,7 @@ static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)
        sr_info("Found device on port %s.", conn);
 
        /* TODO: Fill in version from protocol response. */
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup(mic_devs[idx].vendor);
        sdi->model = g_strdup(mic_devs[idx].device);
index c2abb1fe8208fb07b92a46332abf69968c623b29..9c01ea455077ac8041a75909bba6c59d1e0b846e 100644 (file)
@@ -450,7 +450,7 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o
                Therefore just print an error message, but do not exit with error. */
                sr_err("Failed to query for hardware version: %d %s", errno, strerror(errno));
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup(VENDOR_MOTECH);
        sdi->model = g_strdup(models[modelid].modelstr);
index ab9b36e292d047feb3713e1658c7dcae8ee96c0b..2f56441af5f11da231141051bc75be152f7db17d 100644 (file)
@@ -144,7 +144,7 @@ static GSList *do_scan(struct sr_dev_driver* drv, GSList *options)
                        auxtype = xgittoint(buf[7]);
                        sr_spew("%s %s DMM %s detected!", get_brandstr(drv), get_typestr(auxtype, drv), buf + 9);
 
-                       sdi = sr_dev_inst_new();
+                       sdi = g_malloc0(sizeof(struct sr_dev_inst));
                        sdi->status = SR_ST_INACTIVE;
                        sdi->vendor = g_strdup(get_brandstr(drv));
                        sdi->model = g_strdup(get_typestr(auxtype, drv));
index f5a6647108fb9103e111864359db8b7a5581cb3a..02cc02b52a53762bd8a8f812f23b00b46ab02276 100644 (file)
@@ -180,7 +180,7 @@ static GSList *scan(GSList *options)
        } else {
                /* Not an OLS -- some other board that uses the sump protocol. */
                sr_info("Device does not support metadata.");
-               sdi = sr_dev_inst_new();
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                sdi->status = SR_ST_INACTIVE;
                sdi->vendor = g_strdup("Sump");
                sdi->model = g_strdup("Logic Analyzer");
index c2b66615e5156781163d9ca02de723d11a018598..c998c29524e1ce8b2c6b8014c42f1de09641121a 100644 (file)
@@ -152,7 +152,7 @@ SR_PRIV struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial)
        GString *tmp_str, *devname, *version;
        guchar tmp_c;
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->driver = di;
        devc = ols_dev_new();
index 81bbe8e647fe02e09f9b45716e1a0896adcd8c7f..7eddec0dac456adf43c589dc538403389203731e 100644 (file)
@@ -226,7 +226,7 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str
        guchar tmp_c;
        int index, i;
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->driver = di;
        sdi->priv = devc;
index 763276626111dec61126018424e8792fd0634755..e17739971c136890dae416f61b61209353bb61b7 100644 (file)
@@ -296,7 +296,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
                return NULL;
        }
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_ACTIVE;
        sdi->vendor = g_strdup(model->series->vendor->name);
        sdi->model = g_strdup(model->name);
index f151fbd9243df42443c815052ab221a934b47841..c3aaacc52c0a83250848697b30298fa3cde1eabf 100644 (file)
@@ -198,7 +198,7 @@ static GSList *scan(GSList *options)
                if (des.idVendor != LOGIC16_VID || des.idProduct != LOGIC16_PID)
                        continue;
 
-               sdi = sr_dev_inst_new();
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                sdi->status = SR_ST_INITIALIZING;
                sdi->vendor = g_strdup("Saleae");
                sdi->model = g_strdup("Logic16");
index 2a7c80cc67b91f201d366d574182dac73f981c48..c8070a063335538109aaa278ae96f4a112e9e7ae 100644 (file)
@@ -89,7 +89,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
                return NULL;
        }
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_ACTIVE;
        sdi->vendor = g_strdup(vendor);
        sdi->model = g_strdup(hw_info->model);
index 87e63b10f4f07b6413c056ebdd0e60d4632992ce..2b300d4bd9e6add08c35f24f9bbe905800e0e5e8 100644 (file)
@@ -456,7 +456,7 @@ static GSList *sdmm_scan(const char *conn, const char *serialcomm, int dmm)
 
        sr_info("Found device on port %s.", conn);
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup(dmms[dmm].vendor);
        sdi->model = g_strdup(dmms[dmm].device);
index f2fc191600c5a8c4af7706c24545b871d4953052..90d7897dda3dee2f025c07119be0261cea688a39 100644 (file)
@@ -112,7 +112,7 @@ static struct sr_dev_inst *dev_inst_new(void)
        }
 
        /* Register the device with libsigrok. */
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup(VENDOR_NAME);
        sdi->model = g_strdup(MODEL_NAME);
index 3e6a4d4521fff4e9656e5cd1128a0bf0ab3cd408..0f099c210411d8fdf55d380d3b8be6329e4823fa 100644 (file)
@@ -92,7 +92,7 @@ static GSList *scan(GSList *options)
 
        sr_info("Found device on port %s.", conn);
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup("EDF");
        sdi->model = g_strdup("Teleinfo");
index 6f0e4e1a7adbd317a704c5e1a7519e2138be0227..58a5159f28d0d295eac42c6ef97117b200789c05 100644 (file)
@@ -124,7 +124,7 @@ static GSList *scan(GSList *options)
                if (strcmp(product, "testo 435/635/735"))
                        continue;
 
-               sdi = sr_dev_inst_new();
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                sdi->status = SR_ST_INACTIVE;
                sdi->vendor = g_strdup("Testo");
                sdi->model = g_strdup("435/635/735");
index d725ec355b5ea17452a91c91fb7df94ca3381908..69aa30e90eb6e2bbcc0f8d65d36d5894a20efffe 100644 (file)
@@ -84,7 +84,7 @@ static GSList *scan(GSList *options)
        if (!serialcomm)
                serialcomm = SERIALCOMM;
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup("Tondaj");
        sdi->model = g_strdup("SL-814");
index 35ceaaed4a12c5bc64535037911edd99c2199dea..cf9185109d0ca53f4449cd6fce075c37ecc7e0a6 100644 (file)
@@ -260,7 +260,7 @@ static GSList *scan(GSList *options, int dmm)
 
                devc->first_run = TRUE;
 
-               sdi = sr_dev_inst_new();
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                sdi->status = SR_ST_INACTIVE;
                sdi->vendor = g_strdup(udmms[dmm].vendor);
                sdi->model = g_strdup(udmms[dmm].device);
index a50d4a4fcdcb64a09c4d098b83e46fa6d98d0d67..95096c0b60d8e0c8c776ef8e79037c0afbd0f444 100644 (file)
@@ -79,7 +79,7 @@ static GSList *scan(GSList *options)
                /* We have a list of sr_usb_dev_inst matching the connection
                 * string. Wrap them in sr_dev_inst and we're done. */
                for (l = usb_devices; l; l = l->next) {
-                       sdi = sr_dev_inst_new();
+                       sdi = g_malloc0(sizeof(struct sr_dev_inst));
                        sdi->status = SR_ST_INACTIVE;
                        sdi->vendor = g_strdup(VENDOR);
                        sdi->model = g_strdup(MODEL);
index 9fb508371939abc0a2609c05ff177c14e3355d14..65e73d8ac903a54a6b5a1bbadd69a31cb976b796 100644 (file)
@@ -84,7 +84,7 @@ static GSList *scan(GSList *options)
 
                usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
 
-               sdi = sr_dev_inst_new();
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                sdi->status = SR_ST_INACTIVE;
                sdi->vendor = g_strdup(VICTOR_VENDOR);
                sdi->driver = di;
index 28884de46ad36e6fcfef9c5623f73022e4b7f33f..b4a1305babdd5407ad8db5dbab6bc80d5331c4bb 100644 (file)
@@ -67,7 +67,7 @@ static struct sr_dev_inst *probe_usbtmc_device(struct sr_scpi_dev_inst *scpi)
        if (dlm_model_get(hw_info->model, &model_name, &model_index) != SR_OK)
                goto fail;
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_ACTIVE;
        sdi->vendor = g_strdup(MANUFACTURER_NAME);
        sdi->model = g_strdup(model_name);
index 76ae1e331d1112808d75babe1d2e736485f0824e..b2e7b7f38ce47409bf2ac30bff537d59c6c4480c 100644 (file)
@@ -222,7 +222,7 @@ static GSList *scan(GSList *options)
                sr_info("Found ZEROPLUS %s.", prof->model_name);
 
                /* Register the device with libsigrok. */
-               sdi = sr_dev_inst_new();
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
                sdi->status = SR_ST_INACTIVE;
                sdi->vendor = g_strdup(VENDOR_NAME);
                sdi->model = g_strdup(prof->model_name);
index b3f12d760b899692e4ef0b6424969b618bfabbd3..5d5fc865b2fe1a51228e61d09a87c2d5f0976c30 100644 (file)
@@ -50,7 +50,7 @@ static int init(struct sr_input *in, GHashTable *options)
                return SR_ERR_ARG;
        }
 
-       in->sdi = sr_dev_inst_new();
+       in->sdi = g_malloc0(sizeof(struct sr_dev_inst));
        in->priv = inc = g_malloc0(sizeof(struct context));
 
        inc->samplerate = g_variant_get_uint64(g_hash_table_lookup(options, "samplerate"));
index c1cf4d387991d5d4f311458be5db2bc46787492d..53fcd682cade27bd107449bad91c74a23a1bab6e 100644 (file)
@@ -62,7 +62,7 @@ static int init(struct sr_input *in, GHashTable *options)
                return SR_ERR_ARG;
        }
 
-       in->sdi = sr_dev_inst_new();
+       in->sdi = g_malloc0(sizeof(struct sr_dev_inst));
        in->priv = inc = g_malloc0(sizeof(struct context));
 
        inc->samplerate = g_variant_get_uint64(g_hash_table_lookup(options, "samplerate"));
index b2756fa0aa124453dd266b2373896d2d06b37d21..68ab43b806de03c0dfc7d5be5e9e1bee6e5978a1 100644 (file)
@@ -393,7 +393,7 @@ static int init(struct sr_input *in, GHashTable *options)
        struct context *inc;
        const char *s;
 
-       in->sdi = sr_dev_inst_new();
+       in->sdi = g_malloc0(sizeof(struct sr_dev_inst));
        in->priv = inc = g_malloc0(sizeof(struct context));
 
        inc->single_column = g_variant_get_int32(g_hash_table_lookup(options, "single-column"));
index e6bc05e5a6b18130524f7b8d11d85ece2ca054f1..429dd616a47f13c899b49e17bb4c68a18730ac52 100644 (file)
@@ -429,7 +429,7 @@ static int init(struct sr_input *in, GHashTable *options)
        inc->skip = g_variant_get_int32(g_hash_table_lookup(options, "skip"));
        inc->skip /= inc->downsample;
 
-       in->sdi = sr_dev_inst_new();
+       in->sdi = g_malloc0(sizeof(struct sr_dev_inst));
        in->priv = inc;
 
        for (i = 0; i < num_channels; i++) {
index 8f8a37101200d49488596d7e914d7e8bbd490ad3..647b537cd4883e4ec5e8c748dd708b87b55e15b2 100644 (file)
@@ -150,7 +150,7 @@ static int init(struct sr_input *in, GHashTable *options)
 {
        (void)options;
 
-       in->sdi = sr_dev_inst_new();
+       in->sdi = g_malloc0(sizeof(struct sr_dev_inst));
        in->priv = g_malloc0(sizeof(struct context));
 
        return SR_OK;
index 4cacbe9a134c84d54fb2f4fa46d23e1934a1a6d8..ecfcd0ed7a5a0f703f83a139e3f5420fcf9c2537 100644 (file)
@@ -843,7 +843,7 @@ SR_PRIV struct sr_dev_inst *es51919_serial_scan(GSList *options,
 
        sr_info("Found device on port %s.", serial->port);
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup(vendor);
        sdi->model = g_strdup(model);
index bdbcb09059019bf80d48e10b7d6d2d346ffd038f..e61fb464d4b7bb8ff4e4bfed4185bae0f4ca252a 100644 (file)
@@ -521,7 +521,6 @@ struct sr_dev_inst {
 };
 
 /* Generic device instances */
-SR_PRIV struct sr_dev_inst *sr_dev_inst_new(void);
 SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi);
 
 #ifdef HAVE_LIBUSB_1_0
index 9f8ee75660556dc6cb4b34ca3a23746fed25a945..6433998a202ad3cb11e4aa163767a93e63ea3d9c 100644 (file)
@@ -170,7 +170,7 @@ SR_API int sr_session_load(const char *filename, struct sr_session **session)
                        for (j = 0; keys[j]; j++) {
                                val = g_key_file_get_string(kf, sections[i], keys[j], NULL);
                                if (!strcmp(keys[j], "capturefile")) {
-                                       sdi = sr_dev_inst_new();
+                                       sdi = g_malloc0(sizeof(struct sr_dev_inst));
                                        sdi->driver = &session_driver;
                                        sdi->status = SR_ST_ACTIVE;
                                        if (!session_driver_initialized) {