]> sigrok.org Git - sigrok-cli.git/blobdiff - decode.c
Drop -S stack option
[sigrok-cli.git] / decode.c
index 09b43f93d3b48c4da38f90505c141ea8823c26a1..f71ead00b3284c58c87d0695ff52ac8e7cefe6d4 100644 (file)
--- a/decode.c
+++ b/decode.c
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "sigrok-cli.h"
-#include "config.h"
+#include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include <glib.h>
+#include "sigrok-cli.h"
 
 #ifdef HAVE_SRD
 static GHashTable *pd_ann_visible = NULL;
@@ -198,8 +198,7 @@ int register_pds(const char *opt_pds, char *opt_pd_annotations)
                g_hash_table_destroy(options);
        if (channels)
                g_hash_table_destroy(channels);
-       if (pd_name)
-               g_free(pd_name);
+       g_free(pd_name);
 
        return ret;
 }
@@ -215,7 +214,6 @@ static void map_pd_inst_channels(void *key, void *value, void *user_data)
        void *channel_target;
        struct sr_channel *ch;
        GHashTableIter iter;
-       int num_channels;
 
        channel_map = value;
        channel_list = user_data;
@@ -246,8 +244,7 @@ static void map_pd_inst_channels(void *key, void *value, void *user_data)
                g_hash_table_insert(channel_indices, g_strdup(channel_id), var);
        }
 
-       num_channels = g_slist_length(channel_list);
-       srd_inst_channel_set_all(di, channel_indices, (num_channels + 7) / 8);
+       srd_inst_channel_set_all(di, channel_indices);
 }
 
 void map_pd_channels(struct sr_dev_inst *sdi)
@@ -264,7 +261,7 @@ void map_pd_channels(struct sr_dev_inst *sdi)
        }
 }
 
-int setup_pd_stack(char *opt_pds, char *opt_pd_stack, char *opt_pd_annotations)
+int setup_pd_stack(char *opt_pds, char *opt_pd_annotations)
 {
        struct srd_decoder_inst *di_from, *di_to;
        int ret, i;
@@ -273,17 +270,6 @@ int setup_pd_stack(char *opt_pds, char *opt_pd_stack, char *opt_pd_annotations)
        /* Set up the protocol decoder stack. */
        pds = g_strsplit(opt_pds, ",", 0);
        if (g_strv_length(pds) > 1) {
-               if (opt_pd_stack) {
-                       /* A stack setup was specified, use that. */
-                       g_strfreev(pds);
-                       pds = g_strsplit(opt_pd_stack, ",", 0);
-                       if (g_strv_length(pds) < 2) {
-                               g_strfreev(pds);
-                               g_critical("Specify at least two protocol decoders to stack.");
-                               return 1;
-                       }
-               }
-
                /* First PD goes at the bottom of the stack. */
                ids = g_strsplit(pds[0], ":", 0);
                if (!(di_from = srd_inst_find_by_id(srd_sess, ids[0]))) {