Unified · Split
| @@ -1304,8 +1304,7 @@ void mp_input_define_section(struct input_ctx *ictx, char *name, char *location, · 1303 unmodified lines | ||
| 1304 | 1304 | if ((!bs->owner || (owner && strcmp(bs->owner, owner) != 0)) && |
| 1305 | 1305 | !bstr_equals0(bs->section, "default")) |
| 1306 | 1306 | { |
| 1307 | − talloc_free(bs->owner); | |
| 1308 | − bs->owner = talloc_strdup(bs, owner); | |
| 1307 | + talloc_replace(bs, bs->owner, owner); | |
| 1309 | 1308 | } |
| 1310 | 1309 | remove_binds(bs, builtin); |
| 1311 | 1310 | if (contents && contents[0]) { |
| @@ -1233,10 +1233,8 @@ static char *print_str(const m_option_t *opt, const void *val) · 1232 unmodified lines | ||
| 1233 | 1233 | |
| 1234 | 1234 | static void copy_str(const m_option_t *opt, void *dst, const void *src) |
| 1235 | 1235 | { |
| 1236 | − if (dst && src) { | |
| 1237 | − talloc_free(VAL(dst)); | |
| 1238 | − VAL(dst) = talloc_strdup(NULL, VAL(src)); | |
| 1239 | − } | |
| 1236 | + if (dst && src) | |
| 1237 | + talloc_replace(NULL, VAL(dst), VAL(src)); | |
| 1240 | 1238 | } |
| 1241 | 1239 | |
| 1242 | 1240 | static int str_set(const m_option_t *opt, void *dst, struct mpv_node *src) |
| @@ -116,8 +116,7 @@ void term_osd_set_subs(struct MPContext *mpctx, const char *text) · 115 unmodified lines | ||
| 116 | 116 | text = ""; // disable |
| 117 | 117 | if (strcmp(mpctx->term_osd_subs ? mpctx->term_osd_subs : "", text) == 0) |
| 118 | 118 | return; |
| 119 | − talloc_free(mpctx->term_osd_subs); | |
| 120 | − mpctx->term_osd_subs = talloc_strdup(mpctx, text); | |
| 119 | + talloc_replace(mpctx, mpctx->term_osd_subs, text); | |
| 121 | 120 | term_osd_update(mpctx); |
| 122 | 121 | } |
| 123 | 122 | |
| @@ -126,14 +125,12 @@ static void term_osd_set_text_lazy(struct MPContext *mpctx, const char *text) · 2 unmodified lines | ||
| 126 | 125 | bool video_osd = mpctx->video_out && mpctx->opts->video_osd; |
| 127 | 126 | if ((video_osd && mpctx->opts->term_osd != 1) || !text) |
| 128 | 127 | text = ""; // disable |
| 129 | − talloc_free(mpctx->term_osd_text); | |
| 130 | − mpctx->term_osd_text = talloc_strdup(mpctx, text); | |
| 128 | + talloc_replace(mpctx, mpctx->term_osd_text, text); | |
| 131 | 129 | } |
| 132 | 130 | |
| 133 | 131 | static void term_osd_set_status_lazy(struct MPContext *mpctx, const char *text) |
| 134 | 132 | { |
| 135 | − talloc_free(mpctx->term_osd_status); | |
| 136 | − mpctx->term_osd_status = talloc_strdup(mpctx, text); | |
| 133 | + talloc_replace(mpctx, mpctx->term_osd_status, text); | |
| 137 | 134 | } |
| 138 | 135 | |
| 139 | 136 | static void add_term_osd_bar(struct MPContext *mpctx, char **line, int width) |
| @@ -2028,8 +2028,7 @@ static void update_icc_opts(struct priv *p, const struct mp_icc_opts *opts) · 2027 unmodified lines | ||
| 2028 | 2028 | update_icc(p, icc); |
| 2029 | 2029 | |
| 2030 | 2030 | // Update cached path |
| 2031 | − talloc_free(p->icc_path); | |
| 2032 | − p->icc_path = talloc_strdup(p, opts->profile); | |
| 2031 | + talloc_replace(p, p->icc_path, opts->profile); | |
| 2033 | 2032 | } |
| 2034 | 2033 | |
| 2035 | 2034 | static void update_lut(struct priv *p, struct user_lut *lut) |
| @@ -2045,8 +2044,7 @@ static void update_lut(struct priv *p, struct user_lut *lut) · 9 unmodified lines | ||
| 2045 | 2044 | |
| 2046 | 2045 | // Update cached path |
| 2047 | 2046 | pl_lut_free(&lut->lut); |
| 2048 | − talloc_free(lut->path); | |
| 2049 | − lut->path = talloc_strdup(p, lut->opt); | |
| 2047 | + talloc_replace(p, lut->path, lut->opt); | |
| 2050 | 2048 | |
| 2051 | 2049 | // Load LUT file |
| 2052 | 2050 | char *fname = mp_get_user_path(NULL, p->global, lut->path); |
| @@ -655,9 +655,7 @@ static void data_offer_handle_offer(void *data, struct wl_data_offer *offer, · 654 unmodified lines | ||
| 655 | 655 | int score = mp_event_get_mime_type_score(wl->vo->input_ctx, mime_type); |
| 656 | 656 | if (score > wl->dnd_mime_score && wl->opts->drag_and_drop != -2) { |
| 657 | 657 | wl->dnd_mime_score = score; |
| 658 | − if (wl->dnd_mime_type) | |
| 659 | − talloc_free(wl->dnd_mime_type); | |
| 660 | − wl->dnd_mime_type = talloc_strdup(wl, mime_type); | |
| 658 | + talloc_replace(wl, wl->dnd_mime_type, mime_type); | |
| 661 | 659 | MP_VERBOSE(wl, "Given DND offer with mime type %s\n", wl->dnd_mime_type); |
| 662 | 660 | } |
| 663 | 661 | } |
| @@ -2229,8 +2229,7 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg) · 2228 unmodified lines | ||
| 2229 | 2229 | set_screensaver(x11, true); |
| 2230 | 2230 | return VO_TRUE; |
| 2231 | 2231 | case VOCTRL_UPDATE_WINDOW_TITLE: |
| 2232 | − talloc_free(x11->window_title); | |
| 2233 | − x11->window_title = talloc_strdup(x11, (char *)arg); | |
| 2232 | + talloc_replace(x11, x11->window_title, (char *)arg); | |
| 2234 | 2233 | if (!x11->parent || x11->opts->x11_wid_title) |
| 2235 | 2234 | vo_x11_update_window_title(vo); |
| 2236 | 2235 | return VO_TRUE; |