From bf9a10e174b2e2c0baa567a9ddff3066eddbde90 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 10 Jan 2024 12:59:44 +0100 Subject: [PATCH] mx_mysql: Refactor two functions into void functions mx_mysql_option_set_default_group() and mx_mysql_option_set_reconnect() can't fail, so make them void functions. --- mx_mysql.c | 7 ++----- mx_mysql.h | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/mx_mysql.c b/mx_mysql.c index b18a6e4b..ca983b04 100644 --- a/mx_mysql.c +++ b/mx_mysql.c @@ -630,7 +630,7 @@ int mx_mysql_option_set_default_file(struct mx_mysql *mysql, char *fname) return 0; } -int mx_mysql_option_set_default_group(struct mx_mysql *mysql, char *group) +void mx_mysql_option_set_default_group(struct mx_mysql *mysql, char *group) { assert(mysql); @@ -638,16 +638,13 @@ int mx_mysql_option_set_default_group(struct mx_mysql *mysql, char *group) group = NULL; mysql->default_group = group; - - return 0; } -int mx_mysql_option_set_reconnect(struct mx_mysql *mysql, int reconnect) +void mx_mysql_option_set_reconnect(struct mx_mysql *mysql, int reconnect) { assert(mysql); mysql->reconnect = (bool)!!reconnect; - return 0; } static int mx_mysql_real_connect(struct mx_mysql *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long client_flag) diff --git a/mx_mysql.h b/mx_mysql.h index 0bf2c815..173e48a7 100644 --- a/mx_mysql.h +++ b/mx_mysql.h @@ -78,8 +78,8 @@ struct mx_mysql_stmt { int mx_mysql_initialize(struct mx_mysql **mysql); int mx_mysql_option_set_default_file(struct mx_mysql *mysql, char *fname) __attribute__ ((warn_unused_result)); -int mx_mysql_option_set_default_group(struct mx_mysql *mysql, char *group); -int mx_mysql_option_set_reconnect(struct mx_mysql *mysql, int reconnect); +void mx_mysql_option_set_default_group(struct mx_mysql *mysql, char *group); +void mx_mysql_option_set_reconnect(struct mx_mysql *mysql, int reconnect); int mx_mysql_connect(struct mx_mysql **mysql); int mx_mysql_connect_forever_sec(struct mx_mysql **mysql, unsigned int seconds);