]> sigrok.org Git - libsigrok.git/commitdiff
Add small helper for creating struct sr_config
authorBert Vermeulen <redacted>
Sun, 20 Jan 2013 15:34:38 +0000 (16:34 +0100)
committerBert Vermeulen <redacted>
Mon, 21 Jan 2013 22:32:49 +0000 (23:32 +0100)
hwdriver.c
libsigrok-internal.h

index 2c640ade7ac964f9e02e36ebc5030ddf80484d3f..65a6fea4a3d58d790ac3c2516dd8a71fa863a787 100644 (file)
@@ -285,6 +285,18 @@ SR_PRIV void sr_hw_cleanup_all(void)
        }
 }
 
+SR_PRIV struct sr_config *sr_config_make(int key, const void *value)
+{
+       struct sr_config *src;
+
+       if (!(src = g_try_malloc(sizeof(struct sr_config))))
+               return NULL;
+       src->key = key;
+       src->value = value;
+
+       return src;
+}
+
 /**
  * Returns information about the given driver or device instance.
  *
index ea77b90875e7020aeffebbfc3e6b95b7ca7e835f..59709e63d195fb6ed8879371c37e299d19e0a787 100644 (file)
@@ -113,6 +113,7 @@ SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial);
 /*--- hwdriver.c ------------------------------------------------------------*/
 
 SR_PRIV void sr_hw_cleanup_all(void);
+SR_PRIV struct sr_config *sr_config_make(int key, const void *value);
 SR_PRIV int sr_source_remove(int fd);
 SR_PRIV int sr_source_add(int fd, int events, int timeout,
                          sr_receive_data_callback_t cb, void *cb_data);