# HG changeset patch # User reimar # Date 1390052197 0 # Node ID faf406e385454790bee781ebd86e170aadfa9719 # Parent 0f2c90b69a122e11e480ecef9017ae69490b014f vo_bl: Simplify parser, reduce code duplication. diff -r 0f2c90b69a12 -r faf406e38545 libvo/vo_bl.c --- a/libvo/vo_bl.c Sat Jan 18 13:14:54 2014 +0000 +++ b/libvo/vo_bl.c Sat Jan 18 13:36:37 2014 +0000 @@ -398,7 +398,7 @@ mp_msg(MSGT_VO, MSGL_ERR, "bl: maximum number of files reached (%d)\n", BL_MAX_FILES); return 1; } - p += 5; + p = q; q += strcspn(q, ","); if (*q == '\0') end = 1; *q = '\0'; @@ -411,21 +411,19 @@ mp_msg(MSGT_VO, MSGL_ERR, "bl: maximum number of hosts reached (%d)\n", BL_MAX_HOSTS); return 1; } - p += 5; + p = q; q += strcspn(q, ",:"); + + bl_hosts[no_bl_hosts].port = 2323; // default port if (*q == ':') { *q++ = '\0'; - bl_hosts[no_bl_hosts].name = p; bl_hosts[no_bl_hosts].port = atoi(q); q += strcspn(q, ","); - if (*q == '\0') end = 1; - } else { - /* use default port */ - if (*q == '\0') end = 1; - *q = '\0'; - bl_hosts[no_bl_hosts].name = p; - bl_hosts[no_bl_hosts].port = 2323; } + + if (*q == '\0') end = 1; + *q = '\0'; + bl_hosts[no_bl_hosts].name = p; mp_msg(MSGT_VO, MSGL_V, "blhost[%d]: %s:%d\n", no_bl_hosts, p,