diff mbox

[FFmpeg-devel,V1,3/3] lavf/sr: Refine the coding style for init

Message ID 1559365106-9734-4-git-send-email-mypopydev@gmail.com
State Accepted
Commit 0b7bfa8ad79e483fd81fc006b35c4ef86990d46f
Headers show

Commit Message

Jun Zhao June 1, 2019, 4:58 a.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

We perfer the coding style like:

/* some stuff */
if (error) {
    /* error handling */
    return -(errorcode);
}
/* normal actions */
do_something()

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavfilter/vf_sr.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

Comments

Guo, Yejun June 3, 2019, 3:19 a.m. UTC | #1
> -----Original Message-----

> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf Of

> Jun Zhao

> Sent: Saturday, June 01, 2019 12:58 PM

> To: ffmpeg-devel@ffmpeg.org

> Cc: Jun Zhao <barryjzhao@tencent.com>

> Subject: [FFmpeg-devel] [PATCH V1 3/3] lavf/sr: Refine the coding style for init

> 

> From: Jun Zhao <barryjzhao@tencent.com>

> 

> We perfer the coding style like:

> 

> /* some stuff */

> if (error) {

>     /* error handling */

>     return -(errorcode);

> }

> /* normal actions */

> do_something()

> 

> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>

> ---

>  libavfilter/vf_sr.c |   13 ++++++-------

>  1 files changed, 6 insertions(+), 7 deletions(-)

> 

> diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c

> index 0be572f..0433246 100644

> --- a/libavfilter/vf_sr.c

> +++ b/libavfilter/vf_sr.c

> @@ -72,17 +72,16 @@ static av_cold int init(AVFilterContext *context)

>          av_log(context, AV_LOG_ERROR, "could not create DNN module for

> requested backend\n");

>          return AVERROR(ENOMEM);

>      }

> +

>      if (!sr_context->model_filename){

>          av_log(context, AV_LOG_ERROR, "model file for network was not

> specified\n");

>          return AVERROR(EIO);

> -    } else {

> -        if (!sr_context->dnn_module->load_model) {

> -            av_log(context, AV_LOG_ERROR, "load_model for network was

> not specified\n");

> -            return AVERROR(EIO);

> -        } else {

> -            sr_context->model =

> (sr_context->dnn_module->load_model)(sr_context->model_filename);

> -        }

>      }

> +    if (!sr_context->dnn_module->load_model) {

> +        av_log(context, AV_LOG_ERROR, "load_model for network was not

> specified\n");

> +        return AVERROR(EIO);

> +    }

> +    sr_context->model =

> (sr_context->dnn_module->load_model)(sr_context->model_filename);

>      if (!sr_context->model){

>          av_log(context, AV_LOG_ERROR, "could not load DNN model\n");

>          return AVERROR(EIO);


looks good. :)

> --

> 1.7.1

> 

> _______________________________________________

> ffmpeg-devel mailing list

> ffmpeg-devel@ffmpeg.org

> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

> 

> To unsubscribe, visit link above, or email

> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox

Patch

diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c
index 0be572f..0433246 100644
--- a/libavfilter/vf_sr.c
+++ b/libavfilter/vf_sr.c
@@ -72,17 +72,16 @@  static av_cold int init(AVFilterContext *context)
         av_log(context, AV_LOG_ERROR, "could not create DNN module for requested backend\n");
         return AVERROR(ENOMEM);
     }
+
     if (!sr_context->model_filename){
         av_log(context, AV_LOG_ERROR, "model file for network was not specified\n");
         return AVERROR(EIO);
-    } else {
-        if (!sr_context->dnn_module->load_model) {
-            av_log(context, AV_LOG_ERROR, "load_model for network was not specified\n");
-            return AVERROR(EIO);
-        } else {
-            sr_context->model = (sr_context->dnn_module->load_model)(sr_context->model_filename);
-        }
     }
+    if (!sr_context->dnn_module->load_model) {
+        av_log(context, AV_LOG_ERROR, "load_model for network was not specified\n");
+        return AVERROR(EIO);
+    }
+    sr_context->model = (sr_context->dnn_module->load_model)(sr_context->model_filename);
     if (!sr_context->model){
         av_log(context, AV_LOG_ERROR, "could not load DNN model\n");
         return AVERROR(EIO);