We perfer the coding style like: /* some stuff */ if (error) { /* error handling */ return -(errorcode); } /* normal actions */ do_something()
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -72,17 +72,16 @@ static av_cold int init(AVFilterContext *context) · 71 unmodified lines | ||
| 72 | 72 | av_log(context, AV_LOG_ERROR, "could not create DNN module for requested backend\n"); |
| 73 | 73 | return AVERROR(ENOMEM); |
| 74 | 74 | } |
| 75 | + | |
| 75 | 76 | if (!sr_context->model_filename){ |
| 76 | 77 | av_log(context, AV_LOG_ERROR, "model file for network was not specified\n"); |
| 77 | 78 | return AVERROR(EIO); |
| 78 | − } else { | |
| 79 | − if (!sr_context->dnn_module->load_model) { | |
| 80 | − av_log(context, AV_LOG_ERROR, "load_model for network was not specified\n"); | |
| 81 | − return AVERROR(EIO); | |
| 82 | − } else { | |
| 83 | − sr_context->model = (sr_context->dnn_module->load_model)(sr_context->model_filename); | |
| 84 | − } | |
| 85 | 79 | } |
| 80 | + if (!sr_context->dnn_module->load_model) { | |
| 81 | + av_log(context, AV_LOG_ERROR, "load_model for network was not specified\n"); | |
| 82 | + return AVERROR(EIO); | |
| 83 | + } | |
| 84 | + sr_context->model = (sr_context->dnn_module->load_model)(sr_context->model_filename); | |
| 86 | 85 | if (!sr_context->model){ |
| 87 | 86 | av_log(context, AV_LOG_ERROR, "could not load DNN model\n"); |
| 88 | 87 | return AVERROR(EIO); |