mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Use compound literals in mysql_options() call
Makes use of compound literals instead of using extra my_bool variable just to hold "true/1" value.
This commit is contained in:
parent
c6d5d5c88f
commit
715b7a7cec
@ -763,9 +763,6 @@ mysql_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
char *endp;
|
||||
int j;
|
||||
unsigned int flags = 0;
|
||||
#if MYSQL_VERSION_ID >= 50000
|
||||
my_bool auto_reconnect = 1;
|
||||
#endif /* if MYSQL_VERSION_ID >= 50000 */
|
||||
|
||||
UNUSED(driverarg);
|
||||
UNUSED(dlzname);
|
||||
@ -901,21 +898,21 @@ mysql_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
pass = getParameterValue(argv[1], "pass=");
|
||||
socket = getParameterValue(argv[1], "socket=");
|
||||
|
||||
#if MYSQL_VERSION_ID >= 50000
|
||||
/* enable automatic reconnection. */
|
||||
if (mysql_options((MYSQL *)dbi->dbconn, MYSQL_OPT_RECONNECT,
|
||||
&auto_reconnect) != 0)
|
||||
&(my_bool){ 1 }) != 0)
|
||||
{
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||
DNS_LOGMODULE_DLZ, ISC_LOG_WARNING,
|
||||
"mysql driver failed to set "
|
||||
"MYSQL_OPT_RECONNECT option, continuing");
|
||||
"MYSQL_OPT_RECONNECT option, "
|
||||
"continuing");
|
||||
}
|
||||
#endif /* if MYSQL_VERSION_ID >= 50000 */
|
||||
|
||||
for (j = 0; dbc == NULL && j < 4; j++)
|
||||
for (j = 0; dbc == NULL && j < 4; j++) {
|
||||
dbc = mysql_real_connect((MYSQL *)dbi->dbconn, host, user, pass,
|
||||
dbname, port, socket, flags);
|
||||
}
|
||||
|
||||
/* let user know if we couldn't connect. */
|
||||
if (dbc == NULL) {
|
||||
|
@ -816,9 +816,6 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
char *endp;
|
||||
int j;
|
||||
const char *helper_name;
|
||||
#if MYSQL_VERSION_ID >= 50000
|
||||
my_bool auto_reconnect = 1;
|
||||
#endif /* if MYSQL_VERSION_ID >= 50000 */
|
||||
#if PTHREADS
|
||||
int dbcount;
|
||||
int i;
|
||||
@ -1016,17 +1013,15 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
|
||||
dbc = NULL;
|
||||
|
||||
#if MYSQL_VERSION_ID >= 50000
|
||||
/* enable automatic reconnection. */
|
||||
if (mysql_options((MYSQL *)dbi->dbconn, MYSQL_OPT_RECONNECT,
|
||||
&auto_reconnect) != 0)
|
||||
&(my_bool){ 1 }) != 0)
|
||||
{
|
||||
mysql->log(ISC_LOG_WARNING, "MySQL module failed to "
|
||||
"set "
|
||||
"MYSQL_OPT_RECONNECT "
|
||||
"option, continuing");
|
||||
}
|
||||
#endif /* if MYSQL_VERSION_ID >= 50000 */
|
||||
|
||||
for (j = 0; dbc == NULL && j < 4; j++) {
|
||||
dbc = mysql_real_connect(
|
||||
|
@ -1024,10 +1024,6 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
*/
|
||||
if (mysql_thread_safe()) {
|
||||
for (n = 0; n < MAX_DBI; n++) {
|
||||
#if MYSQL_VERSION_ID >= 50000
|
||||
my_bool opt = 1;
|
||||
#endif
|
||||
|
||||
dlz_mutex_init(&state->db[n].mutex, NULL);
|
||||
dlz_mutex_lock(&state->db[n].mutex);
|
||||
state->db[n].id = n;
|
||||
@ -1035,10 +1031,8 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
state->db[n].sock = mysql_init(NULL);
|
||||
mysql_options(state->db[n].sock,
|
||||
MYSQL_READ_DEFAULT_GROUP, modname);
|
||||
#if MYSQL_VERSION_ID >= 50000
|
||||
mysql_options(state->db[n].sock, MYSQL_OPT_RECONNECT,
|
||||
&opt);
|
||||
#endif
|
||||
&(my_bool){ 1 });
|
||||
dlz_mutex_unlock(&state->db[n].mutex);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user