called only by plugin_init() */
| 2004 | called only by plugin_init() |
| 2005 | */ |
| 2006 | static bool plugin_load_list(MEM_ROOT *tmp_root, const char *list) |
| 2007 | { |
| 2008 | char buffer[FN_REFLEN]; |
| 2009 | LEX_CSTRING name= {buffer, 0}, dl= {NULL, 0}, *str= &name; |
| 2010 | bool got_error= 0; |
| 2011 | char *p= buffer; |
| 2012 | DBUG_ENTER("plugin_load_list"); |
| 2013 | |
| 2014 | while (list) |
| 2015 | { |
| 2016 | if (p == buffer + sizeof(buffer) - 1) |
| 2017 | { |
| 2018 | sql_print_error("plugin-load parameter too long"); |
| 2019 | DBUG_RETURN(TRUE); |
| 2020 | } |
| 2021 | |
| 2022 | switch ((*(p++)= *(list++))) { |
| 2023 | case '\0': |
| 2024 | list= NULL; /* terminate the loop */ |
| 2025 | /* fall through */ |
| 2026 | case ';': |
| 2027 | case ':': |
| 2028 | p[-1]= 0; |
| 2029 | if (str == &name) // load all plugins in named module |
| 2030 | { |
| 2031 | if (!name.length) |
| 2032 | { |
| 2033 | p--; /* reset pointer */ |
| 2034 | continue; |
| 2035 | } |
| 2036 | |
| 2037 | dl= name; |
| 2038 | mysql_mutex_lock(&LOCK_plugin); |
| 2039 | free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE)); |
| 2040 | name.str= 0; // load everything |
| 2041 | if (plugin_add(tmp_root, false, &name, &dl, |
| 2042 | MYF(ME_ERROR_LOG)) != INSTALL_GOOD) |
| 2043 | goto error; |
| 2044 | } |
| 2045 | else |
| 2046 | { |
| 2047 | free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE)); |
| 2048 | mysql_mutex_lock(&LOCK_plugin); |
| 2049 | if (plugin_add(tmp_root, false, &name, &dl, |
| 2050 | MYF(ME_ERROR_LOG)) != INSTALL_GOOD) |
| 2051 | goto error; |
| 2052 | } |
| 2053 | mysql_mutex_unlock(&LOCK_plugin); |
| 2054 | name.length= dl.length= 0; |
| 2055 | dl.str= NULL; name.str= p= buffer; |
| 2056 | str= &name; |
| 2057 | continue; |
| 2058 | case '=': |
| 2059 | case '#': |
| 2060 | if (str == &name) |
| 2061 | { |
| 2062 | p[-1]= 0; |
| 2063 | str= &dl; |
no test coverage detected