[FFmpeg-devel] [PATCH 09/38] lavu/opt: drop useless handling of NULL return from get_bool_name()

Anton Khirnov anton at khirnov.net
Fri Feb 23 15:58:31 EET 2024


That function always returns an actual string.
---
 libavutil/opt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 49b7da7742..0ffdfc9a1e 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -853,7 +853,7 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
     buf[0] = 0;
     switch (o->type) {
     case AV_OPT_TYPE_BOOL:
-        ret = snprintf(buf, sizeof(buf), "%s", (char *)av_x_if_null(get_bool_name(*(int *)dst), "invalid"));
+        ret = snprintf(buf, sizeof(buf), "%s", get_bool_name(*(int *)dst));
         break;
     case AV_OPT_TYPE_FLAGS:
         ret = snprintf(buf, sizeof(buf), "0x%08X", *(int *)dst);
@@ -1282,7 +1282,7 @@ static void log_default(void *obj, void *av_log_obj, const AVOption *opt)
     av_log(av_log_obj, AV_LOG_INFO, " (default ");
     switch (opt->type) {
     case AV_OPT_TYPE_BOOL:
-        av_log(av_log_obj, AV_LOG_INFO, "%s", (char *)av_x_if_null(get_bool_name(opt->default_val.i64), "invalid"));
+        av_log(av_log_obj, AV_LOG_INFO, "%s", get_bool_name(opt->default_val.i64));
         break;
     case AV_OPT_TYPE_FLAGS: {
         char *def_flags = get_opt_flags_string(obj, opt->unit, opt->default_val.i64);
-- 
2.42.0



More information about the ffmpeg-devel mailing list