[MPlayer-dev-eng] CONF_TYPE_STRING issue

Ingo Brückl ib at wupperonline.de
Thu May 5 12:40:46 CEST 2011


Reimar Döffinger wrote on Wed, 4 May 2011 23:15:35 +0200:

> Below seems to work for me, [...]
> Index: m_option.c
> ===================================================================
> +++ m_option.c  (working copy)
> @@ -413,7 +413,7 @@
>  }
>
>  static void copy_str(const m_option_t* opt,void* dst, const void* src) {
> -  if(dst && src) {
> +  if(dst && src && VAL(dst) != VAL(src)) {
>  #ifndef NO_FREE
>      free(VAL(dst)); //FIXME!!!
>  #endif
> @@ -421,6 +421,12 @@
>    }
>  }
>
> +static void set_str(const m_option_t* opt,void* dst, const void* src) {
> +  if(dst && src) {
> +    VAL(dst) = VAL(src);
> +  }
> +}
> +
>  static void free_str(void* src) {
>    if(src && VAL(src)){
>  #ifndef NO_FREE
> @@ -438,8 +444,8 @@
>    parse_str,
>    print_str,
>    copy_str,
> +  set_str,
>    copy_str,
> -  copy_str,
>    free_str
>  };
>

Wouldn't this give direct access to the slot data, meaning that changing the
variable (for what reason ever) disables later restoring it from the initial
config parsed value? Will push/pop still work?

BTW, there are other M_OPT_TYPE_DYNAMICs as well, not only strings.

Ingo


More information about the MPlayer-dev-eng mailing list