]> git.alsa-project.org Git - alsa-lib.git/commitdiff
conf: return count of items in snd_config_is_array()
authorJaroslav Kysela <perex@perex.cz>
Mon, 24 May 2021 07:27:17 +0000 (09:27 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 24 May 2021 07:27:17 +0000 (09:27 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/conf.c

index d66e186df2e910d5ca614123261ba399d43d2422..afa777c0867b66516ca5bd6824333d934765679a 100644 (file)
@@ -1812,9 +1812,10 @@ static int check_array_item(const char *id, int index)
 }
 
 /**
- * \brief Returns if the compound is an array.
+ * \brief Returns if the compound is an array (and count of items).
  * \param config Handle to the configuration node.
- * \return A positive value when true, zero when false, otherwise a negative error code.
+ * \return A count of items in array, zero when the compound is not an array,
+ *         otherwise a negative error code.
  */
 int snd_config_is_array(const snd_config_t *config)
 {
@@ -1832,7 +1833,7 @@ int snd_config_is_array(const snd_config_t *config)
                        return 0;
                idx++;
        }
-       return 1;
+       return idx;
 }
 
 /**