]> sigrok.org Git - libsigrok.git/blobdiff - src/input/input.c
sr_input_new(): Add missing @param comment.
[libsigrok.git] / src / input / input.c
index 3547d9e1800888cbe62473920b8ba5f19343126d..5292481381404bc3540b289d4dbd5c5f08d607e8 100644 (file)
@@ -210,6 +210,7 @@ SR_API void sr_input_options_free(const struct sr_option **options)
  * This function is used when a client wants to use a specific input
  * module to parse a stream. No effort is made to identify the format.
  *
+ * @param imod The input module to use. Must not be NULL.
  * @param options GHashTable consisting of keys corresponding with
  * the module options \c id field. The values should be GVariant
  * pointers with sunk references, of the same GVariantType as the option's
@@ -271,15 +272,17 @@ SR_API struct sr_input *sr_input_new(const struct sr_input_module *imod,
        if (in->module->init && in->module->init(in, new_opts) != SR_OK) {
                g_free(in);
                in = NULL;
+       } else {
+               in->buf = g_string_sized_new(128);
        }
+
        if (new_opts)
                g_hash_table_destroy(new_opts);
-       in->buf = g_string_sized_new(128);
 
        return in;
 }
 
-/* Returns TRUE is all required meta items are available. */
+/* Returns TRUE if all required meta items are available. */
 static gboolean check_required_metadata(const uint8_t *metadata, uint8_t *avail)
 {
        int m, a;
@@ -364,7 +367,7 @@ SR_API int sr_input_scan_buffer(GString *buf, const struct sr_input **in)
                        /* Module didn't recognize this buffer. */
                        continue;
                } else if (ret != SR_OK) {
-                       /* Can be SR_OK_CONTINUE. */
+                       /* Can be SR_ERR_NA. */
                        return ret;
                }
 
@@ -477,7 +480,7 @@ SR_API int sr_input_scan_file(const char *filename, const struct sr_input **in)
                        /* Module didn't recognize this buffer. */
                        continue;
                } else if (ret != SR_OK) {
-                       /* Can be SR_OK_CONTINUE. */
+                       /* Can be SR_ERR_NA. */
                        return ret;
                }
 
@@ -519,7 +522,7 @@ SR_API struct sr_dev_inst *sr_input_dev_inst_get(const struct sr_input *in)
  * the device instance associated with this input instance, this is
  * guaranteed to return the moment it's ready. This gives the caller
  * the chance to examine the device instance, attach session callbacks
- * and on so.
+ * and so on.
  *
  * @since 0.4.0
  */