int get_type_specifier_list_name(struct ctx *ctx,
struct ctf_node *type_specifier_list, GString *str)
{
- int ret;
+ int ret = 0;
struct ctf_node *iter;
int alias_item_nr = 0;
struct bt_list_head *head =
ret = get_unary_unsigned(&node->u.ctf_expression.right,
(uint64_t *) &id);
- if (ret || id < 0) {
+ /* Only read "id" if get_unary_unsigned() succeeded. */
+ if (ret || (!ret && id < 0)) {
_PERROR("%s", "unexpected unary expression for event declaration's \"id\" attribute");
ret = -EINVAL;
goto error;
ret = get_unary_unsigned(&node->u.ctf_expression.right,
(uint64_t *) stream_id);
- if (ret || *stream_id < 0) {
+ /*
+ * Only read "stream_id" if get_unary_unsigned()
+ * succeeded.
+ */
+ if (ret || (!ret && *stream_id < 0)) {
_PERROR("%s", "unexpected unary expression for event declaration's \"stream_id\" attribute");
ret = -EINVAL;
goto error;
ret = get_unary_unsigned(&node->u.ctf_expression.right,
(uint64_t *) &id);
- if (ret || id < 0) {
+ /* Only read "id" if get_unary_unsigned() succeeded. */
+ if (ret || (!ret && id < 0)) {
_PERROR("%s", "unexpected unary expression for stream declaration's \"id\" attribute");
ret = -EINVAL;
goto error;