options: rename 'error' labels to 'exit' where appropriate

This commit is contained in:
pavelxdd
2017-12-16 02:20:44 +03:00
parent 7fc9ff54d3
commit e1ac0c1eb6

View File

@@ -1748,7 +1748,7 @@ static int parse_color(struct mp_log *log, const m_option_t *opt,
bool is_help = bstr_equals0(param, "help");
if (is_help)
goto error;
goto exit;
bstr val = param;
struct m_color color = {0};
@@ -1756,11 +1756,11 @@ static int parse_color(struct mp_log *log, const m_option_t *opt,
if (bstr_eatstart0(&val, "#")) {
// #[AA]RRGGBB
if (val.len != 6 && val.len != 8)
goto error;
goto exit;
bool has_alpha = val.len == 8;
uint32_t c = bstrtoll(val, &val, 16);
if (val.len)
goto error;
goto exit;
color = (struct m_color) {
(c >> 16) & 0xFF,
(c >> 8) & 0xFF,
@@ -1771,13 +1771,13 @@ static int parse_color(struct mp_log *log, const m_option_t *opt,
bstr comp_str[5];
int num = split_char(param, '/', 5, comp_str);
if (num < 1 || num > 4)
goto error;
goto exit;
double comp[4] = {0, 0, 0, 1};
for (int n = 0; n < num; n++) {
bstr rest;
double d = bstrtod(comp_str[n], &rest);
if (rest.len || !comp_str[n].len || d < 0 || d > 1 || !isfinite(d))
goto error;
goto exit;
comp[n] = d;
}
if (num == 2)
@@ -1793,7 +1793,7 @@ static int parse_color(struct mp_log *log, const m_option_t *opt,
return 1;
error:
exit:
if (!is_help) {
mp_err(log, "Option %.*s: invalid color: '%.*s'\n",
BSTR_P(name), BSTR_P(param));
@@ -1964,18 +1964,18 @@ static int parse_geometry(struct mp_log *log, const m_option_t *opt,
{
bool is_help = bstr_equals0(param, "help");
if (is_help)
goto error;
goto exit;
struct m_geometry gm;
if (!parse_geometry_str(&gm, param))
goto error;
goto exit;
if (dst)
*((struct m_geometry *)dst) = gm;
return 1;
error:
exit:
if (!is_help) {
mp_err(log, "Option %.*s: invalid geometry: '%.*s'\n",
BSTR_P(name), BSTR_P(param));
@@ -1998,21 +1998,21 @@ static int parse_size_box(struct mp_log *log, const m_option_t *opt,
{
bool is_help = bstr_equals0(param, "help");
if (is_help)
goto error;
goto exit;
struct m_geometry gm;
if (!parse_geometry_str(&gm, param))
goto error;
goto exit;
if (gm.xy_valid)
goto error;
goto exit;
if (dst)
*((struct m_geometry *)dst) = gm;
return 1;
error:
exit:
if (!is_help) {
mp_err(log, "Option %.*s: invalid size: '%.*s'\n",
BSTR_P(name), BSTR_P(param));