Resolves mixed use of bstr in internal processing and char* for storage. Also makes faster comparision when searching for section and resolves comparision when name contains null chars.
Unified · Split
| @@ -105,7 +105,7 @@ typedef struct mp_cmd { · 104 unmodified lines | ||
| 105 | 105 | int flags; // mp_cmd_flags bitfield |
| 106 | 106 | char *original; |
| 107 | 107 | char *desc; // (usually NULL since stripped away later) |
| 108 | − char *input_section; | |
| 108 | + bstr input_section; | |
| 109 | 109 | bool is_up_down : 1; |
| 110 | 110 | bool is_up : 1; |
| 111 | 111 | bool emit_on_up : 1; |
| @@ -70,7 +70,7 @@ struct cmd_bind_section { · 69 unmodified lines | ||
| 70 | 70 | char *owner; |
| 71 | 71 | struct cmd_bind *binds; |
| 72 | 72 | int num_binds; |
| 73 | − char *section; | |
| 73 | + bstr section; | |
| 74 | 74 | struct mp_rect mouse_area; // set at runtime, if at all |
| 75 | 75 | bool mouse_area_set; // mouse_area is valid and should be tested |
| 76 | 76 | }; |
| @@ -78,7 +78,7 @@ struct cmd_bind_section { · 1 unmodified line | ||
| 78 | 78 | #define MP_MAX_SOURCES 10 |
| 79 | 79 | |
| 80 | 80 | struct active_section { |
| 81 | − char *name; | |
| 81 | + bstr name; | |
| 82 | 82 | int flags; |
| 83 | 83 | }; |
| 84 | 84 | |
| @@ -129,7 +129,7 @@ struct input_ctx { · 44 unmodified lines | ||
| 129 | 129 | // Mouse position on the consumer side (as command.c sees it) |
| 130 | 130 | int mouse_x, mouse_y; |
| 131 | 131 | int mouse_hover; // updated on mouse-enter/leave |
| 132 | − char *mouse_section; // last section to receive mouse event | |
| 132 | + bstr mouse_section; // last section to receive mouse event | |
| 133 | 133 | |
| 134 | 134 | // Mouse position on the producer side (as the VO sees it) |
| 135 | 135 | // Unlike mouse_x/y, this can be used to resolve mouse click bindings. |
| @@ -168,7 +168,7 @@ struct input_ctx { · 32 unmodified lines | ||
| 168 | 168 | }; |
| 169 | 169 | |
| 170 | 170 | static int parse_config(struct input_ctx *ictx, bool builtin, bstr data, |
| 171 | − const char *location, const char *restrict_section); | |
| 171 | + const char *location, bstr section); | |
| 172 | 172 | static void close_input_sources(struct input_ctx *ictx); |
| 173 | 173 | static bool test_mouse(struct input_ctx *ictx, int x, int y, int rej_flags); |
| 174 | 174 | |
| @@ -316,9 +316,9 @@ static void append_bind_info(struct input_ctx *ictx, char **pmsg, · 141 unmodified lines | ||
| 316 | 316 | msg = talloc_asprintf_append(msg, " '%s'", stripped); |
| 317 | 317 | if (!cmd) |
| 318 | 318 | msg = talloc_asprintf_append(msg, " (invalid)"); |
| 319 | − if (strcmp(bind->owner->section, "default") != 0) | |
| 320 | − msg = talloc_asprintf_append(msg, " in section {%s}", | |
| 321 | − bind->owner->section); | |
| 319 | + if (bstr_equals0(bind->owner->section, "default")) | |
| 320 | + msg = talloc_asprintf_append(msg, " in section {%.*s}", | |
| 321 | + BSTR_P(bind->owner->section)); | |
| 322 | 322 | msg = talloc_asprintf_append(msg, " in %s", bind->location); |
| 323 | 323 | if (bind->is_builtin) |
| 324 | 324 | msg = talloc_asprintf_append(msg, " (default)"); |
| @@ -371,7 +371,7 @@ static struct cmd_bind_section *find_section(struct input_ctx *ictx, · 46 unmodified lines | ||
| 371 | 371 | { |
| 372 | 372 | for (int n = 0; n < ictx->num_sections; n++) { |
| 373 | 373 | struct cmd_bind_section *bs = ictx->sections[n]; |
| 374 | − if (bstr_equals0(section, bs->section)) | |
| 374 | + if (bstr_equals(section, bs->section)) | |
| 375 | 375 | return bs; |
| 376 | 376 | } |
| 377 | 377 | return NULL; |
| @@ -387,7 +387,7 @@ static struct cmd_bind_section *get_bind_section(struct input_ctx *ictx, · 9 unmodified lines | ||
| 387 | 387 | return bind_section; |
| 388 | 388 | bind_section = talloc_ptrtype(ictx, bind_section); |
| 389 | 389 | *bind_section = (struct cmd_bind_section) { |
| 390 | − .section = bstrdup0(bind_section, section), | |
| 390 | + .section = bstrdup(bind_section, section), | |
| 391 | 391 | .mouse_area = {INT_MIN, INT_MIN, INT_MAX, INT_MAX}, |
| 392 | 392 | .mouse_area_set = true, |
| 393 | 393 | }; |
| @@ -403,9 +403,9 @@ static void key_buf_add(int *buf, int code) · 9 unmodified lines | ||
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | static struct cmd_bind *find_bind_for_key_section(struct input_ctx *ictx, |
| 406 | − char *section, int code) | |
| 406 | + bstr section, int code) | |
| 407 | 407 | { |
| 408 | − struct cmd_bind_section *bs = get_bind_section(ictx, bstr0(section)); | |
| 408 | + struct cmd_bind_section *bs = get_bind_section(ictx, section); | |
| 409 | 409 | |
| 410 | 410 | if (!bs->num_binds) |
| 411 | 411 | return NULL; |
| @@ -439,9 +439,9 @@ static struct cmd_bind *find_bind_for_key_section(struct input_ctx *ictx, · 27 unmodified lines | ||
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | static struct cmd_bind *find_any_bind_for_key(struct input_ctx *ictx, |
| 442 | − char *force_section, int code) | |
| 442 | + bstr force_section, int code) | |
| 443 | 443 | { |
| 444 | − if (force_section) | |
| 444 | + if (force_section.len) | |
| 445 | 445 | return find_bind_for_key_section(ictx, force_section, code); |
| 446 | 446 | |
| 447 | 447 | bool use_mouse = MP_KEY_DEPENDS_ON_MOUSE_POS(code); |
| @@ -484,7 +484,7 @@ static struct cmd_bind *find_any_bind_for_key(struct input_ctx *ictx, · 36 unmodified lines | ||
| 484 | 484 | return best_bind; |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | −static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, char *force_section, | |
| 487 | +static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, bstr force_section, | |
| 488 | 488 | int code) |
| 489 | 489 | { |
| 490 | 490 | if (ictx->opts->test) |
| @@ -513,8 +513,8 @@ static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, char *force_section, · 22 unmodified lines | ||
| 513 | 513 | if (ret) { |
| 514 | 514 | ret->input_section = cmd->owner->section; |
| 515 | 515 | ret->key_name = talloc_steal(ret, mp_input_get_key_combo_name(&code, 1)); |
| 516 | − MP_TRACE(ictx, "key '%s' -> '%s' in '%s'\n", | |
| 517 | − ret->key_name, cmd->cmd, ret->input_section); | |
| 516 | + MP_TRACE(ictx, "key '%s' -> '%s' in '%.*s'\n", | |
| 517 | + ret->key_name, cmd->cmd, BSTR_P(ret->input_section)); | |
| 518 | 518 | if (MP_KEY_IS_UNICODE(code)) { |
| 519 | 519 | bstr text = {0}; |
| 520 | 520 | mp_append_utf8_bstr(ret, &text, code); |
| @@ -533,16 +533,16 @@ static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, char *force_section, · 12 unmodified lines | ||
| 533 | 533 | static void update_mouse_section(struct input_ctx *ictx) |
| 534 | 534 | { |
| 535 | 535 | struct cmd_bind *bind = |
| 536 | − find_any_bind_for_key(ictx, NULL, MP_KEY_MOUSE_MOVE); | |
| 536 | + find_any_bind_for_key(ictx, (bstr){0}, MP_KEY_MOUSE_MOVE); | |
| 537 | 537 | |
| 538 | − char *new_section = bind ? bind->owner->section : "default"; | |
| 538 | + bstr new_section = bind ? bind->owner->section : bstr0("default"); | |
| 539 | 539 | |
| 540 | − char *old = ictx->mouse_section; | |
| 540 | + bstr old = ictx->mouse_section; | |
| 541 | 541 | ictx->mouse_section = new_section; |
| 542 | 542 | |
| 543 | − if (strcmp(old, ictx->mouse_section) != 0) { | |
| 544 | − MP_TRACE(ictx, "input: switch section %s -> %s\n", | |
| 545 | − old, ictx->mouse_section); | |
| 543 | + if (!bstr_equals(old, ictx->mouse_section)) { | |
| 544 | + MP_TRACE(ictx, "input: switch section %.*s -> %.*s\n", | |
| 545 | + BSTR_P(old), BSTR_P(ictx->mouse_section)); | |
| 546 | 546 | queue_cmd(ictx, get_cmd_from_keys(ictx, old, MP_KEY_MOUSE_LEAVE)); |
| 547 | 547 | } |
| 548 | 548 | } |
| @@ -586,7 +586,7 @@ static bool should_drop_cmd(struct input_ctx *ictx, struct mp_cmd *cmd) · 37 unmodified lines | ||
| 586 | 586 | static struct mp_cmd *resolve_key(struct input_ctx *ictx, int code) |
| 587 | 587 | { |
| 588 | 588 | update_mouse_section(ictx); |
| 589 | − struct mp_cmd *cmd = get_cmd_from_keys(ictx, NULL, code); | |
| 589 | + struct mp_cmd *cmd = get_cmd_from_keys(ictx, (bstr){0}, code); | |
| 590 | 590 | key_buf_add(ictx->key_history, code); |
| 591 | 591 | if (cmd && !cmd->def->is_ignore && !should_drop_cmd(ictx, cmd)) |
| 592 | 592 | return cmd; |
| @@ -765,7 +765,7 @@ static void feed_key(struct input_ctx *ictx, int code, double scale, · 172 unmodified lines | ||
| 765 | 765 | ictx->mouse_hover = unmod == MP_KEY_MOUSE_ENTER; |
| 766 | 766 | update_mouse_section(ictx); |
| 767 | 767 | |
| 768 | − mp_cmd_t *cmd = get_cmd_from_keys(ictx, NULL, code); | |
| 768 | + mp_cmd_t *cmd = get_cmd_from_keys(ictx, (bstr){0}, code); | |
| 769 | 769 | if (!cmd) // queue dummy cmd so that mouse-pos can notify observers |
| 770 | 770 | cmd = mp_input_parse_cmd(ictx, bstr0("ignore"), "<internal>"); |
| 771 | 771 | queue_cmd(ictx, cmd); |
| @@ -907,7 +907,7 @@ static void set_mouse_pos(struct input_ctx *ictx, int x, int y) · 135 unmodified lines | ||
| 907 | 907 | ictx->mouse_vo_y = y; |
| 908 | 908 | |
| 909 | 909 | update_mouse_section(ictx); |
| 910 | − struct mp_cmd *cmd = get_cmd_from_keys(ictx, NULL, MP_KEY_MOUSE_MOVE); | |
| 910 | + struct mp_cmd *cmd = get_cmd_from_keys(ictx, (bstr){0}, MP_KEY_MOUSE_MOVE); | |
| 911 | 911 | if (!cmd) |
| 912 | 912 | cmd = mp_input_parse_cmd(ictx, bstr0("ignore"), "<internal>"); |
| 913 | 913 | |
| @@ -1060,7 +1060,7 @@ static bool test_mouse(struct input_ctx *ictx, int x, int y, int rej_flags) · 146 unmodified lines | ||
| 1060 | 1060 | struct active_section *as = &ictx->active_sections[i]; |
| 1061 | 1061 | if (as->flags & rej_flags) |
| 1062 | 1062 | continue; |
| 1063 | − struct cmd_bind_section *s = get_bind_section(ictx, bstr0(as->name)); | |
| 1063 | + struct cmd_bind_section *s = get_bind_section(ictx, as->name); | |
| 1064 | 1064 | if (s->mouse_area_set && test_rect(&s->mouse_area, x, y)) { |
| 1065 | 1065 | res = true; |
| 1066 | 1066 | break; |
| @@ -1197,19 +1197,19 @@ void mp_input_get_mouse_pos(struct input_ctx *ictx, int *x, int *y, int *hover) · 130 unmodified lines | ||
| 1197 | 1197 | // If name is NULL, return "default". |
| 1198 | 1198 | // Return a statically allocated name of the section (i.e. return value never |
| 1199 | 1199 | // gets deallocated). |
| 1200 | −static char *normalize_section(struct input_ctx *ictx, char *name) | |
| 1200 | +static bstr normalize_section(struct input_ctx *ictx, bstr name) | |
| 1201 | 1201 | { |
| 1202 | − return get_bind_section(ictx, bstr0(name))->section; | |
| 1202 | + return get_bind_section(ictx, name)->section; | |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | −static void disable_section(struct input_ctx *ictx, char *name) | |
| 1205 | +static void disable_section(struct input_ctx *ictx, bstr name) | |
| 1206 | 1206 | { |
| 1207 | 1207 | name = normalize_section(ictx, name); |
| 1208 | 1208 | |
| 1209 | 1209 | // Remove old section, or make sure it's on top if re-enabled |
| 1210 | 1210 | for (int i = ictx->num_active_sections - 1; i >= 0; i--) { |
| 1211 | 1211 | struct active_section *as = &ictx->active_sections[i]; |
| 1212 | − if (strcmp(as->name, name) == 0) { | |
| 1212 | + if (bstr_equals(as->name, name)) { | |
| 1213 | 1213 | MP_TARRAY_REMOVE_AT(ictx->active_sections, |
| 1214 | 1214 | ictx->num_active_sections, i); |
| 1215 | 1215 | } |
| @@ -1219,18 +1219,19 @@ static void disable_section(struct input_ctx *ictx, char *name) · 3 unmodified lines | ||
| 1219 | 1219 | void mp_input_disable_section(struct input_ctx *ictx, char *name) |
| 1220 | 1220 | { |
| 1221 | 1221 | input_lock(ictx); |
| 1222 | − disable_section(ictx, name); | |
| 1222 | + disable_section(ictx, bstr0(name)); | |
| 1223 | 1223 | input_unlock(ictx); |
| 1224 | 1224 | } |
| 1225 | 1225 | |
| 1226 | 1226 | void mp_input_enable_section(struct input_ctx *ictx, char *name, int flags) |
| 1227 | 1227 | { |
| 1228 | + bstr bname = bstr0(name); | |
| 1228 | 1229 | input_lock(ictx); |
| 1229 | − name = normalize_section(ictx, name); | |
| 1230 | + bname = normalize_section(ictx, bname); | |
| 1230 | 1231 | |
| 1231 | − disable_section(ictx, name); | |
| 1232 | + disable_section(ictx, bname); | |
| 1232 | 1233 | |
| 1233 | − MP_TRACE(ictx, "enable section '%s'\n", name); | |
| 1234 | + MP_TRACE(ictx, "enable section '%.*s'\n", BSTR_P(bname)); | |
| 1234 | 1235 | |
| 1235 | 1236 | int top = ictx->num_active_sections; |
| 1236 | 1237 | if (!(flags & MP_INPUT_ON_TOP)) { |
| @@ -1241,11 +1242,11 @@ void mp_input_enable_section(struct input_ctx *ictx, char *name, int flags) · 4 unmodified lines | ||
| 1241 | 1242 | } |
| 1242 | 1243 | } |
| 1243 | 1244 | MP_TARRAY_INSERT_AT(ictx, ictx->active_sections, ictx->num_active_sections, |
| 1244 | − top, (struct active_section){name, flags}); | |
| 1245 | + top, (struct active_section){bname, flags}); | |
| 1245 | 1246 | |
| 1246 | 1247 | MP_TRACE(ictx, "active section stack:\n"); |
| 1247 | 1248 | for (int n = 0; n < ictx->num_active_sections; n++) { |
| 1248 | − MP_TRACE(ictx, " %s %d\n", ictx->active_sections[n].name, | |
| 1249 | + MP_TRACE(ictx, " %.*s %d\n", BSTR_P(ictx->active_sections[n].name), | |
| 1249 | 1250 | ictx->active_sections[n].flags); |
| 1250 | 1251 | } |
| 1251 | 1252 | |
| @@ -1292,13 +1293,14 @@ static void remove_binds(struct cmd_bind_section *bs, bool builtin) · 40 unmodified lines | ||
| 1292 | 1293 | void mp_input_define_section(struct input_ctx *ictx, char *name, char *location, |
| 1293 | 1294 | char *contents, bool builtin, char *owner) |
| 1294 | 1295 | { |
| 1295 | − if (!name || !name[0]) | |
| 1296 | + bstr bname = bstr0(name); | |
| 1297 | + if (!bname.len) | |
| 1296 | 1298 | return; // parse_config() changes semantics with restrict_section==empty |
| 1297 | 1299 | input_lock(ictx); |
| 1298 | 1300 | // Delete: |
| 1299 | − struct cmd_bind_section *bs = get_bind_section(ictx, bstr0(name)); | |
| 1301 | + struct cmd_bind_section *bs = get_bind_section(ictx, bname); | |
| 1300 | 1302 | if ((!bs->owner || (owner && strcmp(bs->owner, owner) != 0)) && |
| 1301 | − strcmp(bs->section, "default") != 0) | |
| 1303 | + !bstr_equals0(bs->section, "default")) | |
| 1302 | 1304 | { |
| 1303 | 1305 | talloc_free(bs->owner); |
| 1304 | 1306 | bs->owner = talloc_strdup(bs, owner); |
| @@ -1306,10 +1308,10 @@ void mp_input_define_section(struct input_ctx *ictx, char *name, char *location, · 1 unmodified line | ||
| 1306 | 1308 | remove_binds(bs, builtin); |
| 1307 | 1309 | if (contents && contents[0]) { |
| 1308 | 1310 | // Redefine: |
| 1309 | − parse_config(ictx, builtin, bstr0(contents), location, name); | |
| 1311 | + parse_config(ictx, builtin, bstr0(contents), location, bname); | |
| 1310 | 1312 | } else { |
| 1311 | 1313 | // Disable: |
| 1312 | − disable_section(ictx, name); | |
| 1314 | + disable_section(ictx, bname); | |
| 1313 | 1315 | } |
| 1314 | 1316 | input_unlock(ictx); |
| 1315 | 1317 | } |
| @@ -1375,17 +1377,17 @@ static void bind_keys(struct input_ctx *ictx, bool builtin, bstr section, · 59 unmodified lines | ||
| 1375 | 1377 | memcpy(bind->keys, keys, num_keys * sizeof(bind->keys[0])); |
| 1376 | 1378 | if (mp_msg_test(ictx->log, MSGL_DEBUG)) { |
| 1377 | 1379 | char *s = mp_input_get_key_combo_name(keys, num_keys); |
| 1378 | − MP_TRACE(ictx, "add: section='%s' key='%s'%s cmd='%s' location='%s'\n", | |
| 1379 | − bind->owner->section, s, bind->is_builtin ? " builtin" : "", | |
| 1380 | + MP_TRACE(ictx, "add: section='%.*s' key='%s'%s cmd='%s' location='%s'\n", | |
| 1381 | + BSTR_P(bind->owner->section), s, bind->is_builtin ? " builtin" : "", | |
| 1380 | 1382 | bind->cmd, bind->location); |
| 1381 | 1383 | talloc_free(s); |
| 1382 | 1384 | } |
| 1383 | 1385 | } |
| 1384 | 1386 | |
| 1385 | −// restrict_section: every entry is forced to this section name | |
| 1386 | −// if NULL, load normally and allow any sections | |
| 1387 | +// section: every entry is forced to this section name | |
| 1388 | +// if NULL, load normally and allow any sections | |
| 1387 | 1389 | static int parse_config(struct input_ctx *ictx, bool builtin, bstr data, |
| 1388 | − const char *location, const char *restrict_section) | |
| 1390 | + const char *location, bstr section) | |
| 1389 | 1391 | { |
| 1390 | 1392 | int n_binds = 0; |
| 1391 | 1393 | int line_no = 0; |
| @@ -1432,7 +1434,6 @@ static int parse_config(struct input_ctx *ictx, bool builtin, bstr data, · 40 unmodified lines | ||
| 1432 | 1434 | } |
| 1433 | 1435 | talloc_free(name); |
| 1434 | 1436 | |
| 1435 | − bstr section = bstr0(restrict_section); | |
| 1436 | 1437 | if (!section.len) { |
| 1437 | 1438 | if (bstr_startswith0(command, "{")) { |
| 1438 | 1439 | int p = bstrchr(command, '}'); |
| @@ -1479,7 +1480,7 @@ static bool parse_config_file(struct input_ctx *ictx, char *file) · 40 unmodified lines | ||
| 1479 | 1480 | bstr data = stream_read_complete(s, tmp, 1000000); |
| 1480 | 1481 | if (data.start) { |
| 1481 | 1482 | MP_VERBOSE(ictx, "Parsing input config file %s\n", file); |
| 1482 | − int num = parse_config(ictx, false, data, file, NULL); | |
| 1483 | + int num = parse_config(ictx, false, data, file, (bstr){0}); | |
| 1483 | 1484 | MP_VERBOSE(ictx, "Input config file %s parsed: %d binds\n", file, num); |
| 1484 | 1485 | r = true; |
| 1485 | 1486 | } else { |
| @@ -1502,7 +1503,7 @@ struct input_ctx *mp_input_init(struct mpv_global *global, · 16 unmodified lines | ||
| 1502 | 1503 | .global = global, |
| 1503 | 1504 | .ar_state = -1, |
| 1504 | 1505 | .log = mp_log_new(ictx, global->log, "input"), |
| 1505 | − .mouse_section = "default", | |
| 1506 | + .mouse_section = bstr0("default"), | |
| 1506 | 1507 | .opts_cache = m_config_cache_alloc(ictx, global, &input_config), |
| 1507 | 1508 | .wakeup_cb = wakeup_cb, |
| 1508 | 1509 | .wakeup_ctx = wakeup_ctx, |
| @@ -1559,7 +1560,7 @@ void mp_input_load_config(struct input_ctx *ictx) · 50 unmodified lines | ||
| 1559 | 1560 | bstr line = bstr_getline(builtin, &builtin); |
| 1560 | 1561 | bstr_eatstart0(&line, "#"); |
| 1561 | 1562 | if (!bstr_startswith0(line, " ")) |
| 1562 | − parse_config(ictx, true, line, "<builtin>", NULL); | |
| 1563 | + parse_config(ictx, true, line, "<builtin>", (bstr){0}); | |
| 1563 | 1564 | } |
| 1564 | 1565 | |
| 1565 | 1566 | bool config_ok = false; |
| @@ -1679,8 +1680,8 @@ void mp_input_bind_key(struct input_ctx *ictx, int key, bstr command) · 113 unmodified lines | ||
| 1679 | 1680 | memcpy(bind->keys, &key, 1 * sizeof(bind->keys[0])); |
| 1680 | 1681 | if (mp_msg_test(ictx->log, MSGL_DEBUG)) { |
| 1681 | 1682 | char *s = mp_input_get_key_combo_name(&key, 1); |
| 1682 | − MP_TRACE(ictx, "add:section='%s' key='%s'%s cmd='%s' location='%s'\n", | |
| 1683 | − bind->owner->section, s, bind->is_builtin ? " builtin" : "", | |
| 1683 | + MP_TRACE(ictx, "add:section='%.*s' key='%s'%s cmd='%s' location='%s'\n", | |
| 1684 | + BSTR_P(bind->owner->section), s, bind->is_builtin ? " builtin" : "", | |
| 1684 | 1685 | bind->cmd, bind->location); |
| 1685 | 1686 | talloc_free(s); |
| 1686 | 1687 | } |
| @@ -1699,7 +1700,7 @@ struct mpv_node mp_input_get_bindings(struct input_ctx *ictx) · 12 unmodified lines | ||
| 1699 | 1700 | |
| 1700 | 1701 | for (int i = 0; i < ictx->num_active_sections; i++) { |
| 1701 | 1702 | struct active_section *as = &ictx->active_sections[i]; |
| 1702 | − if (strcmp(as->name, s->section) == 0) { | |
| 1703 | + if (bstr_equals(as->name, s->section)) { | |
| 1703 | 1704 | priority = i; |
| 1704 | 1705 | break; |
| 1705 | 1706 | } |
| @@ -1718,7 +1719,7 @@ struct mpv_node mp_input_get_bindings(struct input_ctx *ictx) · 12 unmodified lines | ||
| 1718 | 1719 | if (b_priority >= 0 && !b->is_builtin) |
| 1719 | 1720 | b_priority += ictx->num_active_sections; |
| 1720 | 1721 | |
| 1721 | − node_map_add_string(entry, "section", s->section); | |
| 1722 | + node_map_add_string(entry, "section", s->section.start); | |
| 1722 | 1723 | if (s->owner) |
| 1723 | 1724 | node_map_add_string(entry, "owner", s->owner); |
| 1724 | 1725 | node_map_add_string(entry, "cmd", b->cmd); |