Michael Widenius <monty@askmonty.org> writes:
"Sergei" == Sergei Golubchik <serg@askmonty.org> writes:
Sergei> please create a macro extension_set(), and rewrite Sergei> extension_set_string() to use extension_set(). Something like
Sergei> #define extension_set(OPTS, X, VAL) \ Sergei> if (!(OPTS)->extension) \ Sergei> (OPTS)->extension= (struct st_mysql_options_extention *) \ Sergei> my_malloc(sizeof(struct st_mysql_options_extention), \ Sergei> MYF(MY_WME | MY_ZEROFILL)); \ Sergei> (OPTS)->extension->X= VAL;
Sergei> #define extension_set_string(OPTS, X, STR) \ Sergei> if ((OPTS)->extension) \ Sergei> my_free((OPTS)->extension->X, MYF(MY_ALLOW_ZERO_PTR)); \ Sergei> extension_set(OPTS, X, my_strdup((STR), MYF(MY_WME)));
Didn't think it was needed for only one case. If there is a single more case than sure.
I will need this for MWL#192 I think (to remember the state when returning in the middle of a non-blocking call waiting for more data on socket). - Kristian.