mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-30 11:24:17 +00:00
avformat/libzmq: Replace fail statements with goto
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
1054b68a62
commit
c07565627b
@ -101,16 +101,13 @@ static int zmq_proto_open(URLContext *h, const char *uri, int flags)
|
||||
s->socket = zmq_socket(s->context, ZMQ_PUB);
|
||||
if (!s->socket) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_socket(): %s\n", ZMQ_STRERROR);
|
||||
zmq_ctx_term(s->context);
|
||||
return AVERROR_EXTERNAL;
|
||||
goto fail_term;
|
||||
}
|
||||
|
||||
ret = zmq_bind(s->socket, uri);
|
||||
if (ret == -1) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_bind(): %s\n", ZMQ_STRERROR);
|
||||
zmq_close(s->socket);
|
||||
zmq_ctx_term(s->context);
|
||||
return AVERROR_EXTERNAL;
|
||||
goto fail_close;
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,27 +116,28 @@ static int zmq_proto_open(URLContext *h, const char *uri, int flags)
|
||||
s->socket = zmq_socket(s->context, ZMQ_SUB);
|
||||
if (!s->socket) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_socket(): %s\n", ZMQ_STRERROR);
|
||||
zmq_ctx_term(s->context);
|
||||
return AVERROR_EXTERNAL;
|
||||
goto fail_term;
|
||||
}
|
||||
|
||||
ret = zmq_setsockopt(s->socket, ZMQ_SUBSCRIBE, "", 0);
|
||||
if (ret == -1) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_setsockopt(): %s\n", ZMQ_STRERROR);
|
||||
zmq_close(s->socket);
|
||||
zmq_ctx_term(s->context);
|
||||
return AVERROR_EXTERNAL;
|
||||
goto fail_close;
|
||||
}
|
||||
|
||||
ret = zmq_connect(s->socket, uri);
|
||||
if (ret == -1) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_connect(): %s\n", ZMQ_STRERROR);
|
||||
zmq_close(s->socket);
|
||||
zmq_ctx_term(s->context);
|
||||
return AVERROR_EXTERNAL;
|
||||
goto fail_close;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
fail_close:
|
||||
zmq_close(s->socket);
|
||||
fail_term:
|
||||
zmq_ctx_term(s->context);
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
static int zmq_proto_write(URLContext *h, const unsigned char *buf, int size)
|
||||
|
Loading…
Reference in New Issue
Block a user