|
1 | | -/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. |
| 1 | +/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 2 |
|
3 | 3 | This program is free software; you can redistribute it and/or modify |
4 | 4 | it under the terms of the GNU General Public License as published by |
@@ -117,8 +117,9 @@ find_plugin(const char *name, int type) |
117 | 117 | @retval a pointer to an installed plugin or 0 |
118 | 118 | */ |
119 | 119 | static struct st_mysql_client_plugin * |
120 | | -add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle, |
121 | | - int argc, va_list args) |
| 120 | +do_add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, |
| 121 | + void *dlhandle, |
| 122 | + int argc, va_list args) |
122 | 123 | { |
123 | 124 | const char *errmsg; |
124 | 125 | struct st_client_plugin_int plugin_int, *p; |
@@ -179,6 +180,31 @@ add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle, |
179 | 180 | return NULL; |
180 | 181 | } |
181 | 182 |
|
| 183 | + |
| 184 | +static struct st_mysql_client_plugin * |
| 185 | +add_plugin_noargs(MYSQL *mysql, struct st_mysql_client_plugin *plugin, |
| 186 | + void *dlhandle, |
| 187 | + int argc, ...) |
| 188 | +{ |
| 189 | + struct st_mysql_client_plugin *retval= NULL; |
| 190 | + va_list ap; |
| 191 | + va_start(ap, argc); |
| 192 | + retval= do_add_plugin(mysql, plugin, dlhandle, argc, ap); |
| 193 | + va_end(ap); |
| 194 | + return retval; |
| 195 | +} |
| 196 | + |
| 197 | + |
| 198 | +static struct st_mysql_client_plugin * |
| 199 | +add_plugin_withargs(MYSQL *mysql, struct st_mysql_client_plugin *plugin, |
| 200 | + void *dlhandle, |
| 201 | + int argc, va_list args) |
| 202 | +{ |
| 203 | + return do_add_plugin(mysql, plugin, dlhandle, argc, args); |
| 204 | +} |
| 205 | + |
| 206 | + |
| 207 | + |
182 | 208 | /** |
183 | 209 | Loads plugins which are specified in the environment variable |
184 | 210 | LIBMYSQL_PLUGINS. |
@@ -249,7 +275,7 @@ int mysql_client_plugin_init() |
249 | 275 | mysql_mutex_lock(&LOCK_load_client_plugin); |
250 | 276 |
|
251 | 277 | for (builtin= mysql_client_builtins; *builtin; builtin++) |
252 | | - add_plugin(&mysql, *builtin, 0, 0, 0); |
| 278 | + add_plugin_noargs(&mysql, *builtin, 0, 0); |
253 | 279 |
|
254 | 280 | mysql_mutex_unlock(&LOCK_load_client_plugin); |
255 | 281 |
|
@@ -307,7 +333,7 @@ mysql_client_register_plugin(MYSQL *mysql, |
307 | 333 | plugin= NULL; |
308 | 334 | } |
309 | 335 | else |
310 | | - plugin= add_plugin(mysql, plugin, 0, 0, 0); |
| 336 | + plugin= add_plugin_noargs(mysql, plugin, 0, 0); |
311 | 337 |
|
312 | 338 | mysql_mutex_unlock(&LOCK_load_client_plugin); |
313 | 339 | return plugin; |
@@ -420,7 +446,7 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type, |
420 | 446 | goto err; |
421 | 447 | } |
422 | 448 |
|
423 | | - plugin= add_plugin(mysql, plugin, dlhandle, argc, args); |
| 449 | + plugin= add_plugin_withargs(mysql, plugin, dlhandle, argc, args); |
424 | 450 |
|
425 | 451 | mysql_mutex_unlock(&LOCK_load_client_plugin); |
426 | 452 |
|
|
0 commit comments