+static json_t *tr_fspecs_to_json_array(TR_FLINE *fline)
+{
+ json_t *jarray = json_array();
+ json_t *retval = NULL;
+ TR_FLINE_ITER *iter = tr_fline_iter_new(NULL);
+ TR_FSPEC *this_fspec = NULL;
+
+ if ((jarray == NULL) || (iter == NULL))
+ goto cleanup;
+
+ for (this_fspec = tr_fline_iter_first(iter, fline);
+ this_fspec != NULL;
+ this_fspec = tr_fline_iter_next(iter)) {
+ ARRAY_APPEND_OR_FAIL(jarray, tr_fspec_to_json(this_fspec));
+ }
+ /* success */
+ retval = jarray;
+ json_incref(retval);
+
+cleanup:
+ if (jarray)
+ json_decref(jarray);
+ if (iter)
+ tr_fline_iter_free(iter);
+
+ return retval;
+}
+