[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 09/48] qobject: replace assert(0) with g_assert_not_reached()
From: |
Pierrick Bouvier |
Subject: |
[PATCH v2 09/48] qobject: replace assert(0) with g_assert_not_reached() |
Date: |
Thu, 12 Sep 2024 00:38:42 -0700 |
This patch is part of a series that moves towards a consistent use of
g_assert_not_reached() rather than an ad hoc mix of different
assertion mechanisms.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qobject/qlit.c | 2 +-
qobject/qnum.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/qobject/qlit.c b/qobject/qlit.c
index be8332136c2..a62865b6423 100644
--- a/qobject/qlit.c
+++ b/qobject/qlit.c
@@ -118,7 +118,7 @@ QObject *qobject_from_qlit(const QLitObject *qlit)
case QTYPE_QBOOL:
return QOBJECT(qbool_from_bool(qlit->value.qbool));
default:
- assert(0);
+ g_assert_not_reached();
}
return NULL;
diff --git a/qobject/qnum.c b/qobject/qnum.c
index 2bbeaedc7b4..2138b563a9f 100644
--- a/qobject/qnum.c
+++ b/qobject/qnum.c
@@ -85,7 +85,7 @@ bool qnum_get_try_int(const QNum *qn, int64_t *val)
return false;
}
- assert(0);
+ g_assert_not_reached();
return false;
}
@@ -123,7 +123,7 @@ bool qnum_get_try_uint(const QNum *qn, uint64_t *val)
return false;
}
- assert(0);
+ g_assert_not_reached();
return false;
}
@@ -156,7 +156,7 @@ double qnum_get_double(QNum *qn)
return qn->u.dbl;
}
- assert(0);
+ g_assert_not_reached();
return 0.0;
}
@@ -172,7 +172,7 @@ char *qnum_to_string(QNum *qn)
return g_strdup_printf("%.17g", qn->u.dbl);
}
- assert(0);
+ g_assert_not_reached();
return NULL;
}
--
2.39.2
- [PATCH v2 00/48] Use g_assert_not_reached instead of (g_)assert(0, false), Pierrick Bouvier, 2024/09/12
- [PATCH v2 02/48] hw/acpi: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 03/48] hw/arm: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 01/48] docs/spin: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 06/48] hw/net: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 05/48] hw/core: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 04/48] hw/char: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 07/48] hw/watchdog: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 09/48] qobject: replace assert(0) with g_assert_not_reached(),
Pierrick Bouvier <=
- [PATCH v2 08/48] migration: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 10/48] system: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 12/48] tests/qtest: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 11/48] target/ppc: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 14/48] include/hw/s390x: replace assert(false) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 13/48] tests/unit: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12
- [PATCH v2 17/48] hw/net: replace assert(false) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/12