[FFmpeg-cvslog] lavu/opt: simplify error handling in get_number()

Anton Khirnov git at videolan.org
Fri Mar 1 18:17:23 EET 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Feb  8 16:04:04 2024 +0100| [1ffa657a0347b7f84dd737b8c91890ad26ac54f5] | committer: Anton Khirnov

lavu/opt: simplify error handling in get_number()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1ffa657a0347b7f84dd737b8c91890ad26ac54f5
---

 libavutil/opt.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 74c191dafa..f9d44b8d52 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -971,16 +971,11 @@ static int get_number(void *obj, const char *name, double *num, int *den, int64_
     void *dst, *target_obj;
     const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
     if (!o || !target_obj)
-        goto error;
+        return AVERROR_OPTION_NOT_FOUND;
 
     dst = ((uint8_t *)target_obj) + o->offset;
 
     return read_number(o, dst, num, den, intnum);
-
-error:
-    *den    =
-    *intnum = 0;
-    return -1;
 }
 
 int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)



More information about the ffmpeg-cvslog mailing list