From 6da995ffe58d1eef9f213a5e4f178b4fd2880e2d Mon Sep 17 00:00:00 2001
From: Danny Auble <da@llnl.gov>
Date: Tue, 28 Dec 2010 00:50:00 +0000
Subject: [PATCH] fixed some whitespace issues

---
 .../mysql/accounting_storage_mysql.c          | 578 +++++------
 .../accounting_storage/mysql/as_mysql_acct.c  | 251 ++---
 .../mysql/as_mysql_archive.c                  | 474 ++++-----
 .../accounting_storage/mysql/as_mysql_assoc.c | 979 +++++++++---------
 .../mysql/as_mysql_cluster.c                  | 294 +++---
 .../mysql/as_mysql_convert.c                  | 369 +++----
 .../accounting_storage/mysql/as_mysql_job.c   | 263 ++---
 .../mysql/as_mysql_jobacct_process.c          | 379 +++----
 .../mysql/as_mysql_problems.c                 | 119 +--
 .../accounting_storage/mysql/as_mysql_qos.c   | 352 +++----
 .../accounting_storage/mysql/as_mysql_resv.c  | 168 +--
 .../mysql/as_mysql_rollup.c                   | 200 ++--
 .../accounting_storage/mysql/as_mysql_txn.c   | 155 +--
 .../accounting_storage/mysql/as_mysql_usage.c | 160 +--
 .../accounting_storage/mysql/as_mysql_user.c  | 292 +++---
 .../accounting_storage/mysql/as_mysql_wckey.c | 134 +--
 16 files changed, 2592 insertions(+), 2575 deletions(-)

diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
index 69aa7f51d6a..bff32575d88 100644
--- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
+++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
@@ -161,7 +161,7 @@ static List _get_cluster_names(mysql_conn_t *mysql_conn)
 	char *query = xstrdup_printf("select name from %s where deleted=0",
 				     cluster_table);
 
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return ret_list;
 	}
@@ -179,8 +179,8 @@ static List _get_cluster_names(mysql_conn_t *mysql_conn)
 		found = 1;
 
 	ret_list = list_create(slurm_destroy_char);
-	while((row = mysql_fetch_row(result))) {
-		if(row[0] && row[0][0]) {
+	while ((row = mysql_fetch_row(result))) {
+		if (row[0] && row[0][0]) {
 			if (cluster_name && !strcmp(cluster_name, row[0]))
 				found = 1;
 			list_append(ret_list, xstrdup(row[0]));
@@ -203,13 +203,13 @@ static int _set_qos_cnt(mysql_conn_t *mysql_conn)
 	MYSQL_ROW row;
 	char *query = xstrdup_printf("select MAX(id) from %s", qos_table);
 
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(!(row = mysql_fetch_row(result))) {
+	if (!(row = mysql_fetch_row(result))) {
 		mysql_free_result(result);
 		return SLURM_ERROR;
 	}
@@ -231,8 +231,8 @@ static void _process_running_jobs_result(char *cluster_name,
 	MYSQL_ROW row;
 	char *object;
 
-	while((row = mysql_fetch_row(result))) {
-		if(!row[JASSOC_USER][0]) {
+	while ((row = mysql_fetch_row(result))) {
+		if (!row[JASSOC_USER][0]) {
 			/* This should never happen */
 			error("How did we get a job running on an association "
 			      "that isn't a user assocation job %s cluster "
@@ -244,7 +244,7 @@ static void _process_running_jobs_result(char *cluster_name,
 			"JobID = %-10s C = %-10s A = %-10s U = %-9s",
 			row[JASSOC_JOB], cluster_name, row[JASSOC_ACCT],
 			row[JASSOC_USER]);
-		if(row[JASSOC_PART][0])
+		if (row[JASSOC_PART][0])
 			// see if there is a partition name
 			xstrfmtcat(object, " P = %s", row[JASSOC_PART]);
 		list_append(ret_list, object);
@@ -275,7 +275,7 @@ static bool _check_jobs_before_remove(mysql_conn_t *mysql_conn,
 		"t1.user",
 		"t1.partition"
 	};
-	if(ret_list) {
+	if (ret_list) {
 		xstrcat(object, jassoc_req_inx[0]);
 		for(i=1; i<JASSOC_COUNT; i++)
 			xstrfmtcat(object, ", %s", jassoc_req_inx[i]);
@@ -308,23 +308,23 @@ static bool _check_jobs_before_remove(mysql_conn_t *mysql_conn,
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return rc;
 	}
 	xfree(query);
 
-	if(mysql_num_rows(result)) {
+	if (mysql_num_rows(result)) {
 		debug4("We have jobs for this combo");
 		rc = true;
-		if(ret_list && !(*already_flushed)) {
+		if (ret_list && !(*already_flushed)) {
 			list_flush(ret_list);
 			(*already_flushed) = 1;
 			reset_mysql_conn(mysql_conn);
 		}
 	}
 
-	if(ret_list)
+	if (ret_list)
 		_process_running_jobs_result(cluster_name, result, ret_list);
 
 	mysql_free_result(result);
@@ -352,7 +352,7 @@ static bool _check_jobs_before_remove_assoc(mysql_conn_t *mysql_conn,
 		"t2.partition"
 	};
 
-	if(ret_list) {
+	if (ret_list) {
 		xstrcat(object, jassoc_req_inx[0]);
 		for(i=1; i<JASSOC_COUNT; i++)
 			xstrfmtcat(object, ", %s", jassoc_req_inx[i]);
@@ -376,24 +376,24 @@ static bool _check_jobs_before_remove_assoc(mysql_conn_t *mysql_conn,
 	}
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return rc;
 	}
 	xfree(query);
 
-	if(mysql_num_rows(result)) {
+	if (mysql_num_rows(result)) {
 		debug4("We have jobs for this combo");
 		rc = true;
-		if(ret_list && !(*already_flushed)) {
+		if (ret_list && !(*already_flushed)) {
 			list_flush(ret_list);
 			(*already_flushed) = 1;
 			reset_mysql_conn(mysql_conn);
 		}
 	}
 
-	if(ret_list)
+	if (ret_list)
 		_process_running_jobs_result(cluster_name, result, ret_list);
 
 	mysql_free_result(result);
@@ -415,14 +415,14 @@ static bool _check_jobs_before_remove_without_assoctable(
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return rc;
 	}
 	xfree(query);
 
-	if(mysql_num_rows(result)) {
+	if (mysql_num_rows(result)) {
 		debug4("We have jobs for this combo");
 		rc = true;
 	}
@@ -599,20 +599,20 @@ static int _as_mysql_acct_check_tables(mysql_conn_t *mysql_conn)
 
 	/* Make the cluster table first since we build other tables
 	   built off this one */
-	if(mysql_db_create_table(mysql_conn, cluster_table,
-				 cluster_table_fields,
-				 ", primary key (name(20)))") == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, cluster_table,
+				  cluster_table_fields,
+				  ", primary key (name(20)))") == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	/* This table needs to be made before conversions also since
 	   we add a cluster column.
 	*/
-	if(mysql_db_create_table(mysql_conn, txn_table, txn_table_fields,
-				 ", primary key (id))") == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, txn_table, txn_table_fields,
+				  ", primary key (id))") == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	slurm_mutex_lock(&as_mysql_cluster_list_lock);
-	if(!(as_mysql_cluster_list = _get_cluster_names(mysql_conn))) {
+	if (!(as_mysql_cluster_list = _get_cluster_names(mysql_conn))) {
 		error("issue getting contents of %s", cluster_table);
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 		return SLURM_ERROR;
@@ -621,42 +621,42 @@ static int _as_mysql_acct_check_tables(mysql_conn_t *mysql_conn)
 	/* might as well do all the cluster centric tables inside this
 	 * lock */
 	itr = list_iterator_create(as_mysql_cluster_list);
-	while((cluster_name = list_next(itr))) {
-		if((rc = create_cluster_tables(mysql_conn, cluster_name))
-		   != SLURM_SUCCESS)
+	while ((cluster_name = list_next(itr))) {
+		if ((rc = create_cluster_tables(mysql_conn, cluster_name))
+		    != SLURM_SUCCESS)
 			break;
 	}
 	list_iterator_destroy(itr);
 	slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
-	if(rc != SLURM_SUCCESS)
+	if (rc != SLURM_SUCCESS)
 		return rc;
 	/* DEF_TIMERS; */
 	/* START_TIMER; */
-	if(as_mysql_convert_tables(mysql_conn) != SLURM_SUCCESS)
+	if (as_mysql_convert_tables(mysql_conn) != SLURM_SUCCESS)
 		return SLURM_ERROR;
 	/* END_TIMER; */
 	/* info("conversion took %s", TIME_STR); */
 
-	if(mysql_db_create_table(mysql_conn, acct_coord_table,
-				 acct_coord_table_fields,
-				 ", primary key (acct(20), user(20)))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, acct_coord_table,
+				  acct_coord_table_fields,
+				  ", primary key (acct(20), user(20)))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
-	if(mysql_db_create_table(mysql_conn, acct_table, acct_table_fields,
-				 ", primary key (name(20)))") == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, acct_table, acct_table_fields,
+				  ", primary key (name(20)))") == SLURM_ERROR)
 		return SLURM_ERROR;
 
-	if(mysql_db_create_table(mysql_conn, qos_table,
-				 qos_table_fields,
-				 ", primary key (id), "
-				 "unique index (name(20)))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, qos_table,
+				  qos_table_fields,
+				  ", primary key (id), "
+				  "unique index (name(20)))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 	else {
 		int qos_id = 0;
-		if(slurmdbd_conf && slurmdbd_conf->default_qos) {
+		if (slurmdbd_conf && slurmdbd_conf->default_qos) {
 			List char_list = list_create(slurm_destroy_char);
 			char *qos = NULL;
 			ListIterator itr = NULL;
@@ -669,7 +669,7 @@ static int _as_mysql_acct_check_tables(mysql_conn_t *mysql_conn)
 			   (my_list.h is the bad boy).
 			*/
 			itr = list_iterator_create(char_list);
-			while((qos = list_next(itr))) {
+			while ((qos = list_next(itr))) {
 				query = xstrdup_printf(
 					"insert into %s "
 					"(creation_time, mod_time, name, "
@@ -681,7 +681,7 @@ static int _as_mysql_acct_check_tables(mysql_conn_t *mysql_conn)
 					qos_table, now, now, qos);
 				qos_id = mysql_db_insert_ret_id(
 					mysql_conn, query);
-				if(!qos_id)
+				if (!qos_id)
 					fatal("problem added qos '%s", qos);
 				xstrfmtcat(default_qos_str, ",%d", qos_id);
 				xfree(query);
@@ -699,20 +699,20 @@ static int _as_mysql_acct_check_tables(mysql_conn_t *mysql_conn)
 				qos_table, now, now);
 			//debug3("%s", query);
 			qos_id = mysql_db_insert_ret_id(mysql_conn, query);
-			if(!qos_id)
+			if (!qos_id)
 				fatal("problem added qos 'normal");
 
 			xstrfmtcat(default_qos_str, ",%d", qos_id);
 			xfree(query);
 		}
 
-		if(_set_qos_cnt(mysql_conn) != SLURM_SUCCESS)
+		if (_set_qos_cnt(mysql_conn) != SLURM_SUCCESS)
 			return SLURM_ERROR;
 	}
 
 	/* This must be ran after create_cluster_tables() */
-	if(mysql_db_create_table(mysql_conn, user_table, user_table_fields,
-				 ", primary key (name(20)))") == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, user_table, user_table_fields,
+				  ", primary key (name(20)))") == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	rc = mysql_db_query(mysql_conn, get_parent_proc);
@@ -754,7 +754,7 @@ extern int check_connection(mysql_conn_t *mysql_conn)
 	} else if (mysql_db_ping(mysql_conn) != 0) {
 		if (mysql_db_get_db_connection(
 			    mysql_conn, mysql_db_name, mysql_db_info)
-		   != SLURM_SUCCESS) {
+		    != SLURM_SUCCESS) {
 			error("unable to re-connect to as_mysql database");
 			errno = ESLURM_DB_CONNECTION;
 			return ESLURM_DB_CONNECTION;
@@ -799,7 +799,7 @@ extern int last_affected_rows(mysql_conn_t *mysql_conn)
 			if (mysql_field_count(mysql_conn->db_conn) == 0) {
 				status = mysql_affected_rows(
 					mysql_conn->db_conn);
-				if(status > 0)
+				if (status > 0)
 					rows = status;
 			}
 		if ((status = mysql_next_result(mysql_conn->db_conn)) > 0)
@@ -811,7 +811,7 @@ extern int last_affected_rows(mysql_conn_t *mysql_conn)
 
 extern void reset_mysql_conn(mysql_conn_t *mysql_conn)
 {
-	if(mysql_conn->rollback)
+	if (mysql_conn->rollback)
 		mysql_db_rollback(mysql_conn);
 	xfree(mysql_conn->pre_commit_query);
 	list_flush(mysql_conn->update_list);
@@ -1026,7 +1026,7 @@ extern int create_cluster_tables(mysql_conn_t *mysql_conn, char *cluster_name)
 	query = xstrdup_printf("show tables like '%s';", user_table);
 
 	debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
@@ -1046,7 +1046,7 @@ extern int create_cluster_tables(mysql_conn_t *mysql_conn, char *cluster_name)
 			       cluster_name, assoc_table);
 
 	debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
@@ -1063,7 +1063,7 @@ extern int create_cluster_tables(mysql_conn_t *mysql_conn, char *cluster_name)
 			"show columns from %s where Field='is_def';",
 			table_name);
 		debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 			xfree(query);
 			return SLURM_ERROR;
 		}
@@ -1073,112 +1073,112 @@ extern int create_cluster_tables(mysql_conn_t *mysql_conn, char *cluster_name)
 		result = NULL;
 	}
 
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 assoc_table_fields,
-				 ", primary key (id_assoc), "
-				 " unique index (user(20), acct(20), "
-				 "partition(20)))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  assoc_table_fields,
+				  ", primary key (id_assoc), "
+				  " unique index (user(20), acct(20), "
+				  "partition(20)))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, assoc_day_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 assoc_usage_table_fields,
-				 ", primary key (id_assoc, "
-				 "time_start))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  assoc_usage_table_fields,
+				  ", primary key (id_assoc, "
+				  "time_start))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, assoc_hour_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 assoc_usage_table_fields,
-				 ", primary key (id_assoc, "
-				 "time_start))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  assoc_usage_table_fields,
+				  ", primary key (id_assoc, "
+				  "time_start))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, assoc_month_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 assoc_usage_table_fields,
-				 ", primary key (id_assoc, "
-				 "time_start))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  assoc_usage_table_fields,
+				  ", primary key (id_assoc, "
+				  "time_start))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, cluster_day_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 cluster_usage_table_fields,
-				 ", primary key (time_start))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  cluster_usage_table_fields,
+				  ", primary key (time_start))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, cluster_hour_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 cluster_usage_table_fields,
-				 ", primary key (time_start))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  cluster_usage_table_fields,
+				  ", primary key (time_start))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, cluster_month_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 cluster_usage_table_fields,
-				 ", primary key (time_start))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  cluster_usage_table_fields,
+				  ", primary key (time_start))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, event_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 event_table_fields,
-				 ", primary key (node_name(20), "
-				 "time_start))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  event_table_fields,
+				  ", primary key (node_name(20), "
+				  "time_start))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, job_table);
-	if(mysql_db_create_table(mysql_conn, table_name, job_table_fields,
-				 ", primary key (job_db_inx), "
-				 "unique index (id_job, "
-				 "id_assoc, time_submit))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name, job_table_fields,
+				  ", primary key (job_db_inx), "
+				  "unique index (id_job, "
+				  "id_assoc, time_submit))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, last_ran_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 last_ran_table_fields,
-				 ")")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  last_ran_table_fields,
+				  ")")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, resv_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 resv_table_fields,
-				 ", primary key (id_resv, time_start))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  resv_table_fields,
+				  ", primary key (id_resv, time_start))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, step_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 step_table_fields,
-				 ", primary key (job_db_inx, id_step))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  step_table_fields,
+				  ", primary key (job_db_inx, id_step))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, suspend_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 suspend_table_fields,
-				 ")") == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  suspend_table_fields,
+				  ")") == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
@@ -1189,7 +1189,7 @@ extern int create_cluster_tables(mysql_conn_t *mysql_conn, char *cluster_name)
 			"show columns from %s where Field='is_def';",
 			table_name);
 		debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 			xfree(query);
 			return SLURM_ERROR;
 		}
@@ -1199,39 +1199,39 @@ extern int create_cluster_tables(mysql_conn_t *mysql_conn, char *cluster_name)
 		result = NULL;
 	}
 
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 wckey_table_fields,
-				 ", primary key (id_wckey), "
-				 " unique index (wckey_name(20), "
-				 "user(20)))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  wckey_table_fields,
+				  ", primary key (id_wckey), "
+				  " unique index (wckey_name(20), "
+				  "user(20)))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, wckey_day_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 wckey_usage_table_fields,
-				 ", primary key (id_wckey, "
-				 "time_start))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  wckey_usage_table_fields,
+				  ", primary key (id_wckey, "
+				  "time_start))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, wckey_hour_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 wckey_usage_table_fields,
-				 ", primary key (id_wckey, "
-				 "time_start))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  wckey_usage_table_fields,
+				  ", primary key (id_wckey, "
+				  "time_start))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	snprintf(table_name, sizeof(table_name), "\"%s_%s\"",
 		 cluster_name, wckey_month_table);
-	if(mysql_db_create_table(mysql_conn, table_name,
-				 wckey_usage_table_fields,
-				 ", primary key (id_wckey, "
-				 "time_start))")
-	   == SLURM_ERROR)
+	if (mysql_db_create_table(mysql_conn, table_name,
+				  wckey_usage_table_fields,
+				  ", primary key (id_wckey, "
+				  "time_start))")
+	    == SLURM_ERROR)
 		return SLURM_ERROR;
 
 	if (!def_exist && user_table_exists)
@@ -1254,14 +1254,14 @@ extern int remove_cluster_tables(mysql_conn_t *mysql_conn, char *cluster_name)
 			       cluster_name, assoc_table);
 	debug4("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		error("no result given when querying cluster %s", cluster_name);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(mysql_num_rows(result)) {
+	if (mysql_num_rows(result)) {
 		mysql_free_result(result);
 		/* If there were any associations removed fix it up
 		   here since the table isn't going to be deleted. */
@@ -1309,10 +1309,10 @@ extern int setup_association_limits(slurmdb_association_rec_t *assoc,
 				    char **extra, qos_level_t qos_level,
 				    bool get_fs)
 {
-	if(!assoc)
+	if (!assoc)
 		return SLURM_ERROR;
 
-	if((int32_t)assoc->shares_raw >= 0) {
+	if ((int32_t)assoc->shares_raw >= 0) {
 		xstrcat(*cols, ", shares");
 		xstrfmtcat(*vals, ", %u", assoc->shares_raw);
 		xstrfmtcat(*extra, ", shares=%u", assoc->shares_raw);
@@ -1323,12 +1323,12 @@ extern int setup_association_limits(slurmdb_association_rec_t *assoc,
 		assoc->shares_raw = 1;
 	}
 
-	if(assoc->grp_cpu_mins == (uint64_t)INFINITE) {
+	if (assoc->grp_cpu_mins == (uint64_t)INFINITE) {
 		xstrcat(*cols, ", grp_cpu_mins");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_cpu_mins=NULL");
-	} else if((assoc->grp_cpu_mins != (uint64_t)NO_VAL)
-		  && ((int64_t)assoc->grp_cpu_mins >= 0)) {
+	} else if ((assoc->grp_cpu_mins != (uint64_t)NO_VAL)
+		   && ((int64_t)assoc->grp_cpu_mins >= 0)) {
 		xstrcat(*cols, ", grp_cpu_mins");
 		xstrfmtcat(*vals, ", %"PRIu64"",
 			   assoc->grp_cpu_mins);
@@ -1336,57 +1336,57 @@ extern int setup_association_limits(slurmdb_association_rec_t *assoc,
 			   assoc->grp_cpu_mins);
 	}
 
-	if(assoc->grp_cpus == INFINITE) {
+	if (assoc->grp_cpus == INFINITE) {
 		xstrcat(*cols, ", grp_cpus");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_cpus=NULL");
-	} else if((assoc->grp_cpus != NO_VAL)
-		  && ((int32_t)assoc->grp_cpus >= 0)) {
+	} else if ((assoc->grp_cpus != NO_VAL)
+		   && ((int32_t)assoc->grp_cpus >= 0)) {
 		xstrcat(*cols, ", grp_cpus");
 		xstrfmtcat(*vals, ", %u", assoc->grp_cpus);
 		xstrfmtcat(*extra, ", grp_cpus=%u", assoc->grp_cpus);
 	}
 
-	if(assoc->grp_jobs == INFINITE) {
+	if (assoc->grp_jobs == INFINITE) {
 		xstrcat(*cols, ", grp_jobs");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_jobs=NULL");
-	} else if((assoc->grp_jobs != NO_VAL)
-		  && ((int32_t)assoc->grp_jobs >= 0)) {
+	} else if ((assoc->grp_jobs != NO_VAL)
+		   && ((int32_t)assoc->grp_jobs >= 0)) {
 		xstrcat(*cols, ", grp_jobs");
 		xstrfmtcat(*vals, ", %u", assoc->grp_jobs);
 		xstrfmtcat(*extra, ", grp_jobs=%u", assoc->grp_jobs);
 	}
 
-	if(assoc->grp_nodes == INFINITE) {
+	if (assoc->grp_nodes == INFINITE) {
 		xstrcat(*cols, ", grp_nodes");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_nodes=NULL");
-	} else if((assoc->grp_nodes != NO_VAL)
-		  && ((int32_t)assoc->grp_nodes >= 0)) {
+	} else if ((assoc->grp_nodes != NO_VAL)
+		   && ((int32_t)assoc->grp_nodes >= 0)) {
 		xstrcat(*cols, ", grp_nodes");
 		xstrfmtcat(*vals, ", %u", assoc->grp_nodes);
 		xstrfmtcat(*extra, ", grp_nodes=%u", assoc->grp_nodes);
 	}
 
-	if(assoc->grp_submit_jobs == INFINITE) {
+	if (assoc->grp_submit_jobs == INFINITE) {
 		xstrcat(*cols, ", grp_submit_jobs");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_submit_jobs=NULL");
-	} else if((assoc->grp_submit_jobs != NO_VAL)
-		  && ((int32_t)assoc->grp_submit_jobs >= 0)) {
+	} else if ((assoc->grp_submit_jobs != NO_VAL)
+		   && ((int32_t)assoc->grp_submit_jobs >= 0)) {
 		xstrcat(*cols, ", grp_submit_jobs");
 		xstrfmtcat(*vals, ", %u", assoc->grp_submit_jobs);
 		xstrfmtcat(*extra, ", grp_submit_jobs=%u",
 			   assoc->grp_submit_jobs);
 	}
 
-	if(assoc->grp_wall == INFINITE) {
+	if (assoc->grp_wall == INFINITE) {
 		xstrcat(*cols, ", grp_wall");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_wall=NULL");
-	} else if((assoc->grp_wall != NO_VAL)
-		  && ((int32_t)assoc->grp_wall >= 0)) {
+	} else if ((assoc->grp_wall != NO_VAL)
+		   && ((int32_t)assoc->grp_wall >= 0)) {
 		xstrcat(*cols, ", grp_wall");
 		xstrfmtcat(*vals, ", %u", assoc->grp_wall);
 		xstrfmtcat(*extra, ", grp_wall=%u", assoc->grp_wall);
@@ -1402,12 +1402,12 @@ extern int setup_association_limits(slurmdb_association_rec_t *assoc,
 		xstrcat(*extra, ", is_def=1");
 	}
 
-	if(assoc->max_cpu_mins_pj == (uint64_t)INFINITE) {
+	if (assoc->max_cpu_mins_pj == (uint64_t)INFINITE) {
 		xstrcat(*cols, ", max_cpu_mins_pj");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_cpu_mins_pj=NULL");
-	} else if((assoc->max_cpu_mins_pj != (uint64_t)NO_VAL)
-		  && ((int64_t)assoc->max_cpu_mins_pj >= 0)) {
+	} else if ((assoc->max_cpu_mins_pj != (uint64_t)NO_VAL)
+		   && ((int64_t)assoc->max_cpu_mins_pj >= 0)) {
 		xstrcat(*cols, ", max_cpu_mins_pj");
 		xstrfmtcat(*vals, ", %"PRIu64"",
 			   assoc->max_cpu_mins_pj);
@@ -1415,70 +1415,70 @@ extern int setup_association_limits(slurmdb_association_rec_t *assoc,
 			   assoc->max_cpu_mins_pj);
 	}
 
-	if(assoc->max_cpus_pj == INFINITE) {
+	if (assoc->max_cpus_pj == INFINITE) {
 		xstrcat(*cols, ", max_cpus_pj");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_cpus_pj=NULL");
-	} else if((assoc->max_cpus_pj != NO_VAL)
-		  && ((int32_t)assoc->max_cpus_pj >= 0)) {
+	} else if ((assoc->max_cpus_pj != NO_VAL)
+		   && ((int32_t)assoc->max_cpus_pj >= 0)) {
 		xstrcat(*cols, ", max_cpus_pj");
 		xstrfmtcat(*vals, ", %u", assoc->max_cpus_pj);
 		xstrfmtcat(*extra, ", max_cpus_pj=%u", assoc->max_cpus_pj);
 	}
 
-	if(assoc->max_jobs == INFINITE) {
+	if (assoc->max_jobs == INFINITE) {
 		xstrcat(*cols, ", max_jobs");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_jobs=NULL");
-	} else if((assoc->max_jobs != NO_VAL)
-		  && ((int32_t)assoc->max_jobs >= 0)) {
+	} else if ((assoc->max_jobs != NO_VAL)
+		   && ((int32_t)assoc->max_jobs >= 0)) {
 		xstrcat(*cols, ", max_jobs");
 		xstrfmtcat(*vals, ", %u", assoc->max_jobs);
 		xstrfmtcat(*extra, ", max_jobs=%u", assoc->max_jobs);
 	}
 
-	if(assoc->max_nodes_pj == INFINITE) {
+	if (assoc->max_nodes_pj == INFINITE) {
 		xstrcat(*cols, ", max_nodes_pj");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_nodes_pj=NULL");
-	} else if((assoc->max_nodes_pj != NO_VAL)
-		  && ((int32_t)assoc->max_nodes_pj >= 0)) {
+	} else if ((assoc->max_nodes_pj != NO_VAL)
+		   && ((int32_t)assoc->max_nodes_pj >= 0)) {
 		xstrcat(*cols, ", max_nodes_pj");
 		xstrfmtcat(*vals, ", %u", assoc->max_nodes_pj);
 		xstrfmtcat(*extra, ", max_nodes_pj=%u", assoc->max_nodes_pj);
 	}
 
-	if(assoc->max_submit_jobs == INFINITE) {
+	if (assoc->max_submit_jobs == INFINITE) {
 		xstrcat(*cols, ", max_submit_jobs");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_submit_jobs=NULL");
-	} else if((assoc->max_submit_jobs != NO_VAL)
-		  && ((int32_t)assoc->max_submit_jobs >= 0)) {
+	} else if ((assoc->max_submit_jobs != NO_VAL)
+		   && ((int32_t)assoc->max_submit_jobs >= 0)) {
 		xstrcat(*cols, ", max_submit_jobs");
 		xstrfmtcat(*vals, ", %u", assoc->max_submit_jobs);
 		xstrfmtcat(*extra, ", max_submit_jobs=%u",
 			   assoc->max_submit_jobs);
 	}
 
-	if(assoc->max_wall_pj == INFINITE) {
+	if (assoc->max_wall_pj == INFINITE) {
 		xstrcat(*cols, ", max_wall_pj");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_wall_pj=NULL");
-	} else if((assoc->max_wall_pj != NO_VAL)
-		  && ((int32_t)assoc->max_wall_pj >= 0)) {
+	} else if ((assoc->max_wall_pj != NO_VAL)
+		   && ((int32_t)assoc->max_wall_pj >= 0)) {
 		xstrcat(*cols, ", max_wall_pj");
 		xstrfmtcat(*vals, ", %u", assoc->max_wall_pj);
 		xstrfmtcat(*extra, ", max_wall_pj=%u", assoc->max_wall_pj);
 	}
 
-	if(assoc->def_qos_id == INFINITE) {
+	if (assoc->def_qos_id == INFINITE) {
 		xstrcat(*cols, ", def_qos_id");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", def_qos_id=NULL");
 		/* 0 is the no def_qos_id, so it that way */
 		assoc->def_qos_id = 0;
-	} else if((assoc->def_qos_id != NO_VAL)
-		  && ((int32_t)assoc->def_qos_id > 0)) {
+	} else if ((assoc->def_qos_id != NO_VAL)
+		   && ((int32_t)assoc->def_qos_id > 0)) {
 		xstrcat(*cols, ", def_qos_id");
 		xstrfmtcat(*vals, ", %u", assoc->def_qos_id);
 		xstrfmtcat(*extra, ", def_qos_id=%u", assoc->def_qos_id);
@@ -1486,10 +1486,10 @@ extern int setup_association_limits(slurmdb_association_rec_t *assoc,
 
 	/* when modifying the qos it happens in the actual function
 	   since we have to wait until we hear about the parent first. */
-	if(qos_level == QOS_LEVEL_MODIFY)
+	if (qos_level == QOS_LEVEL_MODIFY)
 		goto end_qos;
 
-	if(assoc->qos_list && list_count(assoc->qos_list)) {
+	if (assoc->qos_list && list_count(assoc->qos_list)) {
 		char *qos_type = "qos";
 		char *qos_val = NULL;
 		char *tmp_char = NULL;
@@ -1497,12 +1497,12 @@ extern int setup_association_limits(slurmdb_association_rec_t *assoc,
 		ListIterator qos_itr =
 			list_iterator_create(assoc->qos_list);
 
-		while((tmp_char = list_next(qos_itr))) {
+		while ((tmp_char = list_next(qos_itr))) {
 			/* we don't want to include blank names */
-			if(!tmp_char[0])
+			if (!tmp_char[0])
 				continue;
-			if(!set) {
-				if(tmp_char[0] == '+' || tmp_char[0] == '-')
+			if (!set) {
+				if (tmp_char[0] == '+' || tmp_char[0] == '-')
 					qos_type = "delta_qos";
 				set = 1;
 			}
@@ -1510,18 +1510,18 @@ extern int setup_association_limits(slurmdb_association_rec_t *assoc,
 		}
 
 		list_iterator_destroy(qos_itr);
-		if(qos_val) {
+		if (qos_val) {
 			xstrfmtcat(*cols, ", %s", qos_type);
 			xstrfmtcat(*vals, ", '%s'", qos_val);
 			xstrfmtcat(*extra, ", %s='%s'", qos_type, qos_val);
 			xfree(qos_val);
 		}
-	} else if((qos_level == QOS_LEVEL_SET) && default_qos_str) {
+	} else if ((qos_level == QOS_LEVEL_SET) && default_qos_str) {
 		/* Add default qos to the account */
 		xstrcat(*cols, ", qos");
 		xstrfmtcat(*vals, ", '%s'", default_qos_str);
 		xstrfmtcat(*extra, ", qos='%s'", default_qos_str);
-		if(!assoc->qos_list)
+		if (!assoc->qos_list)
 			assoc->qos_list = list_create(slurm_destroy_char);
 		slurm_addto_char_list(assoc->qos_list, default_qos_str);
 	} else {
@@ -1555,15 +1555,15 @@ extern int modify_common(mysql_conn_t *mysql_conn,
 	bool cluster_centric = true;
 
 	/* figure out which tables we need to append the cluster name to */
-	if((table == cluster_table) || (table == acct_coord_table)
-	   || (table == acct_table) || (table == qos_table)
-	   || (table == txn_table) || (table == user_table))
+	if ((table == cluster_table) || (table == acct_coord_table)
+	    || (table == acct_table) || (table == qos_table)
+	    || (table == txn_table) || (table == user_table))
 		cluster_centric = false;
 
-	if(vals[1])
+	if (vals[1])
 		tmp_vals = slurm_add_slash_to_quotes(vals+2);
 
-	if(cluster_centric) {
+	if (cluster_centric) {
 		xassert(cluster_name);
 		xstrfmtcat(query,
 			   "update \"%s_%s\" set mod_time=%ld%s "
@@ -1595,7 +1595,7 @@ extern int modify_common(mysql_conn_t *mysql_conn,
 	rc = mysql_db_query(mysql_conn, query);
 	xfree(query);
 
-	if(rc != SLURM_SUCCESS) {
+	if (rc != SLURM_SUCCESS) {
 		reset_mysql_conn(mysql_conn);
 		return SLURM_ERROR;
 	}
@@ -1627,36 +1627,36 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 	uint32_t smallest_lft = 0xFFFFFFFF;
 
 	/* figure out which tables we need to append the cluster name to */
-	if((table == cluster_table) || (table == acct_coord_table)
-	   || (table == acct_table) || (table == qos_table)
-	   || (table == txn_table) || (table == user_table))
+	if ((table == cluster_table) || (table == acct_coord_table)
+	    || (table == acct_table) || (table == qos_table)
+	    || (table == txn_table) || (table == user_table))
 		cluster_centric = false;
 
 	/* If we have jobs associated with this we do not want to
 	 * really delete it for accounting purposes.  This is for
 	 * corner cases most of the time this won't matter.
 	 */
-	if(table == acct_coord_table) {
+	if (table == acct_coord_table) {
 		/* This doesn't apply for these tables since we are
 		 * only looking for association type tables.
 		 */
-	} else if((table == qos_table) || (table == wckey_table)) {
+	} else if ((table == qos_table) || (table == wckey_table)) {
 		has_jobs = _check_jobs_before_remove_without_assoctable(
 			mysql_conn, cluster_name, assoc_char);
-	} else if(table != assoc_table) {
+	} else if (table != assoc_table) {
 		/* first check to see if we are running jobs now */
-		if(_check_jobs_before_remove(
-			   mysql_conn, cluster_name, assoc_char,
-			   ret_list, jobs_running) || (*jobs_running))
+		if (_check_jobs_before_remove(
+			    mysql_conn, cluster_name, assoc_char,
+			    ret_list, jobs_running) || (*jobs_running))
 			return SLURM_SUCCESS;
 
 		has_jobs = _check_jobs_before_remove(
 			mysql_conn, cluster_name, assoc_char, NULL, NULL);
 	} else {
 		/* first check to see if we are running jobs now */
-		if(_check_jobs_before_remove_assoc(
-			   mysql_conn, cluster_name, name_char,
-			   ret_list, jobs_running) || (*jobs_running))
+		if (_check_jobs_before_remove_assoc(
+			    mysql_conn, cluster_name, name_char,
+			    ret_list, jobs_running) || (*jobs_running))
 			return SLURM_SUCCESS;
 
 		/* now check to see if any jobs were ever run. */
@@ -1665,8 +1665,8 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 			NULL, NULL);
 	}
 	/* we want to remove completely all that is less than a day old */
-	if(!has_jobs && table != assoc_table) {
-		if(cluster_centric) {
+	if (!has_jobs && table != assoc_table) {
+		if (cluster_centric) {
 			query = xstrdup_printf("delete from \"%s_%s\" where "
 					       "creation_time>%ld && (%s);",
 					       cluster_name, table, day_old,
@@ -1688,8 +1688,8 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 		}
 	}
 
-	if(table != assoc_table) {
-		if(cluster_centric)
+	if (table != assoc_table) {
+		if (cluster_centric)
 			xstrfmtcat(query,
 				   "update \"%s_%s\" set mod_time=%ld, "
 				   "deleted=1 where deleted=0 && (%s);",
@@ -1706,12 +1706,12 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 	   time.  The assoc_char has the actual ids of the assocs
 	   which never change.
 	*/
-	if(type == DBD_REMOVE_ASSOCS && assoc_char)
+	if (type == DBD_REMOVE_ASSOCS && assoc_char)
 		tmp_name_char = slurm_add_slash_to_quotes(assoc_char);
 	else
 		tmp_name_char = slurm_add_slash_to_quotes(name_char);
 
-	if(cluster_centric)
+	if (cluster_centric)
 		xstrfmtcat(query,
 			   "insert into %s (timestamp, action, name, "
 			   "actor, cluster) values "
@@ -1731,20 +1731,20 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
 	rc = mysql_db_query(mysql_conn, query);
 	xfree(query);
-	if(rc != SLURM_SUCCESS) {
+	if (rc != SLURM_SUCCESS) {
 		reset_mysql_conn(mysql_conn);
 		return SLURM_ERROR;
-	} else if((table == acct_coord_table)
-		  || (table == qos_table)
-		  || (table == wckey_table))
+	} else if ((table == acct_coord_table)
+		   || (table == qos_table)
+		   || (table == wckey_table))
 		return SLURM_SUCCESS;
 
 	/* mark deleted=1 or remove completely the accounting tables
 	 */
-	if(table != assoc_table) {
-		if(!assoc_char) {
+	if (table != assoc_table) {
+		if (!assoc_char) {
 			error("no assoc_char");
-			if(mysql_conn->rollback) {
+			if (mysql_conn->rollback) {
 				mysql_db_rollback(mysql_conn);
 			}
 			list_flush(mysql_conn->update_list);
@@ -1763,10 +1763,10 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
-			if(mysql_conn->rollback) {
+			if (mysql_conn->rollback) {
 				mysql_db_rollback(mysql_conn);
 			}
 			list_flush(mysql_conn->update_list);
@@ -1776,25 +1776,25 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 
 		rc = 0;
 		loc_assoc_char = NULL;
-		while((row = mysql_fetch_row(result))) {
+		while ((row = mysql_fetch_row(result))) {
 			slurmdb_association_rec_t *rem_assoc = NULL;
-			if(loc_assoc_char)
+			if (loc_assoc_char)
 				xstrcat(loc_assoc_char, " || ");
 			xstrfmtcat(loc_assoc_char, "id_assoc=%s", row[0]);
 
 			rem_assoc = xmalloc(sizeof(slurmdb_association_rec_t));
 			rem_assoc->id = slurm_atoul(row[0]);
 			rem_assoc->cluster = xstrdup(cluster_name);
-			if(addto_update_list(mysql_conn->update_list,
-					     SLURMDB_REMOVE_ASSOC,
-					     rem_assoc) != SLURM_SUCCESS)
+			if (addto_update_list(mysql_conn->update_list,
+					      SLURMDB_REMOVE_ASSOC,
+					      rem_assoc) != SLURM_SUCCESS)
 				error("couldn't add to the update list");
 		}
 		mysql_free_result(result);
 	} else
 		loc_assoc_char = assoc_char;
 
-	if(!loc_assoc_char) {
+	if (!loc_assoc_char) {
 		debug2("No associations with object being deleted");
 		return rc;
 	}
@@ -1814,7 +1814,7 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 	       mysql_conn->conn, THIS_FILE, __LINE__, query, strlen(query));
 	rc = mysql_db_query(mysql_conn, query);
 	xfree(query);
-	if(rc != SLURM_SUCCESS) {
+	if (rc != SLURM_SUCCESS) {
 		reset_mysql_conn(mysql_conn);
 		return SLURM_ERROR;
 	}
@@ -1823,7 +1823,7 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 	 * removing the associations. Since we may want them for
 	 * reports in the future since jobs had ran.
 	 */
-	if(has_jobs)
+	if (has_jobs)
 		goto just_update;
 
 	/* remove completely all the associations for this added in the last
@@ -1837,15 +1837,15 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		reset_mysql_conn(mysql_conn);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		MYSQL_RES *result2 = NULL;
 		MYSQL_ROW row2;
 		uint32_t lft;
@@ -1860,14 +1860,14 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 			   cluster_name, assoc_table, row[0]);
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result2 = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result2 = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
 			rc = SLURM_ERROR;
 			break;
 		}
 		xfree(query);
-		if(!(row2 = mysql_fetch_row(result2))) {
+		if (!(row2 = mysql_fetch_row(result2))) {
 			mysql_free_result(result2);
 			continue;
 		}
@@ -1885,7 +1885,7 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 			   cluster_name, assoc_table, row2[2], row2[1]);
 
 		lft = slurm_atoul(row2[0]);
-		if(lft < smallest_lft)
+		if (lft < smallest_lft)
 			smallest_lft = lft;
 
 		mysql_free_result(result2);
@@ -1894,7 +1894,7 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("couldn't remove assoc");
 			break;
 		}
@@ -1904,11 +1904,11 @@ extern int remove_common(mysql_conn_t *mysql_conn,
 	   since the first time we ran it we didn't know if we were
 	   going to remove the above associations.
 	*/
-	if(rc == SLURM_SUCCESS)
+	if (rc == SLURM_SUCCESS)
 		rc = as_mysql_get_modified_lfts(mysql_conn,
 						cluster_name, smallest_lft);
 
-	if(rc == SLURM_ERROR) {
+	if (rc == SLURM_ERROR) {
 		reset_mysql_conn(mysql_conn);
 		return rc;
 	}
@@ -1931,21 +1931,21 @@ just_update:
 
 	/* if we are removing a cluster table this is handled in
 	   remove_cluster_tables if table still exists. */
-	if(table != cluster_table) {
+	if (table != cluster_table) {
 		/* Make sure the next id we get doesn't create holes
 		 * in the ids. */
 		xstrfmtcat(mysql_conn->pre_commit_query,
 			   "alter table \"%s_%s\" AUTO_INCREMENT=0;",
 			   cluster_name, assoc_table);
 	}
-	if(table != assoc_table)
+	if (table != assoc_table)
 		xfree(loc_assoc_char);
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
 	rc = mysql_db_query(mysql_conn, query);
 	xfree(query);
-	if(rc != SLURM_SUCCESS) {
+	if (rc != SLURM_SUCCESS) {
 		reset_mysql_conn(mysql_conn);
 	}
 
@@ -1964,12 +1964,12 @@ extern int init ( void )
 
 	/* since this can be loaded from many different places
 	   only tell us once. */
-	if(!first)
+	if (!first)
 		return SLURM_SUCCESS;
 
 	first = 0;
 
-	if(!slurmdbd_conf) {
+	if (!slurmdbd_conf) {
 		char *cluster_name = NULL;
 		if (!(cluster_name = slurm_get_cluster_name()))
 			fatal("%s requires ClusterName in slurm.conf",
@@ -1982,8 +1982,8 @@ extern int init ( void )
 
 	debug2("mysql_connect() called for db %s", mysql_db_name);
 	mysql_conn = create_mysql_conn(0, 0, NULL);
-	if(mysql_db_get_db_connection(mysql_conn, mysql_db_name, mysql_db_info)
-	   != SLURM_SUCCESS)
+	if (mysql_db_get_db_connection(mysql_conn, mysql_db_name, mysql_db_info)
+	    != SLURM_SUCCESS)
 		fatal("The database must be up when starting "
 		      "the MYSQL plugin.");
 
@@ -1991,18 +1991,18 @@ extern int init ( void )
 	mysql_autocommit(mysql_conn->db_conn, 0);
 	rc = mysql_db_query(mysql_conn,
 			    "SET session sql_mode='ANSI_QUOTES';");
-	if(rc == SLURM_SUCCESS)
+	if (rc == SLURM_SUCCESS)
 		rc = _as_mysql_acct_check_tables(mysql_conn);
 
-	if(rc == SLURM_SUCCESS) {
-		if(mysql_db_commit(mysql_conn)) {
+	if (rc == SLURM_SUCCESS) {
+		if (mysql_db_commit(mysql_conn)) {
 			error("commit failed, meaning %s failed", plugin_name);
 			rc = SLURM_ERROR;
 		} else
 			verbose("%s loaded", plugin_name);
 	} else {
 		verbose("%s failed", plugin_name);
-		if(mysql_db_rollback(mysql_conn))
+		if (mysql_db_rollback(mysql_conn))
 			error("rollback failed");
 	}
 
@@ -2048,11 +2048,11 @@ extern void *acct_storage_p_get_connection(const slurm_trigger_callbacks_t *cb,
 
        	if (mysql_conn->db_conn) {
 		int rc;
-		if(rollback)
+		if (rollback)
 			mysql_autocommit(mysql_conn->db_conn, 0);
 		rc = mysql_db_query(mysql_conn,
 				    "SET session sql_mode='ANSI_QUOTES';");
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("couldn't set sql_mode");
 			acct_storage_p_close_connection(&mysql_conn);
 			errno = rc;
@@ -2066,7 +2066,7 @@ extern int acct_storage_p_close_connection(mysql_conn_t **mysql_conn)
 {
 	int rc;
 
-	if(!mysql_conn || !(*mysql_conn))
+	if (!mysql_conn || !(*mysql_conn))
 		return SLURM_SUCCESS;
 
 	acct_storage_p_commit((*mysql_conn), 0);
@@ -2081,14 +2081,14 @@ extern int acct_storage_p_commit(mysql_conn_t *mysql_conn, bool commit)
 	int rc = check_connection(mysql_conn);
 	/* always reset this here */
 	mysql_conn->cluster_deleted = 0;
-	if((rc != SLURM_SUCCESS) && (rc != ESLURM_CLUSTER_DELETED))
+	if ((rc != SLURM_SUCCESS) && (rc != ESLURM_CLUSTER_DELETED))
 		return rc;
 
 	debug4("got %d commits", list_count(mysql_conn->update_list));
 
-	if(mysql_conn->rollback) {
-		if(!commit) {
-			if(mysql_db_rollback(mysql_conn))
+	if (mysql_conn->rollback) {
+		if (!commit) {
+			if (mysql_db_rollback(mysql_conn))
 				error("rollback failed");
 		} else {
 			int rc = SLURM_SUCCESS;
@@ -2098,7 +2098,7 @@ extern int acct_storage_p_commit(mysql_conn_t *mysql_conn, bool commit)
 			   AUTO_INCREMENT will make it so you can't
 			   rollback, save it until right at the end.
 			*/
-			if(mysql_conn->pre_commit_query) {
+			if (mysql_conn->pre_commit_query) {
 				debug3("%d(%d) query\n%s",
 				       mysql_conn->conn, __LINE__,
 				       mysql_conn->pre_commit_query);
@@ -2107,17 +2107,17 @@ extern int acct_storage_p_commit(mysql_conn_t *mysql_conn, bool commit)
 					mysql_conn->pre_commit_query);
 			}
 
-			if(rc != SLURM_SUCCESS) {
-				if(mysql_db_rollback(mysql_conn))
+			if (rc != SLURM_SUCCESS) {
+				if (mysql_db_rollback(mysql_conn))
 					error("rollback failed");
 			} else {
-				if(mysql_db_commit(mysql_conn))
+				if (mysql_db_commit(mysql_conn))
 					error("commit failed");
 			}
 		}
 	}
 
-	if(commit && list_count(mysql_conn->update_list)) {
+	if (commit && list_count(mysql_conn->update_list)) {
 		int rc;
 		char *query = NULL;
 		MYSQL_RES *result = NULL;
@@ -2131,13 +2131,13 @@ extern int acct_storage_p_commit(mysql_conn_t *mysql_conn, bool commit)
 			   "name, rpc_version "
 			   "from %s where deleted=0 && control_port != 0",
 			   cluster_table);
-		if(!(result = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
 			goto skip;
 		}
 		xfree(query);
-		while((row = mysql_fetch_row(result))) {
+		while ((row = mysql_fetch_row(result))) {
 			rc = send_accounting_update(mysql_conn->update_list,
 						    row[2], row[0],
 						    slurm_atoul(row[1]),
@@ -2150,18 +2150,18 @@ extern int acct_storage_p_commit(mysql_conn_t *mysql_conn, bool commit)
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 		itr2 = list_iterator_create(as_mysql_cluster_list);
 		itr = list_iterator_create(mysql_conn->update_list);
-		while((object = list_next(itr))) {
-			if(!object->objects || !list_count(object->objects))
+		while ((object = list_next(itr))) {
+			if (!object->objects || !list_count(object->objects))
 				continue;
 			/* We only care about clusters removed here. */
 			switch(object->type) {
 			case SLURMDB_REMOVE_CLUSTER:
 				itr3 = list_iterator_create(object->objects);
-				while((rem_cluster = list_next(itr3))) {
-					while((cluster_name =
-					       list_next(itr2))) {
-						if(!strcmp(cluster_name,
-							   rem_cluster)) {
+				while ((rem_cluster = list_next(itr3))) {
+					while ((cluster_name =
+						list_next(itr2))) {
+						if (!strcmp(cluster_name,
+							    rem_cluster)) {
 							list_delete_item(itr2);
 							break;
 						}
@@ -2178,7 +2178,7 @@ extern int acct_storage_p_commit(mysql_conn_t *mysql_conn, bool commit)
 		list_iterator_destroy(itr2);
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
-		if(get_qos_count)
+		if (get_qos_count)
 			_set_qos_cnt(mysql_conn);
 	}
 	xfree(mysql_conn->pre_commit_query);
@@ -2383,21 +2383,21 @@ extern List acct_storage_p_get_problems(mysql_conn_t *mysql_conn, uint32_t uid,
 {
 	List ret_list = NULL;
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	ret_list = list_create(slurmdb_destroy_association_rec);
 
-	if(as_mysql_acct_no_assocs(mysql_conn, assoc_cond, ret_list)
-	   != SLURM_SUCCESS)
+	if (as_mysql_acct_no_assocs(mysql_conn, assoc_cond, ret_list)
+	    != SLURM_SUCCESS)
 		goto end_it;
 
-	if(as_mysql_acct_no_users(mysql_conn, assoc_cond, ret_list)
-	   != SLURM_SUCCESS)
+	if (as_mysql_acct_no_users(mysql_conn, assoc_cond, ret_list)
+	    != SLURM_SUCCESS)
 		goto end_it;
 
-	if(as_mysql_user_no_assocs_or_no_uid(mysql_conn, assoc_cond, ret_list)
-	   != SLURM_SUCCESS)
+	if (as_mysql_user_no_assocs_or_no_uid(mysql_conn, assoc_cond, ret_list)
+	    != SLURM_SUCCESS)
 		goto end_it;
 
 end_it:
@@ -2455,7 +2455,7 @@ extern int clusteracct_storage_p_node_down(mysql_conn_t *mysql_conn,
 					   time_t event_time, char *reason,
 					   uint32_t reason_uid)
 {
-	if(!mysql_conn->cluster_name) {
+	if (!mysql_conn->cluster_name) {
 		error("%s:%d no cluster name", THIS_FILE, __LINE__);
 		return SLURM_ERROR;
 	}
@@ -2468,7 +2468,7 @@ extern int clusteracct_storage_p_node_up(mysql_conn_t *mysql_conn,
 					 struct node_record *node_ptr,
 					 time_t event_time)
 {
-	if(!mysql_conn->cluster_name) {
+	if (!mysql_conn->cluster_name) {
 		error("%s:%d no cluster name", THIS_FILE, __LINE__);
 		return SLURM_ERROR;
 	}
@@ -2482,7 +2482,7 @@ extern int clusteracct_storage_p_node_up(mysql_conn_t *mysql_conn,
 extern int clusteracct_storage_p_register_ctld(mysql_conn_t *mysql_conn,
 					       uint16_t port)
 {
-	if(!mysql_conn->cluster_name) {
+	if (!mysql_conn->cluster_name) {
 		error("%s:%d no cluster name", THIS_FILE, __LINE__);
 		return SLURM_ERROR;
 	}
@@ -2496,7 +2496,7 @@ extern int clusteracct_storage_p_cluster_cpus(mysql_conn_t *mysql_conn,
 					      uint32_t cpus,
 					      time_t event_time)
 {
-	if(!mysql_conn->cluster_name) {
+	if (!mysql_conn->cluster_name) {
 		error("%s:%d no cluster name", THIS_FILE, __LINE__);
 		return SLURM_ERROR;
 	}
@@ -2561,7 +2561,7 @@ extern List jobacct_storage_p_get_jobs_cond(mysql_conn_t *mysql_conn,
 {
 	List job_list = NULL;
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS) {
+	if (check_connection(mysql_conn) != SLURM_SUCCESS) {
 		return NULL;
 	}
 	job_list = as_mysql_jobacct_process_get_jobs(mysql_conn, uid, job_cond);
@@ -2575,7 +2575,7 @@ extern List jobacct_storage_p_get_jobs_cond(mysql_conn_t *mysql_conn,
 extern int jobacct_storage_p_archive(mysql_conn_t *mysql_conn,
 				     slurmdb_archive_cond_t *arch_cond)
 {
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	return as_mysql_jobacct_process_archive(mysql_conn, arch_cond);
@@ -2587,7 +2587,7 @@ extern int jobacct_storage_p_archive(mysql_conn_t *mysql_conn,
 extern int jobacct_storage_p_archive_load(mysql_conn_t *mysql_conn,
 					  slurmdb_archive_rec_t *arch_rec)
 {
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	return as_mysql_jobacct_process_archive_load(mysql_conn, arch_rec);
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_acct.c b/src/plugins/accounting_storage/mysql/as_mysql_acct.c
index a8af5fa0057..6065f51610d 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_acct.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_acct.c
@@ -53,25 +53,25 @@ static int _get_account_coords(mysql_conn_t *mysql_conn,
 	MYSQL_ROW row;
 	ListIterator itr;
 
-	if(!acct) {
+	if (!acct) {
 		error("We need a account to fill in.");
 		return SLURM_ERROR;
 	}
 
-	if(!acct->coordinators)
+	if (!acct->coordinators)
 		acct->coordinators = list_create(slurmdb_destroy_coord_rec);
 
 	query = xstrdup_printf(
 		"select user from %s where acct='%s' && deleted=0",
 		acct_coord_table, acct->name);
 
-	if(!(result =
-	     mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result =
+	      mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		coord = xmalloc(sizeof(slurmdb_coord_rec_t));
 		list_append(acct->coordinators, coord);
 		coord->name = xstrdup(row[0]);
@@ -81,8 +81,8 @@ static int _get_account_coords(mysql_conn_t *mysql_conn,
 
 	slurm_mutex_lock(&as_mysql_cluster_list_lock);
 	itr = list_iterator_create(as_mysql_cluster_list);
-	while((cluster_name = list_next(itr))) {
-		if(query)
+	while ((cluster_name = list_next(itr))) {
+		if (query)
 			xstrcat(query, " union ");
 		xstrfmtcat(query,
 			   "select distinct t0.user from %s as t0, "
@@ -98,18 +98,18 @@ static int _get_account_coords(mysql_conn_t *mysql_conn,
 	list_iterator_destroy(itr);
 	slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
-	if(!query) {
+	if (!query) {
 		error("No clusters defined?  How could there be accts?");
 		return SLURM_SUCCESS;
 	}
 	xstrcat(query, ";");
 
-	if(!(result =  mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result =  mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		coord = xmalloc(sizeof(slurmdb_coord_rec_t));
 		list_append(acct->coordinators, coord);
 		coord->name = xstrdup(row[0]);
@@ -132,15 +132,15 @@ extern int as_mysql_add_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 	int affect_rows = 0;
 	List assoc_list = list_create(slurmdb_destroy_association_rec);
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	user_name = uid_to_string((uid_t) uid);
 	itr = list_iterator_create(acct_list);
-	while((object = list_next(itr))) {
-		if(!object->name || !object->name[0]
-		   || !object->description || !object->description[0]
-		   || !object->organization || !object->organization[0]) {
+	while ((object = list_next(itr))) {
+		if (!object->name || !object->name[0]
+		    || !object->description || !object->description[0]
+		    || !object->organization || !object->organization[0]) {
 			error("We need an account name, description, and "
 			      "organization to add. %s %s %s",
 			      object->name, object->description,
@@ -167,7 +167,7 @@ extern int as_mysql_add_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 		xfree(cols);
 		xfree(vals);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't add acct");
 			xfree(extra);
 			continue;
@@ -175,7 +175,7 @@ extern int as_mysql_add_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 		affect_rows = last_affected_rows(mysql_conn);
 /* 		debug3("affected %d", affect_rows); */
 
-		if(!affect_rows) {
+		if (!affect_rows) {
 			debug3("nothing changed");
 			xfree(extra);
 			continue;
@@ -184,7 +184,7 @@ extern int as_mysql_add_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 		/* we always have a ', ' as the first 2 chars */
 		tmp_extra = slurm_add_slash_to_quotes(extra+2);
 
-		if(txn_query)
+		if (txn_query)
 			xstrfmtcat(txn_query,
 				   ", (%ld, %u, '%s', '%s', '%s')",
 				   now, DBD_ADD_ACCOUNTS, object->name,
@@ -200,7 +200,7 @@ extern int as_mysql_add_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 		xfree(tmp_extra);
 		xfree(extra);
 
-		if(!object->assoc_list)
+		if (!object->assoc_list)
 			continue;
 
 		list_transfer(assoc_list, object->assoc_list);
@@ -208,13 +208,13 @@ extern int as_mysql_add_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 	list_iterator_destroy(itr);
 	xfree(user_name);
 
-	if(rc != SLURM_ERROR) {
-		if(txn_query) {
+	if (rc != SLURM_ERROR) {
+		if (txn_query) {
 			xstrcat(txn_query, ";");
 			rc = mysql_db_query(mysql_conn,
 					    txn_query);
 			xfree(txn_query);
-			if(rc != SLURM_SUCCESS) {
+			if (rc != SLURM_SUCCESS) {
 				error("Couldn't add txn");
 				rc = SLURM_SUCCESS;
 			}
@@ -222,9 +222,9 @@ extern int as_mysql_add_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 	} else
 		xfree(txn_query);
 
-	if(list_count(assoc_list)) {
-		if(as_mysql_add_assocs(mysql_conn, uid, assoc_list)
-		   == SLURM_ERROR) {
+	if (list_count(assoc_list)) {
+		if (as_mysql_add_assocs(mysql_conn, uid, assoc_list)
+		    == SLURM_ERROR) {
 			error("Problem adding user associations");
 			rc = SLURM_ERROR;
 		}
@@ -235,8 +235,8 @@ extern int as_mysql_add_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 }
 
 extern List as_mysql_modify_accts(mysql_conn_t *mysql_conn, uint32_t uid,
-			       slurmdb_account_cond_t *acct_cond,
-			       slurmdb_account_rec_t *acct)
+				  slurmdb_account_cond_t *acct_cond,
+				  slurmdb_account_rec_t *acct)
 {
 	ListIterator itr = NULL;
 	List ret_list = NULL;
@@ -249,23 +249,23 @@ extern List as_mysql_modify_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 	MYSQL_RES *result = NULL;
 	MYSQL_ROW row;
 
-	if(!acct_cond || !acct) {
+	if (!acct_cond || !acct) {
 		error("we need something to change");
 		return NULL;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	xstrcat(extra, "where deleted=0");
-	if(acct_cond->assoc_cond
-	   && acct_cond->assoc_cond->acct_list
-	   && list_count(acct_cond->assoc_cond->acct_list)) {
+	if (acct_cond->assoc_cond
+	    && acct_cond->assoc_cond->acct_list
+	    && list_count(acct_cond->assoc_cond->acct_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(acct_cond->assoc_cond->acct_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "name='%s'", object);
 			set = 1;
@@ -274,13 +274,13 @@ extern List as_mysql_modify_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(acct_cond->description_list
-	   && list_count(acct_cond->description_list)) {
+	if (acct_cond->description_list
+	    && list_count(acct_cond->description_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(acct_cond->description_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "description='%s'", object);
 			set = 1;
@@ -289,13 +289,13 @@ extern List as_mysql_modify_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(acct_cond->organization_list
-	   && list_count(acct_cond->organization_list)) {
+	if (acct_cond->organization_list
+	    && list_count(acct_cond->organization_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(acct_cond->organization_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "organization='%s'", object);
 			set = 1;
@@ -304,12 +304,12 @@ extern List as_mysql_modify_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(acct->description)
+	if (acct->description)
 		xstrfmtcat(vals, ", description='%s'", acct->description);
-	if(acct->organization)
+	if (acct->organization)
 		xstrfmtcat(vals, ", organization='%s'", acct->organization);
 
-	if(!extra || !vals) {
+	if (!extra || !vals) {
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		error("Nothing to change");
 		return NULL;
@@ -319,8 +319,8 @@ extern List as_mysql_modify_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 	xfree(extra);
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		xfree(vals);
 		return NULL;
@@ -328,10 +328,10 @@ extern List as_mysql_modify_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	rc = 0;
 	ret_list = list_create(slurm_destroy_char);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		object = xstrdup(row[0]);
 		list_append(ret_list, object);
-		if(!rc) {
+		if (!rc) {
 			xstrfmtcat(name_char, "(name='%s'", object);
 			rc = 1;
 		} else  {
@@ -341,7 +341,7 @@ extern List as_mysql_modify_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 	}
 	mysql_free_result(result);
 
-	if(!list_count(ret_list)) {
+	if (!list_count(ret_list)) {
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		debug3("didn't effect anything\n%s", query);
 		xfree(query);
@@ -369,7 +369,7 @@ extern List as_mysql_modify_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 }
 
 extern List as_mysql_remove_accts(mysql_conn_t *mysql_conn, uint32_t uid,
-			       slurmdb_account_cond_t *acct_cond)
+				  slurmdb_account_cond_t *acct_cond)
 {
 	ListIterator itr = NULL;
 	List ret_list = NULL;
@@ -385,25 +385,25 @@ extern List as_mysql_remove_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 	MYSQL_ROW row;
 	bool jobs_running = 0;
 
-	if(!acct_cond) {
+	if (!acct_cond) {
 		error("we need something to change");
 		return NULL;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	xstrcat(extra, "where deleted=0");
-	if(acct_cond->assoc_cond
-	   && acct_cond->assoc_cond->acct_list
-	   && list_count(acct_cond->assoc_cond->acct_list)) {
+	if (acct_cond->assoc_cond
+	    && acct_cond->assoc_cond->acct_list
+	    && list_count(acct_cond->assoc_cond->acct_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(acct_cond->assoc_cond->acct_list);
-		while((object = list_next(itr))) {
-			if(!object[0])
+		while ((object = list_next(itr))) {
+			if (!object[0])
 				continue;
-			if(set)
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "name='%s'", object);
 			set = 1;
@@ -412,13 +412,13 @@ extern List as_mysql_remove_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(acct_cond->description_list
-	   && list_count(acct_cond->description_list)) {
+	if (acct_cond->description_list
+	    && list_count(acct_cond->description_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(acct_cond->description_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "description='%s'", object);
 			set = 1;
@@ -427,13 +427,13 @@ extern List as_mysql_remove_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(acct_cond->organization_list
-	   && list_count(acct_cond->organization_list)) {
+	if (acct_cond->organization_list
+	    && list_count(acct_cond->organization_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(acct_cond->organization_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "organization='%s'", object);
 			set = 1;
@@ -442,25 +442,25 @@ extern List as_mysql_remove_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(!extra) {
+	if (!extra) {
 		error("Nothing to remove");
 		return NULL;
 	}
 
 	query = xstrdup_printf("select name from %s %s;", acct_table, extra);
 	xfree(extra);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return NULL;
 	}
 
 	rc = 0;
 	ret_list = list_create(slurm_destroy_char);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		char *object = xstrdup(row[0]);
 		list_append(ret_list, object);
-		if(!rc) {
+		if (!rc) {
 			xstrfmtcat(name_char, "name='%s'", object);
 			xstrfmtcat(assoc_char, "t2.acct='%s'", object);
 			rc = 1;
@@ -471,7 +471,7 @@ extern List as_mysql_remove_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 	}
 	mysql_free_result(result);
 
-	if(!list_count(ret_list)) {
+	if (!list_count(ret_list)) {
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		debug3("didn't effect anything\n%s", query);
 		xfree(query);
@@ -482,19 +482,19 @@ extern List as_mysql_remove_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 	/* We need to remove these accounts from the coord's that have it */
 	coord_list = as_mysql_remove_coord(
 		mysql_conn, uid, ret_list, NULL);
-	if(coord_list)
+	if (coord_list)
 		list_destroy(coord_list);
 
 	user_name = uid_to_string((uid_t) uid);
 
 	slurm_mutex_lock(&as_mysql_cluster_list_lock);
 	itr = list_iterator_create(as_mysql_cluster_list);
-	while((object = list_next(itr))) {
-		if((rc = remove_common(mysql_conn, DBD_REMOVE_ACCOUNTS, now,
-				       user_name, acct_table, name_char,
-				       assoc_char, object, ret_list,
-				       &jobs_running))
-		   != SLURM_SUCCESS)
+	while ((object = list_next(itr))) {
+		if ((rc = remove_common(mysql_conn, DBD_REMOVE_ACCOUNTS, now,
+					user_name, acct_table, name_char,
+					assoc_char, object, ret_list,
+					&jobs_running))
+		    != SLURM_SUCCESS)
 			break;
 	}
 	list_iterator_destroy(itr);
@@ -508,7 +508,7 @@ extern List as_mysql_remove_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 		return NULL;
 	}
 
-	if(jobs_running)
+	if (jobs_running)
 		errno = ESLURM_JOBS_RUNNING_ON_ASSOC;
 	else
 		errno = SLURM_SUCCESS;
@@ -516,7 +516,7 @@ extern List as_mysql_remove_accts(mysql_conn_t *mysql_conn, uint32_t uid,
 }
 
 extern List as_mysql_get_accts(mysql_conn_t *mysql_conn, uid_t uid,
-			    slurmdb_account_cond_t *acct_cond)
+			       slurmdb_account_cond_t *acct_cond)
 {
 	char *query = NULL;
 	char *extra = NULL;
@@ -544,7 +544,7 @@ extern List as_mysql_get_accts(mysql_conn_t *mysql_conn, uid_t uid,
 		SLURMDB_REQ_COUNT
 	};
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	memset(&user, 0, sizeof(slurmdb_user_rec_t));
@@ -553,9 +553,9 @@ extern List as_mysql_get_accts(mysql_conn_t *mysql_conn, uid_t uid,
 	private_data = slurm_get_private_data();
 
 	if (private_data & PRIVATE_DATA_ACCOUNTS) {
-		if(!(is_admin = is_user_min_admin_level(
-			     mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
-			if(!is_user_any_coord(mysql_conn, &user)) {
+		if (!(is_admin = is_user_min_admin_level(
+			      mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
+			if (!is_user_any_coord(mysql_conn, &user)) {
 				error("Only admins/coordinators "
 				      "can look at account usage");
 				errno = ESLURM_ACCESS_DENIED;
@@ -564,24 +564,24 @@ extern List as_mysql_get_accts(mysql_conn_t *mysql_conn, uid_t uid,
 		}
 	}
 
-	if(!acct_cond) {
+	if (!acct_cond) {
 		xstrcat(extra, "where deleted=0");
 		goto empty;
 	}
 
-	if(acct_cond->with_deleted)
+	if (acct_cond->with_deleted)
 		xstrcat(extra, "where (deleted=0 || deleted=1)");
 	else
 		xstrcat(extra, "where deleted=0");
 
-	if(acct_cond->assoc_cond
-	   && acct_cond->assoc_cond->acct_list
-	   && list_count(acct_cond->assoc_cond->acct_list)) {
+	if (acct_cond->assoc_cond
+	    && acct_cond->assoc_cond->acct_list
+	    && list_count(acct_cond->assoc_cond->acct_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(acct_cond->assoc_cond->acct_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "name='%s'", object);
 			set = 1;
@@ -590,13 +590,13 @@ extern List as_mysql_get_accts(mysql_conn_t *mysql_conn, uid_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(acct_cond->description_list
-	   && list_count(acct_cond->description_list)) {
+	if (acct_cond->description_list
+	    && list_count(acct_cond->description_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(acct_cond->description_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "description='%s'", object);
 			set = 1;
@@ -605,13 +605,13 @@ extern List as_mysql_get_accts(mysql_conn_t *mysql_conn, uid_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(acct_cond->organization_list
-	   && list_count(acct_cond->organization_list)) {
+	if (acct_cond->organization_list
+	    && list_count(acct_cond->organization_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(acct_cond->organization_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "organization='%s'", object);
 			set = 1;
@@ -632,12 +632,12 @@ empty:
 	 * if this flag is set.  We also include any accounts they may be
 	 * coordinator of.
 	 */
-	if(!is_admin && (private_data & PRIVATE_DATA_ACCOUNTS)) {
+	if (!is_admin && (private_data & PRIVATE_DATA_ACCOUNTS)) {
 		slurmdb_coord_rec_t *coord = NULL;
 		set = 0;
 		itr = list_iterator_create(user.coord_accts);
-		while((coord = list_next(itr))) {
-			if(set) {
+		while ((coord = list_next(itr))) {
+			if (set) {
 				xstrfmtcat(extra, " || name='%s'",
 					   coord->name);
 			} else {
@@ -647,7 +647,7 @@ empty:
 			}
 		}
 		list_iterator_destroy(itr);
-		if(set)
+		if (set)
 			xstrcat(extra,")");
 	}
 
@@ -657,8 +657,8 @@ empty:
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return NULL;
 	}
@@ -666,30 +666,31 @@ empty:
 
 	acct_list = list_create(slurmdb_destroy_account_rec);
 
-	if(acct_cond && acct_cond->with_assocs) {
+	if (acct_cond && acct_cond->with_assocs) {
 		/* We are going to be freeing the inners of
-			   this list in the acct->name so we don't
-			   free it here
-			*/
-		if(acct_cond->assoc_cond->acct_list)
+		   this list in the acct->name so we don't
+		   free it here
+		*/
+		if (acct_cond->assoc_cond->acct_list)
 			list_destroy(acct_cond->assoc_cond->acct_list);
 		acct_cond->assoc_cond->acct_list = list_create(NULL);
 	}
 
-	while((row = mysql_fetch_row(result))) {
-		slurmdb_account_rec_t *acct = xmalloc(sizeof(slurmdb_account_rec_t));
+	while ((row = mysql_fetch_row(result))) {
+		slurmdb_account_rec_t *acct =
+			xmalloc(sizeof(slurmdb_account_rec_t));
 		list_append(acct_list, acct);
 
 		acct->name =  xstrdup(row[SLURMDB_REQ_NAME]);
 		acct->description = xstrdup(row[SLURMDB_REQ_DESC]);
 		acct->organization = xstrdup(row[SLURMDB_REQ_ORG]);
 
-		if(acct_cond && acct_cond->with_coords) {
+		if (acct_cond && acct_cond->with_coords) {
 			_get_account_coords(mysql_conn, acct);
 		}
 
-		if(acct_cond && acct_cond->with_assocs) {
-			if(!acct_cond->assoc_cond) {
+		if (acct_cond && acct_cond->with_assocs) {
+			if (!acct_cond->assoc_cond) {
 				acct_cond->assoc_cond = xmalloc(
 					sizeof(slurmdb_association_cond_t));
 			}
@@ -700,34 +701,34 @@ empty:
 	}
 	mysql_free_result(result);
 
-	if(acct_cond && acct_cond->with_assocs
-	   && list_count(acct_cond->assoc_cond->acct_list)) {
+	if (acct_cond && acct_cond->with_assocs
+	    && list_count(acct_cond->assoc_cond->acct_list)) {
 		ListIterator assoc_itr = NULL;
 		slurmdb_account_rec_t *acct = NULL;
 		slurmdb_association_rec_t *assoc = NULL;
 		List assoc_list = as_mysql_get_assocs(
 			mysql_conn, uid, acct_cond->assoc_cond);
 
-		if(!assoc_list) {
+		if (!assoc_list) {
 			error("no associations");
 			return acct_list;
 		}
 
 		itr = list_iterator_create(acct_list);
 		assoc_itr = list_iterator_create(assoc_list);
-		while((acct = list_next(itr))) {
-			while((assoc = list_next(assoc_itr))) {
-				if(strcmp(assoc->acct, acct->name))
+		while ((acct = list_next(itr))) {
+			while ((assoc = list_next(assoc_itr))) {
+				if (strcmp(assoc->acct, acct->name))
 					continue;
 
-				if(!acct->assoc_list)
+				if (!acct->assoc_list)
 					acct->assoc_list = list_create(
 						slurmdb_destroy_association_rec);
 				list_append(acct->assoc_list, assoc);
 				list_remove(assoc_itr);
 			}
 			list_iterator_reset(assoc_itr);
-			if(!acct->assoc_list)
+			if (!acct->assoc_list)
 				list_remove(itr);
 		}
 		list_iterator_destroy(itr);
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_archive.c b/src/plugins/accounting_storage/mysql/as_mysql_archive.c
index fe799c01ffc..2e79878413e 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_archive.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_archive.c
@@ -567,27 +567,27 @@ static int _process_old_sql_line(const char *data_in, char **data_full_out)
 	bool delete = 0;
 	bool new_cluster = 0;
 
-	while(data_in[i]) {
-		if(!strncmp("insert into ", data_in+i, 12)) {
+	while (data_in[i]) {
+		if (!strncmp("insert into ", data_in+i, 12)) {
 			beginning = xstrndup(data_in+i, 11);
 			i+=12;
 			break;
-		} else if(!strncmp("delete from ", data_in+i, 12)) {
+		} else if (!strncmp("delete from ", data_in+i, 12)) {
 			beginning = xstrndup(data_in+i, 11);
 			i+=12;
 			delete = 1;
 			break;
-		} else if(!strncmp("drop table ", data_in+i, 11)) {
+		} else if (!strncmp("drop table ", data_in+i, 11)) {
 			start = i;
 			i+=11;
-			while(data_in[i] && data_in[i-1] != ';')
+			while (data_in[i] && data_in[i-1] != ';')
 				i++;
 			xstrncat(data_out, data_in+start, i-start);
 			goto end_it;
-		} else if(!strncmp("truncate table ", data_in+i, 15)) {
+		} else if (!strncmp("truncate table ", data_in+i, 15)) {
 			start = i;
 			i+=15;
-			while(data_in[i] && data_in[i-1] != ';')
+			while (data_in[i] && data_in[i-1] != ';')
 				i++;
 			xstrncat(data_out, data_in+start, i-start);
 			goto end_it;
@@ -595,39 +595,39 @@ static int _process_old_sql_line(const char *data_in, char **data_full_out)
 		i++;
 	}
 
-	if(!data_in[i])
+	if (!data_in[i])
 		goto end_it;
 
 	//info("processing %s", data_in);
 	/* get table name */
-	if(!strncmp("cluster_event_table", data_in+i, 19)) {
+	if (!strncmp("cluster_event_table", data_in+i, 19)) {
 		i+=19;
 		table = event_table;
-	} else if(!strncmp("job_table", data_in+i, 9)) {
+	} else if (!strncmp("job_table", data_in+i, 9)) {
 		i+=9;
 		table = job_table;
-	} else if(!strncmp("step_table", data_in+i, 10)) {
+	} else if (!strncmp("step_table", data_in+i, 10)) {
 		i+=10;
 		table = step_table;
-	} else if(!strncmp("suspend_table", data_in+i, 13)) {
+	} else if (!strncmp("suspend_table", data_in+i, 13)) {
 		i+=13;
 		table = suspend_table;
-	} else if(!strncmp("cluster_day_usage_table", data_in+i, 23)) {
+	} else if (!strncmp("cluster_day_usage_table", data_in+i, 23)) {
 		i+=23;
 		table = cluster_day_table;
-	} else if(!strncmp("cluster_hour_usage_table", data_in+i, 24)) {
+	} else if (!strncmp("cluster_hour_usage_table", data_in+i, 24)) {
 		i+=24;
 		table = cluster_hour_table;
-	} else if(!strncmp("cluster_month_usage_table", data_in+i, 25)) {
+	} else if (!strncmp("cluster_month_usage_table", data_in+i, 25)) {
 		i+=25;
 		table = cluster_month_table;
-	} else if(!strncmp("assoc_day_usage_table", data_in+i, 21)) {
+	} else if (!strncmp("assoc_day_usage_table", data_in+i, 21)) {
 		i+=21;
 		table = assoc_day_table;
-	} else if(!strncmp("assoc_hour_usage_table", data_in+i, 22)) {
+	} else if (!strncmp("assoc_hour_usage_table", data_in+i, 22)) {
 		i+=22;
 		table = assoc_hour_table;
-	} else if(!strncmp("assoc_month_usage_table", data_in+i, 23)) {
+	} else if (!strncmp("assoc_month_usage_table", data_in+i, 23)) {
 		i+=23;
 		table = assoc_month_table;
 	} else {
@@ -636,133 +636,133 @@ static int _process_old_sql_line(const char *data_in, char **data_full_out)
 		goto end_it;
 	}
 	/* get to the columns */
-	if(!delete)
-		while(data_in[i] && data_in[i-1] != '(' && data_in[i-1] != ';')
+	if (!delete)
+		while (data_in[i] && data_in[i-1] != '(' && data_in[i-1] != ';')
 			i++;
 	else
-		while(data_in[i] && data_in[i-1] != ' ')
+		while (data_in[i] && data_in[i-1] != ' ')
 			i++;
 	//info("table is %s '%s'", table, data_in+i);
-	while(data_in[i] && data_in[i] != ')') {
-		if(delete && !strncmp("where ", data_in+i, 6)) {
+	while (data_in[i] && data_in[i] != ')') {
+		if (delete && !strncmp("where ", data_in+i, 6)) {
 			i+=6;
 			continue;
-		} else if(!strncmp("period_start", data_in+i, 12)) {
+		} else if (!strncmp("period_start", data_in+i, 12)) {
 			xstrcat(fields, "time_start");
 			i+=12;
-		} else if(!strncmp("period_end", data_in+i, 10)) {
+		} else if (!strncmp("period_end", data_in+i, 10)) {
 			xstrcat(fields, "time_end");
 			i+=10;
-		} else if(!strncmp("jobid", data_in+i, 5)) {
+		} else if (!strncmp("jobid", data_in+i, 5)) {
 			xstrcat(fields, "id_job");
 			i+=5;
-		} else if(!strncmp("stepid", data_in+i, 6)) {
+		} else if (!strncmp("stepid", data_in+i, 6)) {
 			xstrcat(fields, "id_step");
 			i+=6;
-		} else if(!strncmp("associd", data_in+i, 7)) {
+		} else if (!strncmp("associd", data_in+i, 7)) {
 			xstrcat(fields, "id_assoc");
 			i+=7;
-		} else if(!strncmp("blockid", data_in+i, 7)) {
+		} else if (!strncmp("blockid", data_in+i, 7)) {
 			xstrcat(fields, "id_block");
 			i+=7;
-		} else if(!strncmp("wckeyid", data_in+i, 7)) {
+		} else if (!strncmp("wckeyid", data_in+i, 7)) {
 			xstrcat(fields, "id_wckey");
 			i+=7;
-		} else if(!strncmp("qos", data_in+i, 3)) {
+		} else if (!strncmp("qos", data_in+i, 3)) {
 			xstrcat(fields, "id_qos");
 			i+=3;
-		} else if(!strncmp("uid", data_in+i, 3)) {
+		} else if (!strncmp("uid", data_in+i, 3)) {
 			xstrcat(fields, "id_user");
 			i+=3;
-		} else if(!strncmp("gid", data_in+i, 3)) {
+		} else if (!strncmp("gid", data_in+i, 3)) {
 			xstrcat(fields, "id_group");
 			i+=3;
-		} else if(!strncmp("submit", data_in+i, 6)) {
+		} else if (!strncmp("submit", data_in+i, 6)) {
 			xstrcat(fields, "time_submit");
 			i+=6;
-		} else if(!strncmp("eligible", data_in+i, 8)) {
+		} else if (!strncmp("eligible", data_in+i, 8)) {
 			xstrcat(fields, "time_eligible");
 			i+=8;
-		} else if(!strncmp("start", data_in+i, 5)) {
+		} else if (!strncmp("start", data_in+i, 5)) {
 			xstrcat(fields, "time_start");
 			i+=5;
-		} else if(!strncmp("suspended", data_in+i, 9)) {
+		} else if (!strncmp("suspended", data_in+i, 9)) {
 			xstrcat(fields, "time_suspended");
 			i+=9;
-		} else if(!strncmp("end", data_in+i, 3)) {
+		} else if (!strncmp("end", data_in+i, 3)) {
 			xstrcat(fields, "time_end");
 			i+=3;
-		} else if(!strncmp("comp_code", data_in+i, 9)) {
+		} else if (!strncmp("comp_code", data_in+i, 9)) {
 			xstrcat(fields, "exit_code");
 			i+=9;
-		} else if(!strncmp("alloc_cpus", data_in+i, 10)) {
+		} else if (!strncmp("alloc_cpus", data_in+i, 10)) {
 			xstrcat(fields, "cpus_alloc");
 			i+=10;
-		} else if(!strncmp("req_cpus", data_in+i, 8)) {
+		} else if (!strncmp("req_cpus", data_in+i, 8)) {
 			xstrcat(fields, "cpus_req");
 			i+=8;
-		} else if(!strncmp("alloc_nodes", data_in+i, 11)) {
+		} else if (!strncmp("alloc_nodes", data_in+i, 11)) {
 			xstrcat(fields, "nodes_alloc");
 			i+=11;
-		} else if(!strncmp("name", data_in+i, 4)) {
-			if(table == job_table)
+		} else if (!strncmp("name", data_in+i, 4)) {
+			if (table == job_table)
 				xstrcat(fields, "job_name");
-			else if(table == step_table)
+			else if (table == step_table)
 				xstrcat(fields, "step_name");
 			i+=4;
-		} else if(!strncmp("id", data_in+i, 2)) {
+		} else if (!strncmp("id", data_in+i, 2)) {
 			i+=2;
-			if((table == assoc_day_table)
-			   || (table == assoc_hour_table)
-			   || (table == assoc_month_table)) {
+			if ((table == assoc_day_table)
+			    || (table == assoc_hour_table)
+			    || (table == assoc_month_table)) {
 				char *id_assoc = NULL;
-				while(data_in[i] && data_in[i-1] != '=') {
+				while (data_in[i] && data_in[i-1] != '=') {
 					i++;
 				}
 				start = i;
-				while(data_in[i]
-				      && data_in[i] != ' '
-				      && data_in[i] != ';') {
+				while (data_in[i]
+				       && data_in[i] != ' '
+				       && data_in[i] != ';') {
 					i++;
 				}
-				if(!data_in[i]) {
+				if (!data_in[i]) {
 					error("returning at id_assoc");
 					rc = SLURM_ERROR;
 					goto end_it;
 				}
-				if(data_in[i] == ' ') {
-					while(data_in[i] && data_in[i] == ' ')
+				if (data_in[i] == ' ') {
+					while (data_in[i] && data_in[i] == ' ')
 						i++;
-					while(data_in[i] && data_in[i] == '|')
+					while (data_in[i] && data_in[i] == '|')
 						i++;
-					while(data_in[i] && data_in[i] == ' ')
+					while (data_in[i] && data_in[i] == ' ')
 						i++;
 				}
 				xstrncat(id_assoc, data_in+start, (i-start));
-				if(!fields)
+				if (!fields)
 					xstrcat(fields, "where ");
 				xstrfmtcat(fields, "id_assoc=%s", id_assoc);
 				xfree(id_assoc);
 			} else
 				xstrcat(fields, "job_db_inx");
-		} else if(!strncmp("cluster_nodes", data_in+i, 13)) {
+		} else if (!strncmp("cluster_nodes", data_in+i, 13)) {
 			/* this is here just to make it easier to
 			   handle the cluster field. */
 			xstrcat(fields, "cluster_nodes");
 			i+=13;
-		} else if(!strncmp("cluster", data_in+i, 7)) {
+		} else if (!strncmp("cluster", data_in+i, 7)) {
 			i+=7;
-			if(!delete) {
+			if (!delete) {
 				cluster_inx = cnt;
-				if(cnt)
+				if (cnt)
 					fields[strlen(fields)-2] = '\0';
 			} else {
-				while(data_in[i] && data_in[i-1] != '\'')
+				while (data_in[i] && data_in[i-1] != '\'')
 					i++;
 				start = i;
-				while(data_in[i] && data_in[i] != '\'')
+				while (data_in[i] && data_in[i] != '\'')
 					i++;
-				if(!data_in[i]) {
+				if (!data_in[i]) {
 					error("returning here cluster");
 					rc = SLURM_ERROR;
 					goto end_it;
@@ -774,25 +774,25 @@ static int _process_old_sql_line(const char *data_in, char **data_full_out)
 			}
 		} else {
 			start = i;
-			while(data_in[i]
-			      && data_in[i] != ',' && data_in[i] != ')') {
+			while (data_in[i]
+			       && data_in[i] != ',' && data_in[i] != ')') {
 				i++;
 			}
-			if(!data_in[i]) {
+			if (!data_in[i]) {
 				error("returning here end");
 				rc = SLURM_ERROR;
 				goto end_it;
 			}
 			xstrncat(fields, data_in+start, (i-start));
 		}
-		if(data_in[i]) {
-			if(!delete || ((table != assoc_day_table)
-				       && (table != assoc_hour_table)
-				       && (table != assoc_month_table))) {
-				if(data_in[i] == ',')
+		if (data_in[i]) {
+			if (!delete || ((table != assoc_day_table)
+					&& (table != assoc_hour_table)
+					&& (table != assoc_month_table))) {
+				if (data_in[i] == ',')
 					xstrcat(fields, ", ");
-				else if(data_in[i] == ')'
-					|| data_in[i] == ';') {
+				else if (data_in[i] == ')'
+					 || data_in[i] == ';') {
 					break;
 				} else {
 					error("unknown char '%s'", data_in+i);
@@ -801,115 +801,115 @@ static int _process_old_sql_line(const char *data_in, char **data_full_out)
 				}
 				i++;
 			} else {
-				if(data_in[i] == ';')
+				if (data_in[i] == ';')
 					break;
 			}
-			while(data_in[i] && data_in[i] == ' ')
+			while (data_in[i] && data_in[i] == ' ')
 				i++;
 		}
 		cnt++;
 	}
 
-	if(data_in[i] && data_in[i] == ')') {
+	if (data_in[i] && data_in[i] == ')') {
 		ending_end = i;
 		ending_start = 0;
-		while(data_in[ending_end] && data_in[ending_end-1] != ';') {
-			if(!strncmp(data_in+ending_end,
-				    "on duplicate key", 16)) {
+		while (data_in[ending_end] && data_in[ending_end-1] != ';') {
+			if (!strncmp(data_in+ending_end,
+				     "on duplicate key", 16)) {
 				ending_start = ending_end;
 			}
-			if(ending_start) {
-				if(!strncmp("period_start",
-					    data_in+ending_end, 12)) {
+			if (ending_start) {
+				if (!strncmp("period_start",
+					     data_in+ending_end, 12)) {
 					xstrcat(ending, "time_start");
 					ending_end+=12;
-				} else if(!strncmp("period_end",
-						   data_in+ending_end, 10)) {
+				} else if (!strncmp("period_end",
+						    data_in+ending_end, 10)) {
 					xstrcat(ending, "time_end");
 					ending_end+=10;
-				} else if(!strncmp("jobid",
-						   data_in+ending_end, 5)) {
+				} else if (!strncmp("jobid",
+						    data_in+ending_end, 5)) {
 					xstrcat(ending, "id_job");
 					ending_end+=5;
-				} else if(!strncmp("stepid",
-						   data_in+ending_end, 6)) {
+				} else if (!strncmp("stepid",
+						    data_in+ending_end, 6)) {
 					xstrcat(ending, "id_step");
 					ending_end+=6;
-				} else if(!strncmp("associd",
-						   data_in+ending_end, 7)) {
+				} else if (!strncmp("associd",
+						    data_in+ending_end, 7)) {
 					xstrcat(ending, "id_assoc");
 					ending_end+=7;
-				} else if(!strncmp("blockid",
-						   data_in+ending_end, 7)) {
+				} else if (!strncmp("blockid",
+						    data_in+ending_end, 7)) {
 					xstrcat(ending, "id_block");
 					ending_end+=7;
-				} else if(!strncmp("wckeyid",
-						   data_in+ending_end, 7)) {
+				} else if (!strncmp("wckeyid",
+						    data_in+ending_end, 7)) {
 					xstrcat(ending, "id_wckey");
 					ending_end+=7;
-				} else if(!strncmp("uid",
-						   data_in+ending_end, 3)) {
+				} else if (!strncmp("uid",
+						    data_in+ending_end, 3)) {
 					xstrcat(ending, "id_user");
 					ending_end+=3;
-				} else if(!strncmp("gid",
-						   data_in+ending_end, 3)) {
+				} else if (!strncmp("gid",
+						    data_in+ending_end, 3)) {
 					xstrcat(ending, "id_group");
 					ending_end+=3;
-				} else if(!strncmp("submit",
-						   data_in+ending_end, 6)) {
+				} else if (!strncmp("submit",
+						    data_in+ending_end, 6)) {
 					xstrcat(ending, "time_submit");
 					ending_end+=6;
-				} else if(!strncmp("eligible",
-						   data_in+ending_end, 8)) {
+				} else if (!strncmp("eligible",
+						    data_in+ending_end, 8)) {
 					xstrcat(ending, "time_eligible");
 					ending_end+=8;
-				} else if(!strncmp("start",
-						   data_in+ending_end, 5)) {
+				} else if (!strncmp("start",
+						    data_in+ending_end, 5)) {
 					xstrcat(ending, "time_start");
 					ending_end+=5;
-				} else if(!strncmp("suspended",
-						   data_in+ending_end, 9)) {
+				} else if (!strncmp("suspended",
+						    data_in+ending_end, 9)) {
 					xstrcat(ending, "time_suspended");
 					ending_end+=9;
-				} else if(!strncmp("end",
-						   data_in+ending_end, 3)) {
+				} else if (!strncmp("end",
+						    data_in+ending_end, 3)) {
 					xstrcat(ending, "time_end");
 					ending_end+=3;
-				} else if(!strncmp("comp_code",
-						   data_in+ending_end, 9)) {
+				} else if (!strncmp("comp_code",
+						    data_in+ending_end, 9)) {
 					xstrcat(ending, "exit_code");
 					ending_end+=9;
-				} else if(!strncmp("alloc_cpus",
-						   data_in+ending_end, 10)) {
+				} else if (!strncmp("alloc_cpus",
+						    data_in+ending_end, 10)) {
 					xstrcat(ending, "cpus_alloc");
 					ending_end+=10;
-				} else if(!strncmp("req_cpus",
-						   data_in+ending_end, 8)) {
+				} else if (!strncmp("req_cpus",
+						    data_in+ending_end, 8)) {
 					xstrcat(ending, "cpus_req");
 					ending_end+=8;
-				} else if(!strncmp("alloc_nodes",
-						   data_in+ending_end, 11)) {
+				} else if (!strncmp("alloc_nodes",
+						    data_in+ending_end, 11)) {
 					xstrcat(ending, "nodes_alloc");
 					ending_end+=11;
-				} else if(!strncmp("name",
-						   data_in+ending_end, 4)) {
-					if(table == job_table)
+				} else if (!strncmp("name",
+						    data_in+ending_end, 4)) {
+					if (table == job_table)
 						xstrcat(ending, "job_name");
-					else if(table == step_table)
+					else if (table == step_table)
 						xstrcat(ending, "step_name");
 					ending_end+=4;
-				} else if(!strncmp("id",
-						   data_in+ending_end, 2)) {
-					if((table == assoc_day_table)
-					   || (table == assoc_hour_table)
-					   || (table == assoc_month_table))
+				} else if (!strncmp("id",
+						    data_in+ending_end, 2)) {
+					if ((table == assoc_day_table)
+					    || (table == assoc_hour_table)
+					    || (table == assoc_month_table))
 						xstrcat(ending, "id_assoc");
 					else
 						xstrcat(ending, "job_db_inx");
 					ending_end+=2;
 				}
 
-				if(data_in[ending_end])
+				if (data_in[ending_end])
 					xstrcatchar(ending,
 						    data_in[ending_end]);
 			}
@@ -917,32 +917,32 @@ static int _process_old_sql_line(const char *data_in, char **data_full_out)
 		}
 
 		/* get values */
-		while((i < ending_start) && i < ending_start) {
+		while ((i < ending_start) && i < ending_start) {
 			/* get to the start of the values */
-			while((i < ending_start) && data_in[i-1] != '(')
+			while ((i < ending_start) && data_in[i-1] != '(')
 				i++;
 
 			/* find the values */
 			cnt = 0;
-			while((i < ending_start) && data_in[i] != ')') {
+			while ((i < ending_start) && data_in[i] != ')') {
 				start = i;
-				while((i < ending_start)
-				      && data_in[i] != ','
-				      && data_in[i] != ')') {
+				while ((i < ending_start)
+				       && data_in[i] != ','
+				       && data_in[i] != ')') {
 					i++;
 				}
-				if(!data_in[i]) {
+				if (!data_in[i]) {
 					rc = SLURM_ERROR;
 					goto end_it;
 				}
-				if(cnt == cluster_inx) {
+				if (cnt == cluster_inx) {
 					/* get the cluster name and remove the
 					   ticks */
 					xstrncat(new_cluster_name,
 						 data_in+start+1, (i-start-2));
-					if(cluster_name) {
-						if(strcmp(cluster_name,
-							  new_cluster_name))
+					if (cluster_name) {
+						if (strcmp(cluster_name,
+							   new_cluster_name))
 							new_cluster = 1;
 						else
 							xfree(new_cluster_name);
@@ -953,11 +953,11 @@ static int _process_old_sql_line(const char *data_in, char **data_full_out)
 				} else {
 					xstrncat(new_vals, data_in+start,
 						 (i-start));
-					if(data_in[i]) {
-						if(data_in[i] == ',')
+					if (data_in[i]) {
+						if (data_in[i] == ',')
 							xstrcat(new_vals, ", ");
-						else if(data_in[i] == ')'
-							|| data_in[i] == ';') {
+						else if (data_in[i] == ')'
+							 || data_in[i] == ';') {
 							i++;
 							break;
 						} else {
@@ -970,11 +970,11 @@ static int _process_old_sql_line(const char *data_in, char **data_full_out)
 					}
 				}
 				i++;
-				while((i < ending_start) && data_in[i] == ' ')
+				while ((i < ending_start) && data_in[i] == ' ')
 					i++;
 				cnt++;
 			}
-			if(new_cluster) {
+			if (new_cluster) {
 				/* info("new cluster, adding insert\n%s " */
 				/*      "\"%s_%s\" (%s) values %s %s", */
 				/*      beginning, cluster_name, table, */
@@ -990,8 +990,8 @@ static int _process_old_sql_line(const char *data_in, char **data_full_out)
 				new_cluster_name = NULL;
 			}
 
-			if(new_vals) {
-				if(vals)
+			if (new_vals) {
+				if (vals)
 					xstrfmtcat(vals, ", (%s)", new_vals);
 				else
 					xstrfmtcat(vals, "(%s)", new_vals);
@@ -1001,19 +1001,19 @@ static int _process_old_sql_line(const char *data_in, char **data_full_out)
 		i = ending_end;
 	}
 
-	if(!cluster_name) {
+	if (!cluster_name) {
 		error("No cluster given for %s", table);
 		goto end_it;
 	}
 
-	if(!delete) {
+	if (!delete) {
 		/* info("adding insert\n%s \"%s_%s\" (%s) values %s %s",
 		   beginning, cluster_name, table, fields, vals, ending); */
 		xstrfmtcat(data_out, "%s \"%s_%s\" (%s) values %s %s",
 			   beginning, cluster_name, table, fields,
 			   vals, ending);
 	} else {
-		if(fields) {
+		if (fields) {
 			/* info("adding delete\n%s \"%s_%s\" %s", */
 			/*      beginning, cluster_name, table, fields); */
 			xstrfmtcat(data_out, "%s \"%s_%s\" %s",
@@ -1034,7 +1034,7 @@ end_it:
 	xfree(vals);
 	*data_full_out = data_out;
 	//info("returning\n%s", data_out);
-	if(rc == SLURM_ERROR)
+	if (rc == SLURM_ERROR)
 		return -1;
 	return i;
 }
@@ -1046,15 +1046,15 @@ static int _process_old_sql(char **data)
 	char *data_out = NULL;
 	int rc = SLURM_SUCCESS;
 
-	while(data_in[i]) {
-		if((rc = _process_old_sql_line(data_in+i, &data_out)) == -1)
+	while (data_in[i]) {
+		if ((rc = _process_old_sql_line(data_in+i, &data_out)) == -1)
 			break;
 		i += rc;
 	}
 	//rc = -1;
 
 	xfree(data_in);
-	if(rc == -1)
+	if (rc == -1)
 		xfree(data_out);
 	//info("returning\n%s", data_out);
 	*data = data_out;
@@ -1091,13 +1091,13 @@ static uint32_t _archive_events(mysql_conn_t *mysql_conn, char *cluster_name,
 //	START_TIMER;
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(!(cnt = mysql_num_rows(result))) {
+	if (!(cnt = mysql_num_rows(result))) {
 		mysql_free_result(result);
 		return 0;
 	}
@@ -1109,8 +1109,8 @@ static uint32_t _archive_events(mysql_conn_t *mysql_conn, char *cluster_name,
 	packstr(cluster_name, buffer);
 	pack32(cnt, buffer);
 
-	while((row = mysql_fetch_row(result))) {
-		if(!period_start)
+	while ((row = mysql_fetch_row(result))) {
+		if (!period_start)
 			period_start = slurm_atoul(row[EVENT_REQ_START]);
 
 		memset(&event, 0, sizeof(local_event_t));
@@ -1136,7 +1136,7 @@ static uint32_t _archive_events(mysql_conn_t *mysql_conn, char *cluster_name,
 					arch_dir, "event", archive_period);
 	free_buf(buffer);
 
-	if(error_code != SLURM_SUCCESS)
+	if (error_code != SLURM_SUCCESS)
 		return error_code;
 
 	return cnt;
@@ -1162,14 +1162,14 @@ _load_events(uint16_t rpc_version, Buf buffer, char *cluster_name,
 	xstrcat(format, ")");
 	for(i=0; i<rec_cnt; i++) {
 		memset(&object, 0, sizeof(local_event_t));
-		if(_unpack_local_event(&object, rpc_version, buffer)
-		   != SLURM_SUCCESS) {
+		if (_unpack_local_event(&object, rpc_version, buffer)
+		    != SLURM_SUCCESS) {
 			error("issue unpacking");
 			xfree(format);
 			xfree(insert);
 			break;
 		}
-		if(i)
+		if (i)
 			xstrcat(insert, ", ");
 
 		xstrfmtcat(insert, format,
@@ -1220,13 +1220,13 @@ static uint32_t _archive_jobs(mysql_conn_t *mysql_conn, char *cluster_name,
 //	START_TIMER;
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(!(cnt = mysql_num_rows(result))) {
+	if (!(cnt = mysql_num_rows(result))) {
 		mysql_free_result(result);
 		return 0;
 	}
@@ -1238,8 +1238,8 @@ static uint32_t _archive_jobs(mysql_conn_t *mysql_conn, char *cluster_name,
 	packstr(cluster_name, buffer);
 	pack32(cnt, buffer);
 
-	while((row = mysql_fetch_row(result))) {
-		if(!period_start)
+	while ((row = mysql_fetch_row(result))) {
+		if (!period_start)
 			period_start = slurm_atoul(row[JOB_REQ_SUBMIT]);
 
 		memset(&job, 0, sizeof(local_job_t));
@@ -1288,7 +1288,7 @@ static uint32_t _archive_jobs(mysql_conn_t *mysql_conn, char *cluster_name,
 					arch_dir, "job", archive_period);
 	free_buf(buffer);
 
-	if(error_code != SLURM_SUCCESS)
+	if (error_code != SLURM_SUCCESS)
 		return error_code;
 
 	return cnt;
@@ -1313,14 +1313,14 @@ static char *_load_jobs(uint16_t rpc_version, Buf buffer,
 	xstrcat(format, ")");
 	for(i=0; i<rec_cnt; i++) {
 		memset(&object, 0, sizeof(local_job_t));
-		if(_unpack_local_job(&object, rpc_version, buffer)
-		   != SLURM_SUCCESS) {
+		if (_unpack_local_job(&object, rpc_version, buffer)
+		    != SLURM_SUCCESS) {
 			error("issue unpacking");
 			xfree(format);
 			xfree(insert);
 			break;
 		}
-		if(i)
+		if (i)
 			xstrcat(insert, ", ");
 
 		xstrfmtcat(insert, format,
@@ -1394,13 +1394,13 @@ static uint32_t _archive_steps(mysql_conn_t *mysql_conn, char *cluster_name,
 //	START_TIMER;
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(!(cnt = mysql_num_rows(result))) {
+	if (!(cnt = mysql_num_rows(result))) {
 		mysql_free_result(result);
 		return 0;
 	}
@@ -1412,8 +1412,8 @@ static uint32_t _archive_steps(mysql_conn_t *mysql_conn, char *cluster_name,
 	packstr(cluster_name, buffer);
 	pack32(cnt, buffer);
 
-	while((row = mysql_fetch_row(result))) {
-		if(!period_start)
+	while ((row = mysql_fetch_row(result))) {
+		if (!period_start)
 			period_start = slurm_atoul(row[STEP_REQ_START]);
 
 		memset(&step, 0, sizeof(local_step_t));
@@ -1466,7 +1466,7 @@ static uint32_t _archive_steps(mysql_conn_t *mysql_conn, char *cluster_name,
 					arch_dir, "step", archive_period);
 	free_buf(buffer);
 
-	if(error_code != SLURM_SUCCESS)
+	if (error_code != SLURM_SUCCESS)
 		return error_code;
 
 	return cnt;
@@ -1491,14 +1491,14 @@ static char *_load_steps(uint16_t rpc_version, Buf buffer,
 	xstrcat(format, ")");
 	for(i=0; i<rec_cnt; i++) {
 		memset(&object, 0, sizeof(local_step_t));
-		if(_unpack_local_step(&object, rpc_version, buffer)
-		   != SLURM_SUCCESS) {
+		if (_unpack_local_step(&object, rpc_version, buffer)
+		    != SLURM_SUCCESS) {
 			error("issue unpacking");
 			xfree(format);
 			xfree(insert);
 			break;
 		}
-		if(i)
+		if (i)
 			xstrcat(insert, ", ");
 
 		xstrfmtcat(insert, format,
@@ -1576,13 +1576,13 @@ static uint32_t _archive_suspend(mysql_conn_t *mysql_conn, char *cluster_name,
 //	START_TIMER;
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(!(cnt = mysql_num_rows(result))) {
+	if (!(cnt = mysql_num_rows(result))) {
 		mysql_free_result(result);
 		return 0;
 	}
@@ -1594,8 +1594,8 @@ static uint32_t _archive_suspend(mysql_conn_t *mysql_conn, char *cluster_name,
 	packstr(cluster_name, buffer);
 	pack32(cnt, buffer);
 
-	while((row = mysql_fetch_row(result))) {
-		if(!period_start)
+	while ((row = mysql_fetch_row(result))) {
+		if (!period_start)
 			period_start = slurm_atoul(row[SUSPEND_REQ_START]);
 
 		memset(&suspend, 0, sizeof(local_suspend_t));
@@ -1617,7 +1617,7 @@ static uint32_t _archive_suspend(mysql_conn_t *mysql_conn, char *cluster_name,
 					arch_dir, "suspend", archive_period);
 	free_buf(buffer);
 
-	if(error_code != SLURM_SUCCESS)
+	if (error_code != SLURM_SUCCESS)
 		return error_code;
 
 	return cnt;
@@ -1642,14 +1642,14 @@ static char *_load_suspend(uint16_t rpc_version, Buf buffer,
 	xstrcat(format, ")");
 	for(i=0; i<rec_cnt; i++) {
 		memset(&object, 0, sizeof(local_suspend_t));
-		if(_unpack_local_suspend(&object, rpc_version, buffer)
-		   != SLURM_SUCCESS) {
+		if (_unpack_local_suspend(&object, rpc_version, buffer)
+		    != SLURM_SUCCESS) {
 			error("issue unpacking");
 			xfree(format);
 			xfree(insert);
 			break;
 		}
-		if(i)
+		if (i)
 			xstrcat(insert, ", ");
 
 		xstrfmtcat(insert, format,
@@ -1675,19 +1675,19 @@ static int _execute_archive(mysql_conn_t *mysql_conn,
 	time_t curr_end;
 	time_t last_submit = time(NULL);
 
-	if(arch_cond->archive_script)
+	if (arch_cond->archive_script)
 		return archive_run_script(arch_cond, cluster_name, last_submit);
-	else if(!arch_cond->archive_dir) {
+	else if (!arch_cond->archive_dir) {
 		error("No archive dir given, can't process");
 		return SLURM_ERROR;
 	}
 
-	if(arch_cond->purge_event != NO_VAL) {
+	if (arch_cond->purge_event != NO_VAL) {
 		/* remove all data from event table that was older than
 		 * period_start * arch_cond->purge_event.
 		 */
-		if(!(curr_end = archive_setup_end_time(
-			     last_submit, arch_cond->purge_event))) {
+		if (!(curr_end = archive_setup_end_time(
+			      last_submit, arch_cond->purge_event))) {
 			error("Parsing purge event");
 			return SLURM_ERROR;
 		}
@@ -1695,13 +1695,13 @@ static int _execute_archive(mysql_conn_t *mysql_conn,
 		debug4("Purging event entries before %ld for %s",
 		       curr_end, cluster_name);
 
-		if(SLURMDB_PURGE_ARCHIVE_SET(arch_cond->purge_event)) {
+		if (SLURMDB_PURGE_ARCHIVE_SET(arch_cond->purge_event)) {
 			rc = _archive_events(mysql_conn, cluster_name,
 					     curr_end, arch_cond->archive_dir,
 					     arch_cond->purge_event);
-			if(!rc)
+			if (!rc)
 				goto exit_events;
-			else if(rc == SLURM_ERROR)
+			else if (rc == SLURM_ERROR)
 				return rc;
 		}
 		query = xstrdup_printf("delete from \"%s_%s\" where "
@@ -1711,7 +1711,7 @@ static int _execute_archive(mysql_conn_t *mysql_conn,
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't remove old event data");
 			return SLURM_ERROR;
 		}
@@ -1719,12 +1719,12 @@ static int _execute_archive(mysql_conn_t *mysql_conn,
 
 exit_events:
 
-	if(arch_cond->purge_suspend != NO_VAL) {
+	if (arch_cond->purge_suspend != NO_VAL) {
 		/* remove all data from suspend table that was older than
 		 * period_start * arch_cond->purge_suspend.
 		 */
-		if(!(curr_end = archive_setup_end_time(
-			     last_submit, arch_cond->purge_suspend))) {
+		if (!(curr_end = archive_setup_end_time(
+			      last_submit, arch_cond->purge_suspend))) {
 			error("Parsing purge suspend");
 			return SLURM_ERROR;
 		}
@@ -1732,13 +1732,13 @@ exit_events:
 		debug4("Purging suspend entries before %ld for %s",
 		       curr_end, cluster_name);
 
-		if(SLURMDB_PURGE_ARCHIVE_SET(arch_cond->purge_suspend)) {
+		if (SLURMDB_PURGE_ARCHIVE_SET(arch_cond->purge_suspend)) {
 			rc = _archive_suspend(mysql_conn, cluster_name,
 					      curr_end, arch_cond->archive_dir,
 					      arch_cond->purge_suspend);
-			if(!rc)
+			if (!rc)
 				goto exit_suspend;
-			else if(rc == SLURM_ERROR)
+			else if (rc == SLURM_ERROR)
 				return rc;
 		}
 		query = xstrdup_printf("delete from \"%s_%s\" where "
@@ -1748,7 +1748,7 @@ exit_events:
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't remove old suspend data");
 			return SLURM_ERROR;
 		}
@@ -1756,12 +1756,12 @@ exit_events:
 
 exit_suspend:
 
-	if(arch_cond->purge_step != NO_VAL) {
+	if (arch_cond->purge_step != NO_VAL) {
 		/* remove all data from step table that was older than
 		 * start * arch_cond->purge_step.
 		 */
-		if(!(curr_end = archive_setup_end_time(
-			     last_submit, arch_cond->purge_step))) {
+		if (!(curr_end = archive_setup_end_time(
+			      last_submit, arch_cond->purge_step))) {
 			error("Parsing purge step");
 			return SLURM_ERROR;
 		}
@@ -1769,13 +1769,13 @@ exit_suspend:
 		debug4("Purging step entries before %ld for %s",
 		       curr_end, cluster_name);
 
-		if(SLURMDB_PURGE_ARCHIVE_SET(arch_cond->purge_step)) {
+		if (SLURMDB_PURGE_ARCHIVE_SET(arch_cond->purge_step)) {
 			rc = _archive_steps(mysql_conn, cluster_name,
 					    curr_end, arch_cond->archive_dir,
 					    arch_cond->purge_step);
-			if(!rc)
+			if (!rc)
 				goto exit_steps;
-			else if(rc == SLURM_ERROR)
+			else if (rc == SLURM_ERROR)
 				return rc;
 		}
 
@@ -1786,19 +1786,19 @@ exit_suspend:
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't remove old step data");
 			return SLURM_ERROR;
 		}
 	}
 exit_steps:
 
-	if(arch_cond->purge_job != NO_VAL) {
+	if (arch_cond->purge_job != NO_VAL) {
 		/* remove all data from job table that was older than
 		 * last_submit * arch_cond->purge_job.
 		 */
-		if(!(curr_end = archive_setup_end_time(
-			     last_submit, arch_cond->purge_job))) {
+		if (!(curr_end = archive_setup_end_time(
+			      last_submit, arch_cond->purge_job))) {
 			error("Parsing purge job");
 			return SLURM_ERROR;
 		}
@@ -1806,13 +1806,13 @@ exit_steps:
 		debug4("Purging job entires before %ld for %s",
 		       curr_end, cluster_name);
 
-		if(SLURMDB_PURGE_ARCHIVE_SET(arch_cond->purge_job)) {
+		if (SLURMDB_PURGE_ARCHIVE_SET(arch_cond->purge_job)) {
 			rc = _archive_jobs(mysql_conn, cluster_name,
 					   curr_end, arch_cond->archive_dir,
 					   arch_cond->purge_job);
-			if(!rc)
+			if (!rc)
 				goto exit_jobs;
-			else if(rc == SLURM_ERROR)
+			else if (rc == SLURM_ERROR)
 				return rc;
 		}
 
@@ -1824,7 +1824,7 @@ exit_steps:
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't remove old job data");
 			return SLURM_ERROR;
 		}
@@ -1843,25 +1843,25 @@ extern int as_mysql_jobacct_process_archive(mysql_conn_t *mysql_conn,
 
 //	DEF_TIMERS;
 
-	if(!arch_cond) {
+	if (!arch_cond) {
 		error("No arch_cond was given to archive from.  returning");
 		return SLURM_ERROR;
 	}
 
-	if(arch_cond->job_cond && arch_cond->job_cond->cluster_list
-	   && list_count(arch_cond->job_cond->cluster_list))
+	if (arch_cond->job_cond && arch_cond->job_cond->cluster_list
+	    && list_count(arch_cond->job_cond->cluster_list))
 		use_cluster_list = arch_cond->job_cond->cluster_list;
 	else
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 
 	itr = list_iterator_create(use_cluster_list);
-	while((cluster_name = list_next(itr))) {
-		if((rc = _execute_archive(mysql_conn, cluster_name, arch_cond))
-		   != SLURM_SUCCESS)
+	while ((cluster_name = list_next(itr))) {
+		if ((rc = _execute_archive(mysql_conn, cluster_name, arch_cond))
+		    != SLURM_SUCCESS)
 			break;
 	}
 	list_iterator_destroy(itr);
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
 	return rc;
@@ -1877,14 +1877,14 @@ extern int as_mysql_jobacct_process_archive_load(
 	uint16_t type = 0, ver = 0;
 	uint32_t data_size = 0, rec_cnt = 0, tmp32 = 0;
 
-	if(!arch_rec) {
+	if (!arch_rec) {
 		error("We need a slurmdb_archive_rec to load anything.");
 		return SLURM_ERROR;
 	}
 
-	if(arch_rec->insert) {
+	if (arch_rec->insert) {
 		data = xstrdup(arch_rec->insert);
-	} else if(arch_rec->archive_file) {
+	} else if (arch_rec->archive_file) {
 		int data_allocated, data_read = 0;
 		int state_fd = open(arch_rec->archive_file, O_RDONLY);
 		if (state_fd < 0) {
@@ -1913,7 +1913,7 @@ extern int as_mysql_jobacct_process_archive_load(
 			}
 			close(state_fd);
 		}
-		if(error_code != SLURM_SUCCESS) {
+		if (error_code != SLURM_SUCCESS) {
 			xfree(data);
 			return error_code;
 		}
@@ -1923,18 +1923,18 @@ extern int as_mysql_jobacct_process_archive_load(
 		return SLURM_ERROR;
 	}
 
-	if(!data) {
+	if (!data) {
 		error("It doesn't appear we have anything to load.");
 		return SLURM_ERROR;
 	}
 
 	/* this is the old version of an archive file where the file
 	   was straight sql. */
-	if((strlen(data) >= 12)
-	   && (!strncmp("insert into ", data, 12)
-	       || !strncmp("delete from ", data, 12)
-	       || !strncmp("drop table ", data, 11)
-	       || !strncmp("truncate table ", data, 15))) {
+	if ((strlen(data) >= 12)
+	    && (!strncmp("insert into ", data, 12)
+		|| !strncmp("delete from ", data, 12)
+		|| !strncmp("drop table ", data, 11)
+		|| !strncmp("truncate table ", data, 15))) {
 		_process_old_sql(&data);
 		goto got_sql;
 	}
@@ -1957,7 +1957,7 @@ extern int as_mysql_jobacct_process_archive_load(
 	unpackstr_ptr(&cluster_name, &tmp32, buffer);
 	safe_unpack32(&rec_cnt, buffer);
 
-	if(!rec_cnt) {
+	if (!rec_cnt) {
 		error("we didn't get any records from this file of type '%s'",
 		      slurmdbd_msg_type_2_str(type, 0));
 		free_buf(buffer);
@@ -1984,7 +1984,7 @@ extern int as_mysql_jobacct_process_archive_load(
 	free_buf(buffer);
 
 got_sql:
-	if(!data) {
+	if (!data) {
 		error("No data to load");
 		return SLURM_ERROR;
 	}
@@ -1992,7 +1992,7 @@ got_sql:
 	       mysql_conn->conn, THIS_FILE, __LINE__, data);
 	error_code = mysql_db_query_check_after(mysql_conn, data);
 	xfree(data);
-	if(error_code != SLURM_SUCCESS) {
+	if (error_code != SLURM_SUCCESS) {
 	unpack_error:
 		error("Couldn't load old data");
 		return SLURM_ERROR;
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_assoc.c b/src/plugins/accounting_storage/mysql/as_mysql_assoc.c
index 5e015c3976c..f6ec8490894 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_assoc.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_assoc.c
@@ -228,15 +228,15 @@ static int _reset_default_assoc(mysql_conn_t *mysql_conn,
 			   assoc->user, assoc->acct);
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, sel_query);
-		if(!(result = mysql_db_query_ret(
-			     mysql_conn, sel_query, 1))) {
+		if (!(result = mysql_db_query_ret(
+			      mysql_conn, sel_query, 1))) {
 			xfree(sel_query);
 			rc = SLURM_ERROR;
 			goto end_it;
 		}
 		xfree(sel_query);
 
-		while((row = mysql_fetch_row(result))) {
+		while ((row = mysql_fetch_row(result))) {
 			slurmdb_association_rec_t *mod_assoc = xmalloc(
 				sizeof(slurmdb_association_rec_t));
 			slurmdb_init_association_rec(mod_assoc, 0);
@@ -290,8 +290,8 @@ static int _make_sure_users_have_default(
 				cluster, assoc_table, user);
 			debug4("%d(%s:%d) query\n%s",
 			       mysql_conn->conn, THIS_FILE, __LINE__, query);
-			if(!(result = mysql_db_query_ret(
-				     mysql_conn, query, 0))) {
+			if (!(result = mysql_db_query_ret(
+				      mysql_conn, query, 0))) {
 				xfree(query);
 				error("couldn't query the database");
 				rc = SLURM_ERROR;
@@ -327,7 +327,7 @@ static int _make_sure_users_have_default(
 			       mysql_conn->conn, THIS_FILE, __LINE__, query);
 			rc = mysql_db_query(mysql_conn, query);
 			xfree(query);
-			if(rc != SLURM_SUCCESS) {
+			if (rc != SLURM_SUCCESS) {
 				error("problem with update query");
 				rc = SLURM_ERROR;
 				break;
@@ -361,13 +361,13 @@ static int _move_account(mysql_conn_t *mysql_conn, uint32_t *lft, uint32_t *rgt,
 		cluster, assoc_table, parent);
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
-	if(!(row = mysql_fetch_row(result))) {
+	if (!(row = mysql_fetch_row(result))) {
 		debug4("Can't move a none existant association");
 		mysql_free_result(result);
 		return ESLURM_INVALID_PARENT_ACCOUNT;
@@ -377,7 +377,7 @@ static int _move_account(mysql_conn_t *mysql_conn, uint32_t *lft, uint32_t *rgt,
 
 	diff = ((par_left + 1) - *lft);
 
-	if(diff == 0) {
+	if (diff == 0) {
 		debug3("Trying to move association to the same position?  "
 		       "Nothing to do.");
 		return ESLURM_SAME_PARENT_ACCOUNT;
@@ -431,12 +431,12 @@ static int _move_account(mysql_conn_t *mysql_conn, uint32_t *lft, uint32_t *rgt,
 		   cluster, assoc_table, id);
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 1))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 1))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
-	if((row = mysql_fetch_row(result))) {
+	if ((row = mysql_fetch_row(result))) {
 		debug4("lft and rgt were %u %u and now is %s %s",
 		       *lft, *rgt, row[0], row[1]);
 		*lft = slurm_atoul(row[0]);
@@ -475,15 +475,16 @@ static int _move_parent(mysql_conn_t *mysql_conn, uid_t uid,
 		new_parent);
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result =
-	     mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result =
+	      mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
-		uint32_t child_lft = slurm_atoul(row[1]), child_rgt = slurm_atoul(row[2]);
+	if ((row = mysql_fetch_row(result))) {
+		uint32_t child_lft = slurm_atoul(row[1]),
+			child_rgt = slurm_atoul(row[2]);
 
 		debug4("%s(%s) %s,%s is a child of %s",
 		       new_parent, row[0], row[1], row[2], id);
@@ -493,7 +494,7 @@ static int _move_parent(mysql_conn_t *mysql_conn, uid_t uid,
 
 	mysql_free_result(result);
 
-	if(rc != SLURM_SUCCESS)
+	if (rc != SLURM_SUCCESS)
 		return rc;
 
 	/* now move the one we wanted to move in the first place
@@ -505,14 +506,14 @@ static int _move_parent(mysql_conn_t *mysql_conn, uid_t uid,
 		cluster, assoc_table, id);
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result =
-	     mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result =
+	      mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
+	if ((row = mysql_fetch_row(result))) {
 		*lft = slurm_atoul(row[0]);
 		*rgt = slurm_atoul(row[1]);
 		rc = _move_account(mysql_conn, lft, rgt,
@@ -543,14 +544,14 @@ static uint32_t _get_parent_id(
 	debug4("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
 
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 1))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 1))) {
 		xfree(query);
 		return 0;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
-		if(row[0])
+	if ((row = mysql_fetch_row(result))) {
+		if (row[0])
 			parent_id = slurm_atoul(row[0]);
 	} else
 		error("no association for parent %s on cluster %s",
@@ -577,16 +578,16 @@ static int _set_assoc_lft_rgt(
 	debug4("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
 
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 1))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 1))) {
 		xfree(query);
 		return 0;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
-		if(row[0])
+	if ((row = mysql_fetch_row(result))) {
+		if (row[0])
 			assoc->lft = slurm_atoul(row[0]);
-		if(row[1])
+		if (row[1])
 			assoc->rgt = slurm_atoul(row[1]);
 		rc = SLURM_SUCCESS;
 	} else
@@ -620,9 +621,9 @@ static int _set_assoc_limits_for_add(
 
 	xassert(assoc);
 
-	if(assoc->parent_acct)
+	if (assoc->parent_acct)
 		parent = assoc->parent_acct;
-	else if(assoc->user)
+	else if (assoc->user)
 		parent = assoc->acct;
 	else
 		return SLURM_SUCCESS;
@@ -633,46 +634,46 @@ static int _set_assoc_limits_for_add(
 			       get_parent_limits_select);
 	debug4("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 1))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 1))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(!(row = mysql_fetch_row(result)))
+	if (!(row = mysql_fetch_row(result)))
 		goto end_it;
 
-	if(row[ASSOC2_REQ_DEF_QOS] && assoc->def_qos_id == NO_VAL)
+	if (row[ASSOC2_REQ_DEF_QOS] && assoc->def_qos_id == NO_VAL)
 		assoc->def_qos_id = slurm_atoul(row[ASSOC2_REQ_DEF_QOS]);
-	else if(assoc->def_qos_id == NO_VAL)
+	else if (assoc->def_qos_id == NO_VAL)
 		assoc->def_qos_id = 0;
 
-	if(row[ASSOC2_REQ_MCMPJ] && assoc->max_cpu_mins_pj == (uint64_t)NO_VAL)
+	if (row[ASSOC2_REQ_MCMPJ] && assoc->max_cpu_mins_pj == (uint64_t)NO_VAL)
 		assoc->max_cpu_mins_pj = slurm_atoull(row[ASSOC2_REQ_MCMPJ]);
-	if(row[ASSOC2_REQ_MCRM] && assoc->max_cpu_run_mins == (uint64_t)NO_VAL)
+	if (row[ASSOC2_REQ_MCRM] && assoc->max_cpu_run_mins == (uint64_t)NO_VAL)
 		assoc->max_cpu_run_mins = slurm_atoull(row[ASSOC2_REQ_MCRM]);
-	if(row[ASSOC2_REQ_MCPJ] && assoc->max_cpus_pj == NO_VAL)
+	if (row[ASSOC2_REQ_MCPJ] && assoc->max_cpus_pj == NO_VAL)
 		assoc->max_cpus_pj = slurm_atoul(row[ASSOC2_REQ_MCPJ]);
-	if(row[ASSOC2_REQ_MJ] && assoc->max_jobs == NO_VAL)
+	if (row[ASSOC2_REQ_MJ] && assoc->max_jobs == NO_VAL)
 		assoc->max_jobs = slurm_atoul(row[ASSOC2_REQ_MJ]);
-	if(row[ASSOC2_REQ_MNPJ] && assoc->max_nodes_pj == NO_VAL)
+	if (row[ASSOC2_REQ_MNPJ] && assoc->max_nodes_pj == NO_VAL)
 		assoc->max_nodes_pj = slurm_atoul(row[ASSOC2_REQ_MNPJ]);
-	if(row[ASSOC2_REQ_MSJ] && assoc->max_submit_jobs == NO_VAL)
+	if (row[ASSOC2_REQ_MSJ] && assoc->max_submit_jobs == NO_VAL)
 		assoc->max_submit_jobs = slurm_atoul(row[ASSOC2_REQ_MSJ]);
-	if(row[ASSOC2_REQ_MWPJ] && assoc->max_wall_pj == NO_VAL)
+	if (row[ASSOC2_REQ_MWPJ] && assoc->max_wall_pj == NO_VAL)
 		assoc->max_wall_pj = slurm_atoul(row[ASSOC2_REQ_MWPJ]);
 
-	if(assoc->qos_list) {
+	if (assoc->qos_list) {
 		int set = 0;
 		char *tmp_char = NULL;
 		ListIterator qos_itr = list_iterator_create(assoc->qos_list);
-		while((tmp_char = list_next(qos_itr))) {
+		while ((tmp_char = list_next(qos_itr))) {
 			/* we don't want to include blank names */
-			if(!tmp_char[0])
+			if (!tmp_char[0])
 				continue;
 
-			if(!set) {
-				if(tmp_char[0] != '+' && tmp_char[0] != '-')
+			if (!set) {
+				if (tmp_char[0] != '+' && tmp_char[0] != '-')
 					break;
 				set = 1;
 			}
@@ -680,7 +681,7 @@ static int _set_assoc_limits_for_add(
 		}
 		list_iterator_destroy(qos_itr);
 
-		if(tmp_char) {
+		if (tmp_char) {
 			/* we have the qos here nothing from parents
 			   needed */
 			goto end_it;
@@ -689,13 +690,13 @@ static int _set_assoc_limits_for_add(
 	} else
 		assoc->qos_list = list_create(slurm_destroy_char);
 
-	if(row[ASSOC2_REQ_QOS][0])
+	if (row[ASSOC2_REQ_QOS][0])
 		slurm_addto_char_list(assoc->qos_list, row[ASSOC2_REQ_QOS]+1);
 
-	if(row[ASSOC2_REQ_DELTA_QOS][0])
+	if (row[ASSOC2_REQ_DELTA_QOS][0])
 		slurm_addto_char_list(assoc->qos_list,
 				      row[ASSOC2_REQ_DELTA_QOS]+1);
-	if(qos_delta) {
+	if (qos_delta) {
 		slurm_addto_char_list(assoc->qos_list, qos_delta+1);
 		xfree(qos_delta);
 	}
@@ -763,7 +764,7 @@ static int _modify_unset_users(mysql_conn_t *mysql_conn,
 	xassert(assoc);
 	xassert(assoc->cluster);
 
-	if(!ret_list || !acct)
+	if (!ret_list || !acct)
 		return SLURM_ERROR;
 
 	xstrcat(object, assoc_inx[0]);
@@ -782,14 +783,14 @@ static int _modify_unset_users(mysql_conn_t *mysql_conn,
 	xfree(object);
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result =
-	     mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result =
+	      mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_association_rec_t *mod_assoc = NULL;
 		int modified = 0;
 
@@ -798,55 +799,55 @@ static int _modify_unset_users(mysql_conn_t *mysql_conn,
 		mod_assoc->id = slurm_atoul(row[ASSOC_ID]);
 		mod_assoc->cluster = xstrdup(assoc->cluster);
 
-		if(!row[ASSOC_DEF_QOS] && assoc->def_qos_id != NO_VAL) {
+		if (!row[ASSOC_DEF_QOS] && assoc->def_qos_id != NO_VAL) {
 			mod_assoc->def_qos_id = assoc->def_qos_id;
 			modified = 1;
 		}
 
-		if(!row[ASSOC_MJ] && assoc->max_jobs != NO_VAL) {
+		if (!row[ASSOC_MJ] && assoc->max_jobs != NO_VAL) {
 			mod_assoc->max_jobs = assoc->max_jobs;
 			modified = 1;
 		}
 
-		if(!row[ASSOC_MSJ] && assoc->max_submit_jobs != NO_VAL) {
+		if (!row[ASSOC_MSJ] && assoc->max_submit_jobs != NO_VAL) {
 			mod_assoc->max_submit_jobs = assoc->max_submit_jobs;
 			modified = 1;
 		}
 
-		if(!row[ASSOC_MNPJ] && assoc->max_nodes_pj != NO_VAL) {
+		if (!row[ASSOC_MNPJ] && assoc->max_nodes_pj != NO_VAL) {
 			mod_assoc->max_nodes_pj = assoc->max_nodes_pj;
 			modified = 1;
 		}
 
-		if(!row[ASSOC_MCPJ] && assoc->max_cpus_pj != NO_VAL) {
+		if (!row[ASSOC_MCPJ] && assoc->max_cpus_pj != NO_VAL) {
 			mod_assoc->max_cpus_pj = assoc->max_cpus_pj;
 			modified = 1;
 		}
 
-		if(!row[ASSOC_MWPJ] && assoc->max_wall_pj != NO_VAL) {
+		if (!row[ASSOC_MWPJ] && assoc->max_wall_pj != NO_VAL) {
 			mod_assoc->max_wall_pj = assoc->max_wall_pj;
 			modified = 1;
 		}
 
-		if(!row[ASSOC_MCMPJ]
-		   && assoc->max_cpu_mins_pj != (uint64_t)NO_VAL) {
+		if (!row[ASSOC_MCMPJ]
+		    && assoc->max_cpu_mins_pj != (uint64_t)NO_VAL) {
 			mod_assoc->max_cpu_mins_pj = assoc->max_cpu_mins_pj;
 			modified = 1;
 		}
 
-		if(!row[ASSOC_MCRM]
-		   && assoc->max_cpu_run_mins != (uint64_t)NO_VAL) {
+		if (!row[ASSOC_MCRM]
+		    && assoc->max_cpu_run_mins != (uint64_t)NO_VAL) {
 			mod_assoc->max_cpu_run_mins = assoc->max_cpu_run_mins;
 			modified = 1;
 		}
 
-		if(!row[ASSOC_QOS][0] && assoc->qos_list) {
+		if (!row[ASSOC_QOS][0] && assoc->qos_list) {
 			List delta_qos_list = NULL;
 			char *qos_char = NULL, *delta_char = NULL;
 			ListIterator delta_itr = NULL;
 			ListIterator qos_itr =
 				list_iterator_create(assoc->qos_list);
-			if(row[ASSOC_DELTA_QOS][0]) {
+			if (row[ASSOC_DELTA_QOS][0]) {
 				delta_qos_list =
 					list_create(slurm_destroy_char);
 				slurm_addto_char_list(delta_qos_list,
@@ -860,29 +861,29 @@ static int _modify_unset_users(mysql_conn_t *mysql_conn,
 			   have the qos added or removed before we add
 			   it to the parent.
 			*/
-			while((qos_char = list_next(qos_itr))) {
-				if(delta_itr && qos_char[0] != '=') {
-					while((delta_char =
-					       list_next(delta_itr))) {
-
-						if((qos_char[0]
-						    != delta_char[0])
-						   && (!strcmp(qos_char+1,
-							       delta_char+1)))
+			while ((qos_char = list_next(qos_itr))) {
+				if (delta_itr && qos_char[0] != '=') {
+					while ((delta_char =
+						list_next(delta_itr))) {
+
+						if ((qos_char[0]
+						     != delta_char[0])
+						    && (!strcmp(qos_char+1,
+								delta_char+1)))
 							break;
 					}
 					list_iterator_reset(delta_itr);
-					if(delta_char)
+					if (delta_char)
 						continue;
 				}
 				list_append(mod_assoc->qos_list,
 					    xstrdup(qos_char));
 			}
 			list_iterator_destroy(qos_itr);
-			if(delta_itr)
+			if (delta_itr)
 				list_iterator_destroy(delta_itr);
-			if(list_count(mod_assoc->qos_list)
-			   || !list_count(assoc->qos_list))
+			if (list_count(mod_assoc->qos_list)
+			    || !list_count(assoc->qos_list))
 				modified = 1;
 			else {
 				list_destroy(mod_assoc->qos_list);
@@ -891,11 +892,11 @@ static int _modify_unset_users(mysql_conn_t *mysql_conn,
 		}
 
 		/* We only want to add those that are modified here */
-		if(modified) {
+		if (modified) {
 			/* Since we aren't really changing this non
 			 * user association we don't want to send it.
 			 */
-			if(!row[ASSOC_USER][0]) {
+			if (!row[ASSOC_USER][0]) {
 				/* This is a sub account so run it
 				 * through as if it is a parent.
 				 */
@@ -910,7 +911,7 @@ static int _modify_unset_users(mysql_conn_t *mysql_conn,
 			}
 			/* We do want to send all user accounts though */
 			mod_assoc->shares_raw = NO_VAL;
-			if(row[ASSOC_PART][0]) {
+			if (row[ASSOC_PART][0]) {
 				// see if there is a partition name
 				object = xstrdup_printf(
 					"C = %-10s A = %-20s U = %-9s P = %s",
@@ -926,13 +927,13 @@ static int _modify_unset_users(mysql_conn_t *mysql_conn,
 
 			list_append(ret_list, object);
 
-			if(moved_parent)
+			if (moved_parent)
 				slurmdb_destroy_association_rec(mod_assoc);
 			else
-				if(addto_update_list(mysql_conn->update_list,
-						     SLURMDB_MODIFY_ASSOC,
-						     mod_assoc)
-				   != SLURM_SUCCESS) {
+				if (addto_update_list(mysql_conn->update_list,
+						      SLURMDB_MODIFY_ASSOC,
+						      mod_assoc)
+				    != SLURM_SUCCESS) {
 					slurmdb_destroy_association_rec(
 						mod_assoc);
 					error("couldn't add to "
@@ -958,14 +959,14 @@ static char *_setup_association_cond_qos(slurmdb_association_cond_t *assoc_cond,
 	char *prefix = "t1";
 	char *extra = NULL;
 
-	if(!assoc_cond)
+	if (!assoc_cond)
 		return NULL;
 
 	/* we need to check this first so we can update the
 	   with_sub_accts if needed since this the qos_list is a
 	   parent thing
 	*/
-	if(assoc_cond->qos_list && list_count(assoc_cond->qos_list)) {
+	if (assoc_cond->qos_list && list_count(assoc_cond->qos_list)) {
 		/* we have to do the same thing as with_sub_accts does
 		   first since we are looking for something that is
 		   really most likely a parent thing */
@@ -976,8 +977,8 @@ static char *_setup_association_cond_qos(slurmdb_association_cond_t *assoc_cond,
 			   cluster_name, assoc_table);
 		set = 0;
 		itr = list_iterator_create(assoc_cond->qos_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra,
 				   "(%s.qos like '%%,%s' "
@@ -990,7 +991,7 @@ static char *_setup_association_cond_qos(slurmdb_association_cond_t *assoc_cond,
 		}
 		list_iterator_destroy(itr);
 		xstrcat(extra, ") &&");
-	} else if(assoc_cond->with_sub_accts) {
+	} else if (assoc_cond->with_sub_accts) {
 		prefix = "t2";
 		xstrfmtcat(extra, ", \"%s_%s\" as t2 where "
 			   "(t1.lft between t2.lft and t2.rgt) &&",
@@ -1009,10 +1010,10 @@ static int _setup_association_cond_limits(
 	ListIterator itr = NULL;
 	char *object = NULL;
 
-	if(!assoc_cond)
+	if (!assoc_cond)
 		return 0;
 
-	if(assoc_cond->with_deleted)
+	if (assoc_cond->with_deleted)
 		xstrfmtcat(*extra, " (%s.deleted=0 || %s.deleted=1)",
 			   prefix, prefix);
 	else
@@ -1023,12 +1024,12 @@ static int _setup_association_cond_limits(
 		xstrfmtcat(*extra, " && (%s.is_def=1)", prefix);
 	}
 
-	if(assoc_cond->acct_list && list_count(assoc_cond->acct_list)) {
+	if (assoc_cond->acct_list && list_count(assoc_cond->acct_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->acct_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.acct='%s'", prefix, object);
 			set = 1;
@@ -1037,13 +1038,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->def_qos_id_list
-	   && list_count(assoc_cond->def_qos_id_list)) {
+	if (assoc_cond->def_qos_id_list
+	    && list_count(assoc_cond->def_qos_id_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->def_qos_id_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.def_qos_id='%s'",
 				   prefix, object);
@@ -1053,13 +1054,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->fairshare_list
-	   && list_count(assoc_cond->fairshare_list)) {
+	if (assoc_cond->fairshare_list
+	    && list_count(assoc_cond->fairshare_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->fairshare_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			if (!strncasecmp(object, "parent", 6))
 				xstrfmtcat(*extra, "%s.shares='%u'",
@@ -1073,13 +1074,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->grp_cpu_mins_list
-	   && list_count(assoc_cond->grp_cpu_mins_list)) {
+	if (assoc_cond->grp_cpu_mins_list
+	    && list_count(assoc_cond->grp_cpu_mins_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->grp_cpu_mins_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.grp_cpu_mins='%s'",
 				   prefix, object);
@@ -1089,13 +1090,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->grp_cpu_run_mins_list
-	   && list_count(assoc_cond->grp_cpu_run_mins_list)) {
+	if (assoc_cond->grp_cpu_run_mins_list
+	    && list_count(assoc_cond->grp_cpu_run_mins_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->grp_cpu_run_mins_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.grp_cpu_run_mins='%s'",
 				   prefix, object);
@@ -1105,13 +1106,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->grp_cpus_list
-	   && list_count(assoc_cond->grp_cpus_list)) {
+	if (assoc_cond->grp_cpus_list
+	    && list_count(assoc_cond->grp_cpus_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->grp_cpus_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.grp_cpus='%s'",
 				   prefix, object);
@@ -1121,13 +1122,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->grp_jobs_list
-	   && list_count(assoc_cond->grp_jobs_list)) {
+	if (assoc_cond->grp_jobs_list
+	    && list_count(assoc_cond->grp_jobs_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->grp_jobs_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.grp_jobs='%s'",
 				   prefix, object);
@@ -1137,13 +1138,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->grp_nodes_list
-	   && list_count(assoc_cond->grp_nodes_list)) {
+	if (assoc_cond->grp_nodes_list
+	    && list_count(assoc_cond->grp_nodes_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->grp_nodes_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.grp_nodes='%s'",
 				   prefix, object);
@@ -1153,13 +1154,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->grp_submit_jobs_list
-	   && list_count(assoc_cond->grp_submit_jobs_list)) {
+	if (assoc_cond->grp_submit_jobs_list
+	    && list_count(assoc_cond->grp_submit_jobs_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->grp_submit_jobs_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.grp_submit_jobs='%s'",
 				   prefix, object);
@@ -1169,13 +1170,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->grp_wall_list
-	   && list_count(assoc_cond->grp_wall_list)) {
+	if (assoc_cond->grp_wall_list
+	    && list_count(assoc_cond->grp_wall_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->grp_wall_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.grp_wall='%s'",
 				   prefix, object);
@@ -1185,13 +1186,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->max_cpu_mins_pj_list
-	   && list_count(assoc_cond->max_cpu_mins_pj_list)) {
+	if (assoc_cond->max_cpu_mins_pj_list
+	    && list_count(assoc_cond->max_cpu_mins_pj_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->max_cpu_mins_pj_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.max_cpu_mins_pj='%s'",
 				   prefix, object);
@@ -1201,13 +1202,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->max_cpu_run_mins_list
-	   && list_count(assoc_cond->max_cpu_run_mins_list)) {
+	if (assoc_cond->max_cpu_run_mins_list
+	    && list_count(assoc_cond->max_cpu_run_mins_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->max_cpu_run_mins_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.max_cpu_run_mins='%s'",
 				   prefix, object);
@@ -1217,13 +1218,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->max_cpus_pj_list
-	   && list_count(assoc_cond->max_cpus_pj_list)) {
+	if (assoc_cond->max_cpus_pj_list
+	    && list_count(assoc_cond->max_cpus_pj_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->max_cpus_pj_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.max_cpus_pj='%s'",
 				   prefix, object);
@@ -1233,13 +1234,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->max_jobs_list
-	   && list_count(assoc_cond->max_jobs_list)) {
+	if (assoc_cond->max_jobs_list
+	    && list_count(assoc_cond->max_jobs_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->max_jobs_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.max_jobs='%s'",
 				   prefix, object);
@@ -1249,13 +1250,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->max_nodes_pj_list
-	   && list_count(assoc_cond->max_nodes_pj_list)) {
+	if (assoc_cond->max_nodes_pj_list
+	    && list_count(assoc_cond->max_nodes_pj_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->max_nodes_pj_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.max_nodes_pj='%s'",
 				   prefix, object);
@@ -1265,13 +1266,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->max_submit_jobs_list
-	   && list_count(assoc_cond->max_submit_jobs_list)) {
+	if (assoc_cond->max_submit_jobs_list
+	    && list_count(assoc_cond->max_submit_jobs_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->max_submit_jobs_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.max_submit_jobs='%s'",
 				   prefix, object);
@@ -1281,13 +1282,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->max_wall_pj_list
-	   && list_count(assoc_cond->max_wall_pj_list)) {
+	if (assoc_cond->max_wall_pj_list
+	    && list_count(assoc_cond->max_wall_pj_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->max_wall_pj_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra,
 				   "%s.max_wall_pj='%s'",
@@ -1298,31 +1299,31 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->user_list && list_count(assoc_cond->user_list)) {
+	if (assoc_cond->user_list && list_count(assoc_cond->user_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->user_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.user='%s'", prefix, object);
 			set = 1;
 		}
 		list_iterator_destroy(itr);
 		xstrcat(*extra, ")");
-	} else if(assoc_cond->user_list) {
+	} else if (assoc_cond->user_list) {
 		/* we want all the users, but no non-user associations */
 		set = 1;
 		xstrfmtcat(*extra, " && (%s.user!='')", prefix);
 	}
 
-	if(assoc_cond->partition_list
-	   && list_count(assoc_cond->partition_list)) {
+	if (assoc_cond->partition_list
+	    && list_count(assoc_cond->partition_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->partition_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.partition='%s'",
 				   prefix, object);
@@ -1332,12 +1333,12 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->id_list && list_count(assoc_cond->id_list)) {
+	if (assoc_cond->id_list && list_count(assoc_cond->id_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->id_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.id_assoc=%s", prefix, object);
 			set = 1;
@@ -1346,13 +1347,13 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->parent_acct_list
-	   && list_count(assoc_cond->parent_acct_list)) {
+	if (assoc_cond->parent_acct_list
+	    && list_count(assoc_cond->parent_acct_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->parent_acct_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.parent_acct='%s'",
 				   prefix, object);
@@ -1383,12 +1384,12 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 
 	xassert(result);
 
-	if(!mysql_num_rows(result))
+	if (!mysql_num_rows(result))
 		return SLURM_SUCCESS;
 
 	vals = xstrdup(sent_vals);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_association_rec_t *mod_assoc = NULL;
 		int account_type=0;
 		/* If parent changes these also could change
@@ -1410,27 +1411,27 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 		 * association so account is really the parent
 		 * of the user a coord can change that all day long.
 		 */
-		if(row[MASSOC_PACCT][0])
+		if (row[MASSOC_PACCT][0])
 			account = row[MASSOC_PACCT];
 
-		if(!is_admin) {
+		if (!is_admin) {
 			slurmdb_coord_rec_t *coord = NULL;
 
-			if(!user->coord_accts) { // This should never
+			if (!user->coord_accts) { // This should never
 				// happen
 				error("We are here with no coord accts.");
 				rc = ESLURM_ACCESS_DENIED;
 				goto end_it;
 			}
 			itr = list_iterator_create(user->coord_accts);
-			while((coord = list_next(itr))) {
-				if(!strcasecmp(coord->name, account))
+			while ((coord = list_next(itr))) {
+				if (!strcasecmp(coord->name, account))
 					break;
 			}
 			list_iterator_destroy(itr);
 
-			if(!coord) {
-				if(row[MASSOC_PACCT][0])
+			if (!coord) {
+				if (row[MASSOC_PACCT][0])
 					error("User %s(%d) can not modify "
 					      "account (%s) because they "
 					      "are not coordinators of "
@@ -1450,21 +1451,21 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 			}
 		}
 
-		if(row[MASSOC_PART][0]) {
+		if (row[MASSOC_PART][0]) {
 			// see if there is a partition name
 			object = xstrdup_printf(
 				"C = %-10s A = %-20s U = %-9s P = %s",
 				cluster_name, row[MASSOC_ACCT],
 				row[MASSOC_USER], row[MASSOC_PART]);
-		} else if(row[MASSOC_USER][0]){
+		} else if (row[MASSOC_USER][0]){
 			object = xstrdup_printf(
 				"C = %-10s A = %-20s U = %-9s",
 				cluster_name, row[MASSOC_ACCT],
 				row[MASSOC_USER]);
 		} else {
-			if(assoc->parent_acct) {
-				if(!strcasecmp(row[MASSOC_ACCT],
-					       assoc->parent_acct)) {
+			if (assoc->parent_acct) {
+				if (!strcasecmp(row[MASSOC_ACCT],
+						assoc->parent_acct)) {
 					error("You can't make an account be a "
 					      "child of it's self");
 					xfree(object);
@@ -1478,15 +1479,15 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 						  assoc->parent_acct,
 						  now);
 
-				if((rc == ESLURM_INVALID_PARENT_ACCOUNT)
-				   || (rc == ESLURM_SAME_PARENT_ACCOUNT)) {
+				if ((rc == ESLURM_INVALID_PARENT_ACCOUNT)
+				    || (rc == ESLURM_SAME_PARENT_ACCOUNT)) {
 					continue;
-				} else if(rc != SLURM_SUCCESS)
+				} else if (rc != SLURM_SUCCESS)
 					break;
 
 				moved_parent = 1;
 			}
-			if(row[MASSOC_PACCT][0]) {
+			if (row[MASSOC_PACCT][0]) {
 				object = xstrdup_printf(
 					"C = %-10s A = %s of %s",
 					cluster_name, row[MASSOC_ACCT],
@@ -1501,7 +1502,7 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 		list_append(ret_list, object);
 		added++;
 
-		if(name_char)
+		if (name_char)
 			xstrfmtcat(name_char, " || id_assoc=%s",
 				   row[MASSOC_ID]);
 		else
@@ -1528,40 +1529,40 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 			}
 			xfree(query);
 
-			if((row2 = mysql_fetch_row(result2))) {
-				if(!assoc->def_qos_id
-				   && row2[ASSOC2_REQ_DEF_QOS])
+			if ((row2 = mysql_fetch_row(result2))) {
+				if (!assoc->def_qos_id
+				    && row2[ASSOC2_REQ_DEF_QOS])
 					assoc->def_qos_id = slurm_atoul(
 						row2[ASSOC2_REQ_DEF_QOS]);
 
-				if((assoc->max_jobs == INFINITE)
-				   && row2[ASSOC2_REQ_MJ])
+				if ((assoc->max_jobs == INFINITE)
+				    && row2[ASSOC2_REQ_MJ])
 					assoc->max_jobs = slurm_atoul(
 						row2[ASSOC2_REQ_MJ]);
-				if((assoc->max_submit_jobs == INFINITE)
-				   && row2[ASSOC2_REQ_MSJ])
+				if ((assoc->max_submit_jobs == INFINITE)
+				    && row2[ASSOC2_REQ_MSJ])
 					assoc->max_submit_jobs = slurm_atoul(
 						row2[ASSOC2_REQ_MSJ]);
-				if((assoc->max_cpus_pj == INFINITE)
-				   && row2[ASSOC2_REQ_MCPJ])
+				if ((assoc->max_cpus_pj == INFINITE)
+				    && row2[ASSOC2_REQ_MCPJ])
 					assoc->max_cpus_pj = slurm_atoul(
 						row2[ASSOC2_REQ_MCPJ]);
-				if((assoc->max_nodes_pj == INFINITE)
-				   && row2[ASSOC2_REQ_MNPJ])
+				if ((assoc->max_nodes_pj == INFINITE)
+				    && row2[ASSOC2_REQ_MNPJ])
 					assoc->max_nodes_pj = slurm_atoul(
 						row2[ASSOC2_REQ_MNPJ]);
-				if((assoc->max_wall_pj == INFINITE)
-				   && row2[ASSOC2_REQ_MWPJ])
+				if ((assoc->max_wall_pj == INFINITE)
+				    && row2[ASSOC2_REQ_MWPJ])
 					assoc->max_wall_pj = slurm_atoul(
 						row2[ASSOC2_REQ_MWPJ]);
-				if((assoc->max_cpu_mins_pj ==
-				    (uint64_t)INFINITE)
-				   && row2[ASSOC2_REQ_MCMPJ])
+				if ((assoc->max_cpu_mins_pj ==
+				     (uint64_t)INFINITE)
+				    && row2[ASSOC2_REQ_MCMPJ])
 					assoc->max_cpu_mins_pj = slurm_atoull(
 						row2[ASSOC2_REQ_MCMPJ]);
-				if((assoc->max_cpu_run_mins ==
-				    (uint64_t)INFINITE)
-				   && row2[ASSOC2_REQ_MCRM])
+				if ((assoc->max_cpu_run_mins ==
+				     (uint64_t)INFINITE)
+				    && row2[ASSOC2_REQ_MCRM])
 					assoc->max_cpu_run_mins = slurm_atoull(
 						row2[ASSOC2_REQ_MCRM]);
 			}
@@ -1597,48 +1598,48 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 		/* no need to get the parent id since if we moved
 		 * parent id's we will get it when we send the total list */
 
-		if(!row[MASSOC_USER][0])
+		if (!row[MASSOC_USER][0])
 			mod_assoc->parent_acct = xstrdup(assoc->parent_acct);
-		if(assoc->qos_list && list_count(assoc->qos_list)) {
+		if (assoc->qos_list && list_count(assoc->qos_list)) {
 			ListIterator new_qos_itr =
 				list_iterator_create(assoc->qos_list);
 			char *new_qos = NULL, *tmp_qos = NULL;
 
 			mod_assoc->qos_list = list_create(slurm_destroy_char);
 
-			while((new_qos = list_next(new_qos_itr))) {
-				if(new_qos[0] == '-' || new_qos[0] == '+') {
+			while ((new_qos = list_next(new_qos_itr))) {
+				if (new_qos[0] == '-' || new_qos[0] == '+') {
 					list_append(mod_assoc->qos_list,
 						    xstrdup(new_qos));
-				} else if(new_qos[0]) {
+				} else if (new_qos[0]) {
 					list_append(mod_assoc->qos_list,
 						    xstrdup_printf("=%s",
 								   new_qos));
 				}
 
-				if(set_qos_vals)
+				if (set_qos_vals)
 					continue;
 				/* Now we can set up the values and
 				   make sure we aren't over writing
 				   things that are really from the
 				   parent
 				*/
-				if(new_qos[0] == '-') {
+				if (new_qos[0] == '-') {
 					xstrfmtcat(vals,
-						   ", qos=if(qos='', '', "
+						   ", qos=if (qos='', '', "
 						   "replace(qos, ',%s', ''))"
-						   ", delta_qos=if(qos='', "
+						   ", delta_qos=if (qos='', "
 						   "concat(replace(replace("
 						   "delta_qos, ',+%s', ''), "
 						   "',-%s', ''), ',%s'), '')",
 						   new_qos+1, new_qos+1,
 						   new_qos+1, new_qos);
-				} else if(new_qos[0] == '+') {
+				} else if (new_qos[0] == '+') {
 					xstrfmtcat(vals,
-						   ", qos=if(qos='', '', "
+						   ", qos=if (qos='', '', "
 						   "concat_ws(',', "
 						   "replace(qos, ',%s', ''), "
-						   "'%s')), delta_qos=if("
+						   "'%s')), delta_qos=if ("
 						   "qos='', concat("
 						   "replace(replace("
 						   "delta_qos, ',+%s', ''), "
@@ -1646,7 +1647,7 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 						   new_qos+1, new_qos+1,
 						   new_qos+1, new_qos+1,
 						   new_qos);
-				} else if(new_qos[0])
+				} else if (new_qos[0])
 					xstrfmtcat(tmp_qos, ",%s", new_qos);
 				else
 					xstrcat(tmp_qos, "");
@@ -1654,7 +1655,7 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 			}
 			list_iterator_destroy(new_qos_itr);
 
-			if(!set_qos_vals && tmp_qos)
+			if (!set_qos_vals && tmp_qos)
 				xstrfmtcat(vals, ", qos='%s', delta_qos=''",
 					   tmp_qos);
 			xfree(tmp_qos);
@@ -1663,7 +1664,7 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 		}
 
 
-		if(account_type)
+		if (account_type)
 			_modify_unset_users(mysql_conn,
 					    mod_assoc,
 					    row[MASSOC_ACCT],
@@ -1701,14 +1702,14 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 
 	xstrcat(name_char, ")");
 
-	if(assoc->parent_acct) {
-		if(((rc == ESLURM_INVALID_PARENT_ACCOUNT)
-		    || (rc == ESLURM_SAME_PARENT_ACCOUNT))
-		   && added)
+	if (assoc->parent_acct) {
+		if (((rc == ESLURM_INVALID_PARENT_ACCOUNT)
+		     || (rc == ESLURM_SAME_PARENT_ACCOUNT))
+		    && added)
 			rc = SLURM_SUCCESS;
 	}
 
-	if(rc != SLURM_SUCCESS)
+	if (rc != SLURM_SUCCESS)
 		goto end_it;
 
 	if (vals) {
@@ -1746,7 +1747,7 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 		local_assoc_list = as_mysql_get_assocs(
 			mysql_conn, user->uid, &local_assoc_cond);
 		list_destroy(local_assoc_cond.cluster_list);
-		if(!local_assoc_list)
+		if (!local_assoc_list)
 			goto end_it;
 		/* NOTE: you can not use list_pop, or list_push
 		   anywhere either, since as_mysql is
@@ -1757,17 +1758,17 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 		   comes out since we are moving it to the update_list.
 		*/
 		local_itr = list_iterator_create(local_assoc_list);
-		while((local_assoc = list_next(local_itr))) {
-			if(addto_update_list(mysql_conn->update_list,
-					     SLURMDB_MODIFY_ASSOC,
-					     local_assoc) == SLURM_SUCCESS)
+		while ((local_assoc = list_next(local_itr))) {
+			if (addto_update_list(mysql_conn->update_list,
+					      SLURMDB_MODIFY_ASSOC,
+					      local_assoc) == SLURM_SUCCESS)
 				list_remove(local_itr);
 		}
 		list_iterator_destroy(local_itr);
 		list_destroy(local_assoc_list);
 	}
 
-	if(reset_query) {
+	if (reset_query) {
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, reset_query);
 		if ((rc = mysql_db_query(mysql_conn, reset_query))
@@ -1799,30 +1800,30 @@ static int _process_remove_assoc_results(mysql_conn_t *mysql_conn,
 	uint32_t smallest_lft = 0xFFFFFFFF;
 
 	xassert(result);
-	if(*jobs_running)
+	if (*jobs_running)
 		goto skip_process;
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_association_rec_t *rem_assoc = NULL;
 		uint32_t lft;
 
-		if(!is_admin) {
+		if (!is_admin) {
 			slurmdb_coord_rec_t *coord = NULL;
-			if(!user->coord_accts) { // This should never
+			if (!user->coord_accts) { // This should never
 				// happen
 				error("We are here with no coord accts");
 				rc = ESLURM_ACCESS_DENIED;
 				goto end_it;
 			}
 			itr = list_iterator_create(user->coord_accts);
-			while((coord = list_next(itr))) {
-				if(!strcasecmp(coord->name,
-					       row[RASSOC_ACCT]))
+			while ((coord = list_next(itr))) {
+				if (!strcasecmp(coord->name,
+						row[RASSOC_ACCT]))
 					break;
 			}
 			list_iterator_destroy(itr);
 
-			if(!coord) {
+			if (!coord) {
 				error("User %s(%d) does not have the "
 				      "ability to change this account (%s)",
 				      user->name, user->uid, row[RASSOC_ACCT]);
@@ -1830,19 +1831,19 @@ static int _process_remove_assoc_results(mysql_conn_t *mysql_conn,
 				goto end_it;
 			}
 		}
-		if(row[RASSOC_PART][0]) {
+		if (row[RASSOC_PART][0]) {
 			// see if there is a partition name
 			object = xstrdup_printf(
 				"C = %-10s A = %-10s U = %-9s P = %s",
 				cluster_name, row[RASSOC_ACCT],
 				row[RASSOC_USER], row[RASSOC_PART]);
-		} else if(row[RASSOC_USER][0]){
+		} else if (row[RASSOC_USER][0]){
 			object = xstrdup_printf(
 				"C = %-10s A = %-10s U = %-9s",
 				cluster_name, row[RASSOC_ACCT],
 				row[RASSOC_USER]);
 		} else {
-			if(row[RASSOC_PACCT][0]) {
+			if (row[RASSOC_PACCT][0]) {
 				object = xstrdup_printf(
 					"C = %-10s A = %s of %s",
 					cluster_name, row[RASSOC_ACCT],
@@ -1854,7 +1855,7 @@ static int _process_remove_assoc_results(mysql_conn_t *mysql_conn,
 			}
 		}
 		list_append(ret_list, object);
-		if(assoc_char)
+		if (assoc_char)
 			xstrfmtcat(assoc_char, " || id_assoc=%s",
 				   row[RASSOC_ID]);
 		else
@@ -1864,16 +1865,16 @@ static int _process_remove_assoc_results(mysql_conn_t *mysql_conn,
 		   the modified lfts after it.
 		*/
 		lft = slurm_atoul(row[RASSOC_LFT]);
-		if(lft < smallest_lft)
+		if (lft < smallest_lft)
 			smallest_lft = lft;
 
 		rem_assoc = xmalloc(sizeof(slurmdb_association_rec_t));
 		slurmdb_init_association_rec(rem_assoc, 0);
 		rem_assoc->id = slurm_atoul(row[RASSOC_ID]);
 		rem_assoc->cluster = xstrdup(cluster_name);
-		if(addto_update_list(mysql_conn->update_list,
-				     SLURMDB_REMOVE_ASSOC,
-				     rem_assoc) != SLURM_SUCCESS) {
+		if (addto_update_list(mysql_conn->update_list,
+				      SLURMDB_REMOVE_ASSOC,
+				      rem_assoc) != SLURM_SUCCESS) {
 			slurmdb_destroy_association_rec(rem_assoc);
 			error("couldn't add to the update list");
 		}
@@ -1935,7 +1936,7 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 	uint16_t with_usage = 0;
 	uint16_t with_raw_qos = 0;
 
-	if(assoc_cond) {
+	if (assoc_cond) {
 		with_raw_qos = assoc_cond->with_raw_qos;
 		with_usage = assoc_cond->with_usage;
 		without_parent_limits = assoc_cond->without_parent_limits;
@@ -1946,14 +1947,14 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 	 * if this flag is set.  We also include any accounts they may be
 	 * coordinator of.
 	 */
-	if(!is_admin && (private_data & PRIVATE_DATA_USERS)) {
+	if (!is_admin && (private_data & PRIVATE_DATA_USERS)) {
 		int set = 0;
 		query = xstrdup_printf("select lft from %s where user='%s'",
 				       assoc_table, user->name);
-		if(user->coord_accts) {
+		if (user->coord_accts) {
 			slurmdb_coord_rec_t *coord = NULL;
 			itr = list_iterator_create(user->coord_accts);
-			while((coord = list_next(itr))) {
+			while ((coord = list_next(itr))) {
 				xstrfmtcat(query, " || acct='%s'",
 					   coord->name);
 			}
@@ -1961,16 +1962,16 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 		}
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(extra);
 			xfree(query);
 			return SLURM_ERROR;
 		}
 		xfree(query);
 		set = 0;
-		while((row = mysql_fetch_row(result))) {
-			if(set) {
+		while ((row = mysql_fetch_row(result))) {
+			if (set) {
 				xstrfmtcat(extra,
 					   " || (%s between lft and rgt)",
 					   row[0]);
@@ -1981,7 +1982,7 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 					   row[0]);
 			}
 		}
-		if(set)
+		if (set)
 			xstrcat(extra,")");
 		mysql_free_result(result);
 	}
@@ -1998,24 +1999,24 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 	xfree(extra);
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
-		if(mysql_errno(mysql_conn->db_conn) == ER_NO_SUCH_TABLE)
+		if (mysql_errno(mysql_conn->db_conn) == ER_NO_SUCH_TABLE)
 			return SLURM_SUCCESS;
 		else
 			return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(!mysql_num_rows(result)) {
+	if (!mysql_num_rows(result)) {
 		mysql_free_result(result);
 		return SLURM_SUCCESS;
 	}
 
 	assoc_list = list_create(slurmdb_destroy_association_rec);
 	delta_qos_list = list_create(slurm_destroy_char);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_association_rec_t *assoc =
 			xmalloc(sizeof(slurmdb_association_rec_t));
 		MYSQL_RES *result2 = NULL;
@@ -2027,68 +2028,70 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 		assoc->lft = slurm_atoul(row[ASSOC_REQ_LFT]);
 		assoc->rgt = slurm_atoul(row[ASSOC_REQ_RGT]);
 
-		if(row[ASSOC_REQ_USER][0])
+		if (row[ASSOC_REQ_USER][0])
 			assoc->user = xstrdup(row[ASSOC_REQ_USER]);
 		assoc->acct = xstrdup(row[ASSOC_REQ_ACCT]);
 		assoc->cluster = xstrdup(cluster_name);
 
-		if(row[ASSOC_REQ_GJ])
+		if (row[ASSOC_REQ_GJ])
 			assoc->grp_jobs = slurm_atoul(row[ASSOC_REQ_GJ]);
 		else
 			assoc->grp_jobs = INFINITE;
 
-		if(row[ASSOC_REQ_GSJ])
-			assoc->grp_submit_jobs = slurm_atoul(row[ASSOC_REQ_GSJ]);
+		if (row[ASSOC_REQ_GSJ])
+			assoc->grp_submit_jobs =
+				slurm_atoul(row[ASSOC_REQ_GSJ]);
 		else
 			assoc->grp_submit_jobs = INFINITE;
 
-		if(row[ASSOC_REQ_GC])
+		if (row[ASSOC_REQ_GC])
 			assoc->grp_cpus = slurm_atoul(row[ASSOC_REQ_GC]);
 		else
 			assoc->grp_cpus = INFINITE;
 
-		if(row[ASSOC_REQ_GN])
+		if (row[ASSOC_REQ_GN])
 			assoc->grp_nodes = slurm_atoul(row[ASSOC_REQ_GN]);
 		else
 			assoc->grp_nodes = INFINITE;
-		if(row[ASSOC_REQ_GW])
+		if (row[ASSOC_REQ_GW])
 			assoc->grp_wall = slurm_atoul(row[ASSOC_REQ_GW]);
 		else
 			assoc->grp_wall = INFINITE;
 
-		if(row[ASSOC_REQ_GCM])
+		if (row[ASSOC_REQ_GCM])
 			assoc->grp_cpu_mins = slurm_atoull(row[ASSOC_REQ_GCM]);
 		else
 			assoc->grp_cpu_mins = INFINITE;
 
-		if(row[ASSOC_REQ_GCRM])
-			assoc->grp_cpu_run_mins = slurm_atoull(row[ASSOC_REQ_GCRM]);
+		if (row[ASSOC_REQ_GCRM])
+			assoc->grp_cpu_run_mins =
+				slurm_atoull(row[ASSOC_REQ_GCRM]);
 		else
 			assoc->grp_cpu_run_mins = INFINITE;
 
 		parent_acct = row[ASSOC_REQ_ACCT];
-		if(!without_parent_info
-		   && row[ASSOC_REQ_PARENT][0]) {
+		if (!without_parent_info
+		    && row[ASSOC_REQ_PARENT][0]) {
 			assoc->parent_acct = xstrdup(row[ASSOC_REQ_PARENT]);
 			parent_acct = row[ASSOC_REQ_PARENT];
-		} else if(!assoc->user) {
+		} else if (!assoc->user) {
 			/* This is the root association so we have no
 			   parent id */
 			parent_acct = NULL;
 			parent_id = 0;
 		}
 
-		if(row[ASSOC_REQ_PART][0])
+		if (row[ASSOC_REQ_PART][0])
 			assoc->partition = xstrdup(row[ASSOC_REQ_PART]);
-		if(row[ASSOC_REQ_FS])
+		if (row[ASSOC_REQ_FS])
 			assoc->shares_raw = slurm_atoul(row[ASSOC_REQ_FS]);
 		else
 			assoc->shares_raw = 1;
 
-		if(!without_parent_info && parent_acct &&
-		   (!last_acct || !last_cluster
-		    || strcmp(parent_acct, last_acct)
-		    || strcmp(cluster_name, last_cluster))) {
+		if (!without_parent_info && parent_acct &&
+		    (!last_acct || !last_cluster
+		     || strcmp(parent_acct, last_acct)
+		     || strcmp(cluster_name, last_cluster))) {
 			query = xstrdup_printf(
 				"call get_parent_limits('%s', "
 				"'%s', '%s', %u); %s",
@@ -2098,75 +2101,77 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 				get_parent_limits_select);
 			debug4("%d(%s:%d) query\n%s",
 			       mysql_conn->conn, THIS_FILE, __LINE__, query);
-			if(!(result2 = mysql_db_query_ret(
-				     mysql_conn, query, 1))) {
+			if (!(result2 = mysql_db_query_ret(
+				      mysql_conn, query, 1))) {
 				xfree(query);
 				break;
 			}
 			xfree(query);
 
-			if(!(row2 = mysql_fetch_row(result2))) {
+			if (!(row2 = mysql_fetch_row(result2))) {
 				parent_id = 0;
 				goto no_parent_limits;
 			}
 
 			parent_id = slurm_atoul(row2[ASSOC2_REQ_PARENT_ID]);
-			if(!without_parent_limits) {
-				if(row2[ASSOC2_REQ_DEF_QOS])
-					parent_def_qos_id =
-						slurm_atoul(row2[ASSOC2_REQ_DEF_QOS]);
+			if (!without_parent_limits) {
+				if (row2[ASSOC2_REQ_DEF_QOS])
+					parent_def_qos_id = slurm_atoul(
+						row2[ASSOC2_REQ_DEF_QOS]);
 				else
 					parent_def_qos_id = 0;
 
-				if(row2[ASSOC2_REQ_MJ])
-					parent_mj = slurm_atoul(row2[ASSOC2_REQ_MJ]);
+				if (row2[ASSOC2_REQ_MJ])
+					parent_mj = slurm_atoul(
+						row2[ASSOC2_REQ_MJ]);
 				else
 					parent_mj = INFINITE;
 
-				if(row2[ASSOC2_REQ_MSJ])
-					parent_msj = slurm_atoul(row2[ASSOC2_REQ_MSJ]);
+				if (row2[ASSOC2_REQ_MSJ])
+					parent_msj = slurm_atoul(
+						row2[ASSOC2_REQ_MSJ]);
 				else
 					parent_msj = INFINITE;
 
-				if(row2[ASSOC2_REQ_MCPJ])
-					parent_mcpj =
-						slurm_atoul(row2[ASSOC2_REQ_MCPJ]);
+				if (row2[ASSOC2_REQ_MCPJ])
+					parent_mcpj = slurm_atoul(
+						row2[ASSOC2_REQ_MCPJ]);
 				else
 					parent_mcpj = INFINITE;
 
-				if(row2[ASSOC2_REQ_MNPJ])
-					parent_mnpj =
-						slurm_atoul(row2[ASSOC2_REQ_MNPJ]);
+				if (row2[ASSOC2_REQ_MNPJ])
+					parent_mnpj = slurm_atoul(
+							row2[ASSOC2_REQ_MNPJ]);
 				else
 					parent_mnpj = INFINITE;
 
-				if(row2[ASSOC2_REQ_MWPJ])
-					parent_mwpj =
-						slurm_atoul(row2[ASSOC2_REQ_MWPJ]);
+				if (row2[ASSOC2_REQ_MWPJ])
+					parent_mwpj = slurm_atoul(
+						row2[ASSOC2_REQ_MWPJ]);
 				else
 					parent_mwpj = INFINITE;
 
-				if(row2[ASSOC2_REQ_MCMPJ])
-					parent_mcmpj =
-						slurm_atoull(row2[ASSOC2_REQ_MCMPJ]);
+				if (row2[ASSOC2_REQ_MCMPJ])
+					parent_mcmpj = slurm_atoull(
+						row2[ASSOC2_REQ_MCMPJ]);
 				else
 					parent_mcmpj = INFINITE;
 
-				if(row2[ASSOC2_REQ_MCRM])
-					parent_mcrm =
-						slurm_atoull(row2[ASSOC2_REQ_MCRM]);
+				if (row2[ASSOC2_REQ_MCRM])
+					parent_mcrm = slurm_atoull(
+						row2[ASSOC2_REQ_MCRM]);
 				else
 					parent_mcrm = (uint64_t)INFINITE;
 
 				xfree(parent_qos);
-				if(row2[ASSOC2_REQ_QOS][0])
+				if (row2[ASSOC2_REQ_QOS][0])
 					parent_qos =
 						xstrdup(row2[ASSOC2_REQ_QOS]);
 				else
 					parent_qos = NULL;
 
 				xfree(parent_delta_qos);
-				if(row2[ASSOC2_REQ_DELTA_QOS][0])
+				if (row2[ASSOC2_REQ_DELTA_QOS][0])
 					parent_delta_qos = xstrdup(
 						row2[ASSOC2_REQ_DELTA_QOS]);
 				else
@@ -2178,43 +2183,46 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 			mysql_free_result(result2);
 		}
 
-		if(row[ASSOC_REQ_DEF_QOS])
+		if (row[ASSOC_REQ_DEF_QOS])
 			assoc->def_qos_id = slurm_atoul(row[ASSOC_REQ_DEF_QOS]);
 		else
 			assoc->def_qos_id = parent_def_qos_id;
 
-		if(row[ASSOC_REQ_MJ])
+		if (row[ASSOC_REQ_MJ])
 			assoc->max_jobs = slurm_atoul(row[ASSOC_REQ_MJ]);
 		else
 			assoc->max_jobs = parent_mj;
 
-		if(row[ASSOC_REQ_MSJ])
-			assoc->max_submit_jobs = slurm_atoul(row[ASSOC_REQ_MSJ]);
+		if (row[ASSOC_REQ_MSJ])
+			assoc->max_submit_jobs = slurm_atoul(
+				row[ASSOC_REQ_MSJ]);
 		else
 			assoc->max_submit_jobs = parent_msj;
 
-		if(row[ASSOC_REQ_MCPJ])
+		if (row[ASSOC_REQ_MCPJ])
 			assoc->max_cpus_pj = slurm_atoul(row[ASSOC_REQ_MCPJ]);
 		else
 			assoc->max_cpus_pj = parent_mcpj;
 
-		if(row[ASSOC_REQ_MNPJ])
+		if (row[ASSOC_REQ_MNPJ])
 			assoc->max_nodes_pj = slurm_atoul(row[ASSOC_REQ_MNPJ]);
 		else
 			assoc->max_nodes_pj = parent_mnpj;
 
-		if(row[ASSOC_REQ_MWPJ])
+		if (row[ASSOC_REQ_MWPJ])
 			assoc->max_wall_pj = slurm_atoul(row[ASSOC_REQ_MWPJ]);
 		else
 			assoc->max_wall_pj = parent_mwpj;
 
-		if(row[ASSOC_REQ_MCMPJ])
-			assoc->max_cpu_mins_pj = slurm_atoull(row[ASSOC_REQ_MCMPJ]);
+		if (row[ASSOC_REQ_MCMPJ])
+			assoc->max_cpu_mins_pj = slurm_atoull(
+				row[ASSOC_REQ_MCMPJ]);
 		else
 			assoc->max_cpu_mins_pj = parent_mcmpj;
 
-		if(row[ASSOC_REQ_MCRM])
-			assoc->max_cpu_run_mins = slurm_atoull(row[ASSOC_REQ_MCRM]);
+		if (row[ASSOC_REQ_MCRM])
+			assoc->max_cpu_run_mins = slurm_atoull(
+				row[ASSOC_REQ_MCRM]);
 		else
 			assoc->max_cpu_run_mins = parent_mcrm;
 
@@ -2226,7 +2234,7 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 		 * about the delta.
 		 */
 
-		if(row[ASSOC_REQ_QOS][0])
+		if (row[ASSOC_REQ_QOS][0])
 			slurm_addto_char_list(assoc->qos_list,
 					      row[ASSOC_REQ_QOS]+1);
 		else {
@@ -2235,17 +2243,17 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 			*/
 
 			/* add the parents first */
-			if(parent_qos)
+			if (parent_qos)
 				slurm_addto_char_list(assoc->qos_list,
 						      parent_qos+1);
 
 			/* then add the parents delta */
-			if(parent_delta_qos)
+			if (parent_delta_qos)
 				slurm_addto_char_list(delta_qos_list,
 						      parent_delta_qos+1);
 
 			/* now add the associations */
-			if(row[ASSOC_REQ_DELTA_QOS][0])
+			if (row[ASSOC_REQ_DELTA_QOS][0])
 				slurm_addto_char_list(
 					delta_qos_list,
 					row[ASSOC_REQ_DELTA_QOS]+1);
@@ -2255,37 +2263,37 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 		   the database instead of a complete list.  This will
 		   give it to us.
 		*/
-		if(with_raw_qos && list_count(delta_qos_list)) {
+		if (with_raw_qos && list_count(delta_qos_list)) {
 			list_transfer(assoc->qos_list, delta_qos_list);
 			list_flush(delta_qos_list);
-		} else if(list_count(delta_qos_list)) {
+		} else if (list_count(delta_qos_list)) {
 			ListIterator curr_qos_itr =
 				list_iterator_create(assoc->qos_list);
 			ListIterator new_qos_itr =
 				list_iterator_create(delta_qos_list);
 			char *new_qos = NULL, *curr_qos = NULL;
 
-			while((new_qos = list_next(new_qos_itr))) {
-				if(new_qos[0] == '-') {
-					while((curr_qos =
-					       list_next(curr_qos_itr))) {
-						if(!strcmp(curr_qos,
-							   new_qos+1)) {
+			while ((new_qos = list_next(new_qos_itr))) {
+				if (new_qos[0] == '-') {
+					while ((curr_qos =
+						list_next(curr_qos_itr))) {
+						if (!strcmp(curr_qos,
+							    new_qos+1)) {
 							list_delete_item(
 								curr_qos_itr);
 							break;
 						}
 					}
 					list_iterator_reset(curr_qos_itr);
-				} else if(new_qos[0] == '+') {
-					while((curr_qos =
-					       list_next(curr_qos_itr))) {
-						if(!strcmp(curr_qos,
-							   new_qos+1)) {
+				} else if (new_qos[0] == '+') {
+					while ((curr_qos =
+						list_next(curr_qos_itr))) {
+						if (!strcmp(curr_qos,
+							    new_qos+1)) {
 							break;
 						}
 					}
-					if(!curr_qos) {
+					if (!curr_qos) {
 						list_append(assoc->qos_list,
 							    xstrdup(new_qos+1));
 					}
@@ -2310,7 +2318,7 @@ static int _cluster_get_assocs(mysql_conn_t *mysql_conn,
 	xfree(parent_delta_qos);
 	xfree(parent_qos);
 
-	if(with_usage && assoc_list && list_count(assoc_list))
+	if (with_usage && assoc_list && list_count(assoc_list))
 		get_usage_for_list(mysql_conn, DBD_GET_ASSOC_USAGE,
 				   assoc_list, cluster_name,
 				   assoc_cond->usage_start,
@@ -2332,24 +2340,24 @@ extern int as_mysql_get_modified_lfts(mysql_conn_t *mysql_conn,
 
 	debug3("%d(%d) query\n%s",
 	       mysql_conn->conn, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		error("couldn't query the database for modified lfts");
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_association_rec_t *assoc =
 			xmalloc(sizeof(slurmdb_association_rec_t));
 		slurmdb_init_association_rec(assoc, 0);
 		assoc->id = slurm_atoul(row[0]);
 		assoc->lft = slurm_atoul(row[1]);
 		assoc->cluster = xstrdup(cluster_name);
-		if(addto_update_list(mysql_conn->update_list,
-				     SLURMDB_MODIFY_ASSOC,
-				     assoc) != SLURM_SUCCESS)
+		if (addto_update_list(mysql_conn->update_list,
+				      SLURMDB_MODIFY_ASSOC,
+				      assoc) != SLURM_SUCCESS)
 			slurmdb_destroy_association_rec(assoc);
 	}
 	mysql_free_result(result);
@@ -2381,12 +2389,12 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 	List local_cluster_list = NULL;
 	List added_user_list = NULL;
 
-	if(!association_list) {
+	if (!association_list) {
 		error("No association list given");
 		return SLURM_ERROR;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	local_cluster_list = list_create(NULL);
@@ -2395,9 +2403,9 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 	list_sort(association_list, (ListCmpF)_assoc_sort_cluster);
 
 	itr = list_iterator_create(association_list);
-	while((object = list_next(itr))) {
-		if(!object->cluster || !object->cluster[0]
-		   || !object->acct || !object->acct[0]) {
+	while ((object = list_next(itr))) {
+		if (!object->cluster || !object->cluster[0]
+		    || !object->acct || !object->acct[0]) {
 			error("We need a association cluster and "
 			      "acct to add one.");
 			rc = SLURM_ERROR;
@@ -2406,9 +2414,9 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 
 		list_append(local_cluster_list, object->cluster);
 
-		if(object->parent_acct) {
+		if (object->parent_acct) {
 			parent = object->parent_acct;
-		} else if(object->user) {
+		} else if (object->user) {
 			parent = object->acct;
 		} else {
 			parent = "root";
@@ -2421,7 +2429,7 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 
 		xstrfmtcat(extra, ", mod_time=%ld, acct='%s'",
 			   now, object->acct);
-		if(!object->user) {
+		if (!object->user) {
 			xstrcat(cols, ", parent_acct");
 			xstrfmtcat(vals, ", '%s'", parent);
 			xstrfmtcat(extra, ", parent_acct='%s', user=''",
@@ -2437,7 +2445,7 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 			/* We need to give a partition whether it be
 			 * '' or the actual partition name given
 			 */
-			if(!part)
+			if (!part)
 				part = "";
 			xstrcat(cols, ", partition");
 			xstrfmtcat(vals, ", '%s'", part);
@@ -2462,8 +2470,8 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		xfree(tmp_char);
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
 			xfree(cols);
 			xfree(vals);
@@ -2476,7 +2484,7 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		xfree(query);
 
 		assoc_id = 0;
-		if(!(row = mysql_fetch_row(result))) {
+		if (!(row = mysql_fetch_row(result))) {
 			/* This code speeds up the add process quite a bit
 			 * here we are only doing an update when we are done
 			 * adding to a specific group (cluster/account) other
@@ -2487,9 +2495,9 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 			 * loop to catch everything on the last spin of the
 			 * while.
 			 */
-			if(!old_parent || !old_cluster
-			   || strcasecmp(parent, old_parent)
-			   || strcasecmp(object->cluster, old_cluster)) {
+			if (!old_parent || !old_cluster
+			    || strcasecmp(parent, old_parent)
+			    || strcasecmp(object->cluster, old_cluster)) {
 				char *sel_query = xstrdup_printf(
 					"SELECT lft FROM \"%s_%s\" WHERE "
 					"acct = '%s' and user = '' "
@@ -2498,7 +2506,7 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 					parent);
 				MYSQL_RES *sel_result = NULL;
 
-				if(incr) {
+				if (incr) {
 					char *up_query = xstrdup_printf(
 						"UPDATE \"%s_%s\" SET "
 						"rgt = rgt+%d "
@@ -2522,7 +2530,7 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 						mysql_conn,
 						up_query);
 					xfree(up_query);
-					if(rc != SLURM_SUCCESS) {
+					if (rc != SLURM_SUCCESS) {
 						error("Couldn't do update");
 						xfree(cols);
 						xfree(vals);
@@ -2535,9 +2543,9 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 
 				debug3("%d(%s:%d) query\n%s", mysql_conn->conn,
 				       THIS_FILE, __LINE__, sel_query);
-				if(!(sel_result = mysql_db_query_ret(
-					     mysql_conn,
-					     sel_query, 0))) {
+				if (!(sel_result = mysql_db_query_ret(
+					      mysql_conn,
+					      sel_query, 0))) {
 					xfree(cols);
 					xfree(vals);
 					xfree(update);
@@ -2547,7 +2555,7 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 					break;
 				}
 
-				if(!(row = mysql_fetch_row(sel_result))) {
+				if (!(row = mysql_fetch_row(sel_result))) {
 					error("Couldn't get left from "
 					      "query\n%s",
 					      sel_query);
@@ -2597,7 +2605,7 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 /* 				   "values (%s, @myLeft+1, @myLeft+2);", */
 /* 				   assoc_table, cols, */
 /* 				   vals); */
-		} else if(!slurm_atoul(row[AASSOC_DELETED])) {
+		} else if (!slurm_atoul(row[AASSOC_DELETED])) {
 			/* We don't need to do anything here */
 			debug("This account was added already");
 			xfree(cols);
@@ -2616,18 +2624,18 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 			 * check for the parent and move if needed.
 			 */
 			assoc_id = slurm_atoul(row[AASSOC_ID]);
-			if(object->parent_acct
-			   && strcasecmp(object->parent_acct,
-					 row[AASSOC_PACCT])) {
+			if (object->parent_acct
+			    && strcasecmp(object->parent_acct,
+					  row[AASSOC_PACCT])) {
 
 				/* We need to move the parent! */
-				if(_move_parent(mysql_conn, uid,
-						&lft, &rgt,
-						object->cluster,
-						row[AASSOC_ID],
-						row[AASSOC_PACCT],
-						object->parent_acct, now)
-				   == SLURM_ERROR)
+				if (_move_parent(mysql_conn, uid,
+						 &lft, &rgt,
+						 object->cluster,
+						 row[AASSOC_ID],
+						 row[AASSOC_PACCT],
+						 object->parent_acct, now)
+				    == SLURM_ERROR)
 					continue;
 				moved_parent = 1;
 			} else {
@@ -2651,7 +2659,7 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't add assoc");
 			xfree(extra);
 			break;
@@ -2659,7 +2667,7 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		/* see if this was an insert or update.  On an update
 		 * the assoc_id will already be set
 		 */
-		if(!assoc_id) {
+		if (!assoc_id) {
 			affect_rows = last_affected_rows(mysql_conn);
 			assoc_id = mysql_insert_id(mysql_conn->db_conn);
 			//info("last id was %d", assoc_id);
@@ -2670,14 +2678,14 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		/* get the parent id only if we haven't moved the
 		 * parent since we get the total list if that has
 		 * happened */
-		if(!moved_parent &&
-		   (!last_parent || !last_cluster
-		    || strcmp(parent, last_parent)
-		    || strcmp(object->cluster, last_cluster))) {
+		if (!moved_parent &&
+		    (!last_parent || !last_cluster
+		     || strcmp(parent, last_parent)
+		     || strcmp(object->cluster, last_cluster))) {
 			uint32_t tmp32 = 0;
-			if((tmp32 = _get_parent_id(mysql_conn,
-						   parent,
-						   object->cluster))) {
+			if ((tmp32 = _get_parent_id(mysql_conn,
+						    parent,
+						    object->cluster))) {
 				my_par_id = tmp32;
 
 				last_parent = parent;
@@ -2701,7 +2709,7 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		/* we always have a ', ' as the first 2 chars */
 		tmp_extra = slurm_add_slash_to_quotes(extra+2);
 
-		if(txn_query)
+		if (txn_query)
 			xstrfmtcat(txn_query,
 				   ", (%ld, %d, 'id_assoc=%d', "
 				   "'%s', '%s', '%s')",
@@ -2722,10 +2730,10 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 	list_iterator_destroy(itr);
 	xfree(user_name);
 
-	if(rc != SLURM_SUCCESS)
+	if (rc != SLURM_SUCCESS)
 		goto end_it;
 
-	if(incr) {
+	if (incr) {
 		char *up_query = xstrdup_printf(
 			"UPDATE \"%s_%s\" SET rgt = rgt+%d "
 			"WHERE rgt > %d && deleted < 2;"
@@ -2743,39 +2751,39 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		       mysql_conn->conn, THIS_FILE, __LINE__, up_query);
 		rc = mysql_db_query(mysql_conn, up_query);
 		xfree(up_query);
-		if(rc != SLURM_SUCCESS)
+		if (rc != SLURM_SUCCESS)
 			error("Couldn't do update 2");
 
 	}
 
-	if(!moved_parent) {
+	if (!moved_parent) {
 		slurmdb_update_object_t *update_object = NULL;
 
 		itr = list_iterator_create(
 			mysql_conn->update_list);;
-		while((update_object = list_next(itr))) {
-			if(!update_object->objects
-			   || !list_count(update_object->objects))
+		while ((update_object = list_next(itr))) {
+			if (!update_object->objects
+			    || !list_count(update_object->objects))
 				continue;
-			if(update_object->type == SLURMDB_ADD_ASSOC)
+			if (update_object->type == SLURMDB_ADD_ASSOC)
 				break;
 		}
 		list_iterator_destroy(itr);
 
-		if(update_object && update_object->objects
-		   && list_count(update_object->objects)) {
+		if (update_object && update_object->objects
+		    && list_count(update_object->objects)) {
 			char *cluster_name;
 			ListIterator itr2 =
 				list_iterator_create(update_object->objects);
 
 			slurm_mutex_lock(&as_mysql_cluster_list_lock);
 			itr = list_iterator_create(as_mysql_cluster_list);
-			while((cluster_name = list_next(itr))) {
+			while ((cluster_name = list_next(itr))) {
 				uint32_t smallest_lft = 0xFFFFFFFF;
-				while((object = list_next(itr2))) {
-					if(object->lft < smallest_lft
-					   && !strcmp(object->cluster,
-						      cluster_name))
+				while ((object = list_next(itr2))) {
+					if (object->lft < smallest_lft
+					    && !strcmp(object->cluster,
+						       cluster_name))
 						smallest_lft = object->lft;
 				}
 				list_iterator_reset(itr2);
@@ -2806,7 +2814,8 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 			goto end_it;
 		}
 
-		/* xstrfmtcat(query, "update \"%s_%s\" set is_def=0, mod_time=%ld " */
+		/* xstrfmtcat(query, "update \"%s_%s\" set is_def=0, " */
+		/* 	   "mod_time=%ld " */
 		/* 	   "where (user='%s' && acct!='%s' && is_def=1);", */
 		/* 	   object->cluster, assoc_table, (long)now, */
 		/* 	   object->user, object->acct); */
@@ -2827,7 +2836,7 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		/* 	debug("%d(%s:%d) query\n%s", */
 		/* 	       mysql_conn->conn, THIS_FILE, */
 		/* 	       __LINE__, query); */
-		/* 	if(!(result = mysql_db_query_ret( */
+		/* 	if (!(result = mysql_db_query_ret( */
 		/* 		     mysql_conn, query, 1))) { */
 		/* 		xfree(query); */
 		/* 		rc = SLURM_ERROR; */
@@ -2835,15 +2844,15 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		/* 	} */
 		/* 	xfree(query); */
 
-		/* 	while((row = mysql_fetch_row(result))) { */
-		/* 		slurmdb_association_rec_t *mod_assoc = xmalloc( */
+		/* 	while ((row = mysql_fetch_row(result))) { */
+		/* 	      slurmdb_association_rec_t *mod_assoc = xmalloc( */
 		/* 			sizeof(slurmdb_association_rec_t)); */
 		/* 		slurmdb_init_association_rec(mod_assoc, 0); */
 
 		/* 		mod_assoc->id = slurm_atoul(row[0]); */
 		/* 		mod_assoc->is_def = 0; */
 
-		/* 		if (addto_update_list(mysql_conn->update_list, */
+		/* 		if (addto_update_list(mysql_conn->update_list,*/
 		/* 				      SLURMDB_MODIFY_ASSOC, */
 		/* 				      mod_assoc) */
 		/* 		    != SLURM_SUCCESS) { */
@@ -2859,17 +2868,17 @@ extern int as_mysql_add_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		/* } */
 	}
 	list_iterator_destroy(itr);
-	if(query) {
+	if (query) {
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS)
+		if (rc != SLURM_SUCCESS)
 			error("Couldn't update defaults");
 	}
 end_it:
 
-	if(rc != SLURM_ERROR) {
+	if (rc != SLURM_ERROR) {
 		_make_sure_users_have_default(mysql_conn, added_user_list);
 
 		if (txn_query) {
@@ -2880,12 +2889,12 @@ end_it:
 			rc = mysql_db_query(mysql_conn,
 					    txn_query);
 			xfree(txn_query);
-			if(rc != SLURM_SUCCESS) {
+			if (rc != SLURM_SUCCESS) {
 				error("Couldn't add txn");
 				rc = SLURM_SUCCESS;
 			}
 		}
-		if(moved_parent) {
+		if (moved_parent) {
 			List assoc_list = NULL;
 			ListIterator itr = NULL;
 			slurmdb_association_rec_t *assoc = NULL;
@@ -2903,8 +2912,8 @@ end_it:
 			memset(&assoc_cond, 0,
 			       sizeof(slurmdb_association_cond_t));
 			assoc_cond.cluster_list = local_cluster_list;
-			if(!(assoc_list =
-			     as_mysql_get_assocs(mysql_conn, uid, NULL))) {
+			if (!(assoc_list =
+			      as_mysql_get_assocs(mysql_conn, uid, NULL))) {
 				list_destroy(local_cluster_list);
 				return rc;
 			}
@@ -2917,10 +2926,10 @@ end_it:
 			   comes out since we are moving it to the update_list.
 			*/
 			itr = list_iterator_create(assoc_list);
-			while((assoc = list_next(itr))) {
-				if(addto_update_list(mysql_conn->update_list,
-						     SLURMDB_MODIFY_ASSOC,
-						     assoc) == SLURM_SUCCESS)
+			while ((assoc = list_next(itr))) {
+				if (addto_update_list(mysql_conn->update_list,
+						      SLURMDB_MODIFY_ASSOC,
+						      assoc) == SLURM_SUCCESS)
 					list_remove(itr);
 			}
 			list_iterator_destroy(itr);
@@ -2953,21 +2962,21 @@ extern List as_mysql_modify_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 	char *prefix = "t1";
 	List use_cluster_list = as_mysql_cluster_list;
 
-	if(!assoc_cond || !assoc) {
+	if (!assoc_cond || !assoc) {
 		error("we need something to change");
 		return NULL;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	memset(&user, 0, sizeof(slurmdb_user_rec_t));
 	user.uid = uid;
 
-	if(!(is_admin = is_user_min_admin_level(
-		     mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
-		if(assoc_cond->user_list
-		   && (list_count(assoc_cond->user_list) == 1)) {
+	if (!(is_admin = is_user_min_admin_level(
+		      mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
+		if (assoc_cond->user_list
+		    && (list_count(assoc_cond->user_list) == 1)) {
 			uid_t pw_uid;
 			char *name;
 			name = list_peek(assoc_cond->user_list);
@@ -2983,7 +2992,7 @@ extern List as_mysql_modify_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 			}
 		}
 
-		if(!is_user_any_coord(mysql_conn, &user)) {
+		if (!is_user_any_coord(mysql_conn, &user)) {
 			error("Only admins/coordinators can "
 			      "modify associations");
 			errno = ESLURM_ACCESS_DENIED;
@@ -2992,8 +3001,8 @@ extern List as_mysql_modify_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 	}
 is_same_user:
 
-	if((assoc_cond->qos_list && list_count(assoc_cond->qos_list))
-	   || assoc_cond->with_sub_accts)
+	if ((assoc_cond->qos_list && list_count(assoc_cond->qos_list))
+	    || assoc_cond->with_sub_accts)
 		prefix = "t2";
 
 	set = _setup_association_cond_limits(assoc_cond, prefix, &extra);
@@ -3014,8 +3023,8 @@ is_same_user:
 	xfree(tmp_char1);
 	xfree(tmp_char2);
 
-	if(!extra || (!vals && !assoc->parent_acct
-		      && (!assoc->qos_list || !list_count(assoc->qos_list)))) {
+	if (!extra || (!vals && !assoc->parent_acct
+		       && (!assoc->qos_list || !list_count(assoc->qos_list)))) {
 		xfree(vals);
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		error("Nothing to change");
@@ -3028,13 +3037,13 @@ is_same_user:
 
 	ret_list = list_create(slurm_destroy_char);
 
-	if(assoc_cond->cluster_list && list_count(assoc_cond->cluster_list))
+	if (assoc_cond->cluster_list && list_count(assoc_cond->cluster_list))
 		use_cluster_list = assoc_cond->cluster_list;
 	else
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 
 	itr = list_iterator_create(use_cluster_list);
-	while((cluster_name = list_next(itr))) {
+	while ((cluster_name = list_next(itr))) {
 		char *qos_extra = _setup_association_cond_qos(
 			assoc_cond, cluster_name);
 
@@ -3046,11 +3055,11 @@ is_same_user:
 		xfree(qos_extra);
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
-			if(mysql_errno(mysql_conn->db_conn)
-			   != ER_NO_SUCH_TABLE) {
+			if (mysql_errno(mysql_conn->db_conn)
+			    != ER_NO_SUCH_TABLE) {
 				list_destroy(ret_list);
 				ret_list = NULL;
 			}
@@ -3062,26 +3071,26 @@ is_same_user:
 						   is_admin, ret_list);
 		mysql_free_result(result);
 
-		if((rc == ESLURM_INVALID_PARENT_ACCOUNT)
-		   || (rc == ESLURM_SAME_PARENT_ACCOUNT)) {
+		if ((rc == ESLURM_INVALID_PARENT_ACCOUNT)
+		    || (rc == ESLURM_SAME_PARENT_ACCOUNT)) {
 			continue;
-		} else if(rc != SLURM_SUCCESS) {
+		} else if (rc != SLURM_SUCCESS) {
 			list_destroy(ret_list);
 			ret_list = NULL;
 			break;
 		}
 	}
 	list_iterator_destroy(itr);
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 	xfree(vals);
 	xfree(object);
 	xfree(extra);
 
-	if(!ret_list) {
+	if (!ret_list) {
 		reset_mysql_conn(mysql_conn);
 		return NULL;
-	} else if(!list_count(ret_list)) {
+	} else if (!list_count(ret_list)) {
 		reset_mysql_conn(mysql_conn);
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		debug3("didn't effect anything");
@@ -3107,20 +3116,20 @@ extern List as_mysql_remove_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 	List use_cluster_list = as_mysql_cluster_list;
 	bool jobs_running = 0;
 
-	if(!assoc_cond) {
+	if (!assoc_cond) {
 		error("we need something to change");
 		return NULL;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	memset(&user, 0, sizeof(slurmdb_user_rec_t));
 	user.uid = uid;
 
-	if(!(is_admin = is_user_min_admin_level(
-		     mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
-		if(!is_user_any_coord(mysql_conn, &user)) {
+	if (!(is_admin = is_user_min_admin_level(
+		      mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
+		if (!is_user_any_coord(mysql_conn, &user)) {
 			error("Only admins/coordinators can "
 			      "remove associations");
 			errno = ESLURM_ACCESS_DENIED;
@@ -3128,8 +3137,8 @@ extern List as_mysql_remove_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		}
 	}
 
-	if((assoc_cond->qos_list && list_count(assoc_cond->qos_list))
-	   || assoc_cond->with_sub_accts)
+	if ((assoc_cond->qos_list && list_count(assoc_cond->qos_list))
+	    || assoc_cond->with_sub_accts)
 		prefix = "t2";
 
 	set = _setup_association_cond_limits(assoc_cond, prefix, &extra);
@@ -3140,13 +3149,13 @@ extern List as_mysql_remove_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	ret_list = list_create(slurm_destroy_char);
 
-	if(assoc_cond->cluster_list && list_count(assoc_cond->cluster_list))
+	if (assoc_cond->cluster_list && list_count(assoc_cond->cluster_list))
 		use_cluster_list = assoc_cond->cluster_list;
 	else
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 
 	itr = list_iterator_create(use_cluster_list);
-	while((cluster_name = list_next(itr))) {
+	while ((cluster_name = list_next(itr))) {
 		char *qos_extra = _setup_association_cond_qos(
 			assoc_cond, cluster_name);
 
@@ -3158,11 +3167,11 @@ extern List as_mysql_remove_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		xfree(qos_extra);
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
-			if(mysql_errno(mysql_conn->db_conn)
-			   != ER_NO_SUCH_TABLE) {
+			if (mysql_errno(mysql_conn->db_conn)
+			    != ER_NO_SUCH_TABLE) {
 				list_destroy(ret_list);
 				ret_list = NULL;
 			}
@@ -3170,13 +3179,13 @@ extern List as_mysql_remove_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		}
 		xfree(query);
 
-		if(!mysql_num_rows(result)) {
+		if (!mysql_num_rows(result)) {
 			mysql_free_result(result);
 			continue;
 		}
 
-		while((row = mysql_fetch_row(result))) {
-			if(name_char)
+		while ((row = mysql_fetch_row(result))) {
+			if (name_char)
 				xstrfmtcat(name_char,
 					   " || lft between %s and %s",
 					   row[0], row[1]);
@@ -3193,8 +3202,8 @@ extern List as_mysql_remove_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 				       cluster_name, assoc_table, name_char);
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
 			xfree(name_char);
 			list_destroy(ret_list);
@@ -3210,28 +3219,28 @@ extern List as_mysql_remove_assocs(mysql_conn_t *mysql_conn, uint32_t uid,
 		xfree(name_char);
 		mysql_free_result(result);
 
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			list_destroy(ret_list);
 			ret_list = NULL;
 			break;
 		}
 	}
 	list_iterator_destroy(itr);
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 	xfree(object);
 	xfree(extra);
 
-	if(!ret_list) {
+	if (!ret_list) {
 		reset_mysql_conn(mysql_conn);
 		return NULL;
-	} else if(!list_count(ret_list)) {
+	} else if (!list_count(ret_list)) {
 		reset_mysql_conn(mysql_conn);
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		debug3("didn't effect anything");
 		return ret_list;
 	}
-	if(jobs_running)
+	if (jobs_running)
 		errno = ESLURM_JOBS_RUNNING_ON_ASSOC;
 	else
 		errno = SLURM_SUCCESS;
@@ -3254,12 +3263,12 @@ extern List as_mysql_get_assocs(mysql_conn_t *mysql_conn, uid_t uid,
 	List use_cluster_list = as_mysql_cluster_list;
 	char *cluster_name = NULL;
 
-	if(!assoc_cond) {
+	if (!assoc_cond) {
 		xstrcat(extra, " where deleted=0");
 		goto empty;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	memset(&user, 0, sizeof(slurmdb_user_rec_t));
@@ -3267,8 +3276,8 @@ extern List as_mysql_get_assocs(mysql_conn_t *mysql_conn, uid_t uid,
 
 	private_data = slurm_get_private_data();
 	if (private_data & PRIVATE_DATA_USERS) {
-		if(!(is_admin = is_user_min_admin_level(
-			     mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
+		if (!(is_admin = is_user_min_admin_level(
+			      mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
 			/* Fill in the user with any accounts they may
 			   be coordinator of, which is checked inside
 			   _cluster_get_assocs.
@@ -3278,13 +3287,13 @@ extern List as_mysql_get_assocs(mysql_conn_t *mysql_conn, uid_t uid,
 		}
 	}
 
-	if((assoc_cond->qos_list && list_count(assoc_cond->qos_list))
-	   || assoc_cond->with_sub_accts)
+	if ((assoc_cond->qos_list && list_count(assoc_cond->qos_list))
+	    || assoc_cond->with_sub_accts)
 		prefix = "t2";
 
 	set = _setup_association_cond_limits(assoc_cond, prefix, &extra);
 
-	if(assoc_cond->cluster_list && list_count(assoc_cond->cluster_list))
+	if (assoc_cond->cluster_list && list_count(assoc_cond->cluster_list))
 		use_cluster_list = assoc_cond->cluster_list;
 empty:
 	xfree(tmp);
@@ -3294,22 +3303,22 @@ empty:
 	}
 	assoc_list = list_create(slurmdb_destroy_association_rec);
 
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 	itr = list_iterator_create(use_cluster_list);
-	while((cluster_name = list_next(itr))) {
+	while ((cluster_name = list_next(itr))) {
 		int rc;
-		if((rc = _cluster_get_assocs(mysql_conn, &user, assoc_cond,
-					     cluster_name, tmp, extra,
-					     is_admin, assoc_list))
-		   != SLURM_SUCCESS) {
+		if ((rc = _cluster_get_assocs(mysql_conn, &user, assoc_cond,
+					      cluster_name, tmp, extra,
+					      is_admin, assoc_list))
+		    != SLURM_SUCCESS) {
 			list_destroy(assoc_list);
 			assoc_list = NULL;
 			break;
 		}
 	}
 	list_iterator_destroy(itr);
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 	xfree(tmp);
 	xfree(extra);
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_cluster.c b/src/plugins/accounting_storage/mysql/as_mysql_cluster.c
index 8044746553e..2db13a67227 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_cluster.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_cluster.c
@@ -50,21 +50,21 @@ static int _setup_cluster_cond_limits(slurmdb_cluster_cond_t *cluster_cond,
 	ListIterator itr = NULL;
 	char *object = NULL;
 
-	if(!cluster_cond)
+	if (!cluster_cond)
 		return 0;
 
-	if(cluster_cond->with_deleted)
+	if (cluster_cond->with_deleted)
 		xstrcat(*extra, " where (deleted=0 || deleted=1)");
 	else
 		xstrcat(*extra, " where deleted=0");
 
-	if(cluster_cond->cluster_list
-	   && list_count(cluster_cond->cluster_list)) {
+	if (cluster_cond->cluster_list
+	    && list_count(cluster_cond->cluster_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(cluster_cond->cluster_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "name='%s'", object);
 			set = 1;
@@ -73,13 +73,13 @@ static int _setup_cluster_cond_limits(slurmdb_cluster_cond_t *cluster_cond,
 		xstrcat(*extra, ")");
 	}
 
-	if(cluster_cond->plugin_id_select_list
-	   && list_count(cluster_cond->plugin_id_select_list)) {
+	if (cluster_cond->plugin_id_select_list
+	    && list_count(cluster_cond->plugin_id_select_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(cluster_cond->plugin_id_select_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "plugin_id_select='%s'", object);
 			set = 1;
@@ -88,13 +88,13 @@ static int _setup_cluster_cond_limits(slurmdb_cluster_cond_t *cluster_cond,
 		xstrcat(*extra, ")");
 	}
 
-	if(cluster_cond->rpc_version_list
-	   && list_count(cluster_cond->rpc_version_list)) {
+	if (cluster_cond->rpc_version_list
+	    && list_count(cluster_cond->rpc_version_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(cluster_cond->rpc_version_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "rpc_version='%s'", object);
 			set = 1;
@@ -103,12 +103,12 @@ static int _setup_cluster_cond_limits(slurmdb_cluster_cond_t *cluster_cond,
 		xstrcat(*extra, ")");
 	}
 
-	if(cluster_cond->classification) {
+	if (cluster_cond->classification) {
 		xstrfmtcat(*extra, " && (classification & %u)",
 			   cluster_cond->classification);
 	}
 
-	if(cluster_cond->flags != NO_VAL) {
+	if (cluster_cond->flags != NO_VAL) {
 		xstrfmtcat(*extra, " && (flags & %u)",
 			   cluster_cond->flags);
 	}
@@ -152,7 +152,7 @@ extern int as_mysql_add_clusters(mysql_conn_t *mysql_conn, uint32_t uid,
 		}
 		if ((rc = create_cluster_tables(mysql_conn,
 						object->name))
-		   != SLURM_SUCCESS) {
+		    != SLURM_SUCCESS) {
 			xfree(extra);
 			xfree(cols);
 			xfree(vals);
@@ -327,12 +327,12 @@ extern List as_mysql_modify_clusters(mysql_conn_t *mysql_conn, uint32_t uid,
 	 * the controller when it loads
 	 */
 
-	if(!cluster_cond || !cluster) {
+	if (!cluster_cond || !cluster) {
 		error("we need something to change");
 		return NULL;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	/* force to only do non-deleted clusters */
@@ -340,56 +340,56 @@ extern List as_mysql_modify_clusters(mysql_conn_t *mysql_conn, uint32_t uid,
 	_setup_cluster_cond_limits(cluster_cond, &extra);
 
 	/* Needed if talking to older SLURM versions < 2.2 */
-	if(!mysql_conn->cluster_name && cluster_cond->cluster_list
-	   && list_count(cluster_cond->cluster_list))
+	if (!mysql_conn->cluster_name && cluster_cond->cluster_list
+	    && list_count(cluster_cond->cluster_list))
 		mysql_conn->cluster_name =
 			xstrdup(list_peek(cluster_cond->cluster_list));
 
 	set = 0;
-	if(cluster->control_host) {
+	if (cluster->control_host) {
 		xstrfmtcat(vals, ", control_host='%s'", cluster->control_host);
 		set++;
 		clust_reg = true;
 	}
 
-	if(cluster->control_port) {
+	if (cluster->control_port) {
 		xstrfmtcat(vals, ", control_port=%u", cluster->control_port);
 		set++;
 		clust_reg = true;
 	}
 
-	if(cluster->rpc_version) {
+	if (cluster->rpc_version) {
 		xstrfmtcat(vals, ", rpc_version=%u", cluster->rpc_version);
 		set++;
 		clust_reg = true;
 	}
 
-	if(cluster->dimensions) {
+	if (cluster->dimensions) {
 		xstrfmtcat(vals, ", dimensions=%u", cluster->dimensions);
 		clust_reg = true;
 	}
 
-	if(cluster->plugin_id_select) {
+	if (cluster->plugin_id_select) {
 		xstrfmtcat(vals, ", plugin_id_select=%u",
 			   cluster->plugin_id_select);
 		clust_reg = true;
 	}
-	if(cluster->flags != NO_VAL) {
+	if (cluster->flags != NO_VAL) {
 		xstrfmtcat(vals, ", flags=%u", cluster->flags);
 		clust_reg = true;
 	}
 
-	if(cluster->classification) {
+	if (cluster->classification) {
 		xstrfmtcat(vals, ", classification=%u",
 			   cluster->classification);
 	}
 
-	if(!vals) {
+	if (!vals) {
 		xfree(extra);
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		error("Nothing to change");
 		return NULL;
-	} else if(clust_reg && (set != 3)) {
+	} else if (clust_reg && (set != 3)) {
 		xfree(vals);
 		xfree(extra);
 		errno = EFAULT;
@@ -404,8 +404,8 @@ extern List as_mysql_modify_clusters(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		xfree(vals);
 		error("no result given for %s", extra);
@@ -416,11 +416,11 @@ extern List as_mysql_modify_clusters(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	rc = 0;
 	ret_list = list_create(slurm_destroy_char);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		object = xstrdup(row[0]);
 
 		list_append(ret_list, object);
-		if(!rc) {
+		if (!rc) {
 			xstrfmtcat(name_char, "name='%s'", object);
 			rc = 1;
 		} else  {
@@ -429,7 +429,7 @@ extern List as_mysql_modify_clusters(mysql_conn_t *mysql_conn, uint32_t uid,
 	}
 	mysql_free_result(result);
 
-	if(!list_count(ret_list)) {
+	if (!list_count(ret_list)) {
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		debug3("didn't effect anything\n%s", query);
 		xfree(vals);
@@ -438,7 +438,7 @@ extern List as_mysql_modify_clusters(mysql_conn_t *mysql_conn, uint32_t uid,
 	}
 	xfree(query);
 
-	if(vals) {
+	if (vals) {
 		send_char = xstrdup_printf("(%s)", name_char);
 		user_name = uid_to_string((uid_t) uid);
 		rc = modify_common(mysql_conn, DBD_MODIFY_CLUSTERS, now,
@@ -478,34 +478,34 @@ extern List as_mysql_remove_clusters(mysql_conn_t *mysql_conn, uint32_t uid,
 	MYSQL_ROW row;
 	bool jobs_running = 0;
 
-	if(!cluster_cond) {
+	if (!cluster_cond) {
 		error("we need something to change");
 		return NULL;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	/* force to only do non-deleted clusters */
 	cluster_cond->with_deleted = 0;
 	_setup_cluster_cond_limits(cluster_cond, &extra);
 
-	if(!extra) {
+	if (!extra) {
 		error("Nothing to remove");
 		return NULL;
 	}
 
 	query = xstrdup_printf("select name from %s%s;", cluster_table, extra);
 	xfree(extra);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return NULL;
 	}
 	rc = 0;
 	ret_list = list_create(slurm_destroy_char);
 
-	if(!mysql_num_rows(result)) {
+	if (!mysql_num_rows(result)) {
 		mysql_free_result(result);
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		debug3("didn't effect anything\n%s", query);
@@ -517,14 +517,14 @@ extern List as_mysql_remove_clusters(mysql_conn_t *mysql_conn, uint32_t uid,
 	assoc_char = xstrdup_printf("t2.acct='root'");
 
 	user_name = uid_to_string((uid_t) uid);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		char *object = xstrdup(row[0]);
-		if(!jobs_running)
+		if (!jobs_running)
 			list_append(ret_list, object);
 
 		xfree(name_char);
 		xstrfmtcat(name_char, "name='%s'", object);
-		if(jobs_running)
+		if (jobs_running)
 			xfree(object);
 		/* We should not need to delete any cluster usage just set it
 		 * to deleted */
@@ -537,11 +537,11 @@ extern List as_mysql_remove_clusters(mysql_conn_t *mysql_conn, uint32_t uid,
 			   object, cluster_day_table, now,
 			   object, cluster_hour_table, now,
 			   object, cluster_month_table, now);
-		if((rc = remove_common(mysql_conn, DBD_REMOVE_CLUSTERS, now,
-				       user_name, cluster_table,
-				       name_char, assoc_char, object,
-				       ret_list, &jobs_running))
-		   != SLURM_SUCCESS)
+		if ((rc = remove_common(mysql_conn, DBD_REMOVE_CLUSTERS, now,
+					user_name, cluster_table,
+					name_char, assoc_char, object,
+					ret_list, &jobs_running))
+		    != SLURM_SUCCESS)
 			break;
 	}
 	mysql_free_result(result);
@@ -553,12 +553,12 @@ extern List as_mysql_remove_clusters(mysql_conn_t *mysql_conn, uint32_t uid,
 		list_destroy(ret_list);
 		return NULL;
 	}
-	if(!jobs_running) {
+	if (!jobs_running) {
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			reset_mysql_conn(mysql_conn);
 			list_destroy(ret_list);
 			return NULL;
@@ -568,23 +568,23 @@ extern List as_mysql_remove_clusters(mysql_conn_t *mysql_conn, uint32_t uid,
 		memset(&wckey_cond, 0, sizeof(slurmdb_wckey_cond_t));
 		wckey_cond.cluster_list = ret_list;
 		tmp_list = as_mysql_remove_wckeys(mysql_conn, uid, &wckey_cond);
-		if(tmp_list)
+		if (tmp_list)
 			list_destroy(tmp_list);
 
 		itr = list_iterator_create(ret_list);
-		while((object = list_next(itr))) {
-			if((rc = remove_cluster_tables(mysql_conn, object))
-			   != SLURM_SUCCESS)
+		while ((object = list_next(itr))) {
+			if ((rc = remove_cluster_tables(mysql_conn, object))
+			    != SLURM_SUCCESS)
 				break;
 			cluster_name = xstrdup(object);
-			if(addto_update_list(mysql_conn->update_list,
-					     SLURMDB_REMOVE_CLUSTER,
-					     cluster_name) != SLURM_SUCCESS)
+			if (addto_update_list(mysql_conn->update_list,
+					      SLURMDB_REMOVE_CLUSTER,
+					      cluster_name) != SLURM_SUCCESS)
 				xfree(cluster_name);
 		}
 		list_iterator_destroy(itr);
 
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			reset_mysql_conn(mysql_conn);
 			list_destroy(ret_list);
 			errno = rc;
@@ -637,11 +637,11 @@ extern List as_mysql_get_clusters(mysql_conn_t *mysql_conn, uid_t uid,
 		CLUSTER_REQ_COUNT
 	};
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 
-	if(!cluster_cond) {
+	if (!cluster_cond) {
 		xstrcat(extra, " where deleted=0");
 		goto empty;
 	}
@@ -664,8 +664,8 @@ empty:
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return NULL;
 	}
@@ -675,7 +675,7 @@ empty:
 
 	memset(&assoc_cond, 0, sizeof(slurmdb_association_cond_t));
 
-	if(cluster_cond) {
+	if (cluster_cond) {
 		/* I don't think we want the with_usage flag here.
 		 * We do need the with_deleted though. */
 		//assoc_cond.with_usage = cluster_cond->with_usage;
@@ -683,7 +683,7 @@ empty:
 	}
 	assoc_cond.cluster_list = list_create(NULL);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		MYSQL_RES *result2 = NULL;
 		MYSQL_ROW row2;
 
@@ -695,7 +695,7 @@ empty:
 		list_append(assoc_cond.cluster_list, cluster->name);
 
 		/* get the usage if requested */
-		if(cluster_cond && cluster_cond->with_usage) {
+		if (cluster_cond && cluster_cond->with_usage) {
 			as_mysql_get_usage(
 				mysql_conn, uid, cluster,
 				DBD_GET_CLUSTER_USAGE,
@@ -718,22 +718,22 @@ empty:
 			cluster->name, event_table);
 		debug4("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result2 = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result2 = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
 			continue;
 		}
 		xfree(query);
-		if((row2 = mysql_fetch_row(result2))) {
+		if ((row2 = mysql_fetch_row(result2))) {
 			cluster->cpu_count = slurm_atoul(row2[0]);
-			if(row2[1] && row2[1][0])
+			if (row2[1] && row2[1][0])
 				cluster->nodes = xstrdup(row2[1]);
 		}
 		mysql_free_result(result2);
 	}
 	mysql_free_result(result);
 
-	if(!list_count(assoc_cond.cluster_list)) {
+	if (!list_count(assoc_cond.cluster_list)) {
 		list_destroy(assoc_cond.cluster_list);
 		return cluster_list;
 	}
@@ -749,17 +749,17 @@ empty:
 	list_destroy(assoc_cond.acct_list);
 	list_destroy(assoc_cond.user_list);
 
-	if(!assoc_list)
+	if (!assoc_list)
 		return cluster_list;
 
 	itr = list_iterator_create(cluster_list);
 	assoc_itr = list_iterator_create(assoc_list);
-	while((cluster = list_next(itr))) {
-		while((assoc = list_next(assoc_itr))) {
-			if(strcmp(assoc->cluster, cluster->name))
+	while ((cluster = list_next(itr))) {
+		while ((assoc = list_next(assoc_itr))) {
+			if (strcmp(assoc->cluster, cluster->name))
 				continue;
 
-			if(cluster->root_assoc) {
+			if (cluster->root_assoc) {
 				debug("This cluster %s already has "
 				      "an association.", cluster->name);
 				continue;
@@ -771,7 +771,7 @@ empty:
 	}
 	list_iterator_destroy(itr);
 	list_iterator_destroy(assoc_itr);
-	if(list_count(assoc_list))
+	if (list_count(assoc_list))
 		error("I have %d left over associations",
 		      list_count(assoc_list));
 	list_destroy(assoc_list);
@@ -819,19 +819,19 @@ extern List as_mysql_get_cluster_events(mysql_conn_t *mysql_conn, uint32_t uid,
 		EVENT_REQ_COUNT
 	};
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
-	if(!event_cond)
+	if (!event_cond)
 		goto empty;
 
-	if(event_cond->cpus_min) {
-		if(extra)
+	if (event_cond->cpus_min) {
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
 
-		if(event_cond->cpus_max) {
+		if (event_cond->cpus_max) {
 			xstrfmtcat(extra, "cpu_count between %u and %u)",
 				   event_cond->cpus_min, event_cond->cpus_max);
 
@@ -846,7 +846,7 @@ extern List as_mysql_get_cluster_events(mysql_conn_t *mysql_conn, uint32_t uid,
 	case SLURMDB_EVENT_ALL:
 		break;
 	case SLURMDB_EVENT_CLUSTER:
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
@@ -854,7 +854,7 @@ extern List as_mysql_get_cluster_events(mysql_conn_t *mysql_conn, uint32_t uid,
 
 		break;
 	case SLURMDB_EVENT_NODE:
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
@@ -866,16 +866,16 @@ extern List as_mysql_get_cluster_events(mysql_conn_t *mysql_conn, uint32_t uid,
 		break;
 	}
 
-	if(event_cond->node_list
-	   && list_count(event_cond->node_list)) {
+	if (event_cond->node_list
+	    && list_count(event_cond->node_list)) {
 		set = 0;
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
 		itr = list_iterator_create(event_cond->node_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "node_name='%s'", object);
 			set = 1;
@@ -884,11 +884,11 @@ extern List as_mysql_get_cluster_events(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(event_cond->period_start) {
-		if(!event_cond->period_end)
+	if (event_cond->period_start) {
+		if (!event_cond->period_end)
 			event_cond->period_end = now;
 
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
@@ -899,16 +899,16 @@ extern List as_mysql_get_cluster_events(mysql_conn_t *mysql_conn, uint32_t uid,
 			   event_cond->period_end, event_cond->period_start);
 	}
 
-	if(event_cond->reason_list
-	   && list_count(event_cond->reason_list)) {
+	if (event_cond->reason_list
+	    && list_count(event_cond->reason_list)) {
 		set = 0;
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
 		itr = list_iterator_create(event_cond->reason_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "reason like '%%%s%%'", object);
 			set = 1;
@@ -917,16 +917,16 @@ extern List as_mysql_get_cluster_events(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(event_cond->reason_uid_list
-	   && list_count(event_cond->reason_uid_list)) {
+	if (event_cond->reason_uid_list
+	    && list_count(event_cond->reason_uid_list)) {
 		set = 0;
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
 		itr = list_iterator_create(event_cond->reason_uid_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "reason_uid='%s'", object);
 			set = 1;
@@ -935,16 +935,16 @@ extern List as_mysql_get_cluster_events(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(event_cond->state_list
-	   && list_count(event_cond->state_list)) {
+	if (event_cond->state_list
+	    && list_count(event_cond->state_list)) {
 		set = 0;
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
 		itr = list_iterator_create(event_cond->state_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "state='%s'", object);
 			set = 1;
@@ -953,7 +953,7 @@ extern List as_mysql_get_cluster_events(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(event_cond->cluster_list && list_count(event_cond->cluster_list))
+	if (event_cond->cluster_list && list_count(event_cond->cluster_list))
 		use_cluster_list = event_cond->cluster_list;
 empty:
 	xfree(tmp);
@@ -962,25 +962,25 @@ empty:
 		xstrfmtcat(tmp, ", %s", event_req_inx[i]);
 	}
 
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 
 	ret_list = list_create(slurmdb_destroy_event_rec);
 
 	itr = list_iterator_create(use_cluster_list);
-	while((object = list_next(itr))) {
+	while ((object = list_next(itr))) {
 		query = xstrdup_printf("select %s from \"%s_%s\"",
 				       tmp, object, event_table);
-		if(extra)
+		if (extra)
 			xstrfmtcat(query, " %s", extra);
 
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
-			if(mysql_errno(mysql_conn->db_conn)
-			   != ER_NO_SUCH_TABLE) {
+			if (mysql_errno(mysql_conn->db_conn)
+			    != ER_NO_SUCH_TABLE) {
 				list_destroy(ret_list);
 				ret_list = NULL;
 			}
@@ -988,7 +988,7 @@ empty:
 		}
 		xfree(query);
 
-		while((row = mysql_fetch_row(result))) {
+		while ((row = mysql_fetch_row(result))) {
 			slurmdb_event_rec_t *event =
 				xmalloc(sizeof(slurmdb_event_rec_t));
 
@@ -996,7 +996,7 @@ empty:
 
 			event->cluster = xstrdup(object);
 
-			if(row[EVENT_REQ_NODE] && row[EVENT_REQ_NODE][0]) {
+			if (row[EVENT_REQ_NODE] && row[EVENT_REQ_NODE][0]) {
 				event->node_name = xstrdup(row[EVENT_REQ_NODE]);
 				event->event_type = SLURMDB_EVENT_NODE;
 			} else
@@ -1007,12 +1007,12 @@ empty:
 			event->period_start = slurm_atoul(row[EVENT_REQ_START]);
 			event->period_end = slurm_atoul(row[EVENT_REQ_END]);
 
-			if(row[EVENT_REQ_REASON] && row[EVENT_REQ_REASON][0])
+			if (row[EVENT_REQ_REASON] && row[EVENT_REQ_REASON][0])
 				event->reason = xstrdup(row[EVENT_REQ_REASON]);
 			event->reason_uid =
 				slurm_atoul(row[EVENT_REQ_REASON_UID]);
 
-			if(row[EVENT_REQ_CNODES] && row[EVENT_REQ_CNODES][0])
+			if (row[EVENT_REQ_CNODES] && row[EVENT_REQ_CNODES][0])
 				event->cluster_nodes =
 					xstrdup(row[EVENT_REQ_CNODES]);
 		}
@@ -1022,26 +1022,26 @@ empty:
 	xfree(tmp);
 	xfree(extra);
 
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
 	return ret_list;
 }
 
 extern int as_mysql_node_down(mysql_conn_t *mysql_conn,
-			   struct node_record *node_ptr,
-			   time_t event_time, char *reason,
-			   uint32_t reason_uid)
+			      struct node_record *node_ptr,
+			      time_t event_time, char *reason,
+			      uint32_t reason_uid)
 {
 	uint16_t cpus;
 	int rc = SLURM_SUCCESS;
 	char *query = NULL;
 	char *my_reason;
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
-	if(!node_ptr) {
+	if (!node_ptr) {
 		error("No node_ptr given!");
 		return SLURM_ERROR;
 	}
@@ -1090,13 +1090,13 @@ extern int as_mysql_node_down(mysql_conn_t *mysql_conn,
 }
 
 extern int as_mysql_node_up(mysql_conn_t *mysql_conn,
-			 struct node_record *node_ptr,
-			 time_t event_time)
+			    struct node_record *node_ptr,
+			    time_t event_time)
 {
 	char* query;
 	int rc = SLURM_SUCCESS;
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	query = xstrdup_printf(
@@ -1120,14 +1120,14 @@ extern int as_mysql_register_ctld(mysql_conn_t *mysql_conn,
 	time_t now = time(NULL);
 	uint32_t flags = slurmdb_setup_cluster_flags();
 
-	if(slurmdbd_conf)
+	if (slurmdbd_conf)
 		fatal("clusteracct_storage_g_register_ctld "
 		      "should never be called from the slurmdbd.");
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
-	if(!mysql_conn->cluster_name)
+	if (!mysql_conn->cluster_name)
 		mysql_conn->cluster_name = xstrdup(cluster);
 
 	info("Registering slurmctld for cluster %s at port %u in database.",
@@ -1135,8 +1135,8 @@ extern int as_mysql_register_ctld(mysql_conn_t *mysql_conn,
 	gethostname(hostname, sizeof(hostname));
 
 	/* check if we are running on the backup controller */
-	if(slurmctld_conf.backup_controller
-	   && !strcmp(slurmctld_conf.backup_controller, hostname)) {
+	if (slurmctld_conf.backup_controller
+	    && !strcmp(slurmctld_conf.backup_controller, hostname)) {
 		address = slurmctld_conf.backup_addr;
 	} else
 		address = slurmctld_conf.control_addr;
@@ -1163,8 +1163,8 @@ extern int as_mysql_register_ctld(mysql_conn_t *mysql_conn,
 }
 
 extern int as_mysql_cluster_cpus(mysql_conn_t *mysql_conn,
-			      char *cluster_nodes, uint32_t cpus,
-			      time_t event_time)
+				 char *cluster_nodes, uint32_t cpus,
+				 time_t event_time)
 {
 	char* query;
 	int rc = SLURM_SUCCESS;
@@ -1172,7 +1172,7 @@ extern int as_mysql_cluster_cpus(mysql_conn_t *mysql_conn,
 	MYSQL_RES *result = NULL;
 	MYSQL_ROW row;
 
- 	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+ 	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	/* Record the processor count */
@@ -1180,10 +1180,10 @@ extern int as_mysql_cluster_cpus(mysql_conn_t *mysql_conn,
 		"select cpu_count, cluster_nodes from \"%s_%s\" where "
 		"time_end=0 and node_name='' limit 1",
 		mysql_conn->cluster_name, event_table);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
-		if(mysql_errno(mysql_conn->db_conn) == ER_NO_SUCH_TABLE)
+		if (mysql_errno(mysql_conn->db_conn) == ER_NO_SUCH_TABLE)
 			rc = ESLURM_ACCESS_DENIED;
 		else
 			rc = SLURM_ERROR;
@@ -1192,7 +1192,7 @@ extern int as_mysql_cluster_cpus(mysql_conn_t *mysql_conn,
 	xfree(query);
 
 	/* we only are checking the first one here */
-	if(!(row = mysql_fetch_row(result))) {
+	if (!(row = mysql_fetch_row(result))) {
 		debug("We don't have an entry for this machine %s "
 		      "most likely a first time running.",
 		      mysql_conn->cluster_name);
@@ -1209,12 +1209,12 @@ extern int as_mysql_cluster_cpus(mysql_conn_t *mysql_conn,
 		goto add_it;
 	}
 
-	if(slurm_atoul(row[0]) == cpus) {
+	if (slurm_atoul(row[0]) == cpus) {
 		debug3("we have the same cpu count as before for %s, "
 		       "no need to update the database.",
 		       mysql_conn->cluster_name);
-		if(cluster_nodes) {
-			if(!row[1][0]) {
+		if (cluster_nodes) {
+			if (!row[1][0]) {
 				debug("Adding cluster nodes '%s' to "
 				      "last instance of cluster '%s'.",
 				      cluster_nodes, mysql_conn->cluster_name);
@@ -1227,7 +1227,7 @@ extern int as_mysql_cluster_cpus(mysql_conn_t *mysql_conn,
 				rc = mysql_db_query(mysql_conn, query);
 				xfree(query);
 				goto end_it;
-			} else if(!strcmp(cluster_nodes, row[1])) {
+			} else if (!strcmp(cluster_nodes, row[1])) {
 				debug3("we have the same nodes in the cluster "
 				       "as before no need to "
 				       "update the database.");
@@ -1248,7 +1248,7 @@ extern int as_mysql_cluster_cpus(mysql_conn_t *mysql_conn,
 	rc = mysql_db_query(mysql_conn, query);
 	xfree(query);
 	first = 1;
-	if(rc != SLURM_SUCCESS)
+	if (rc != SLURM_SUCCESS)
 		goto end_it;
 add_it:
 	query = xstrdup_printf(
@@ -1261,7 +1261,7 @@ add_it:
 	xfree(query);
 end_it:
 	mysql_free_result(result);
-	if(first && rc == SLURM_SUCCESS)
+	if (first && rc == SLURM_SUCCESS)
 		rc = ACCOUNTING_FIRST_REG;
 
 	return rc;
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_convert.c b/src/plugins/accounting_storage/mysql/as_mysql_convert.c
index 04cbd7f69e5..e442ea2150d 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_convert.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_convert.c
@@ -62,10 +62,10 @@ static void *_convert_cluster_tables(void *arg)
 	slurm_mutex_init(&mysql_conn.lock);
 	/* each thread needs it's own connection */
 	rc = check_connection(&mysql_conn);
-	if(rc != SLURM_SUCCESS)
+	if (rc != SLURM_SUCCESS)
 		goto end_it;
 
-	if(assocs) {
+	if (assocs) {
 		int diff;
 		info("Converting old association tables for %s, "
 		     "this may take some time, please do not restart.",
@@ -96,7 +96,7 @@ static void *_convert_cluster_tables(void *arg)
 		debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't update assoc table correctly");
 			goto end_it;
 		}
@@ -104,14 +104,14 @@ static void *_convert_cluster_tables(void *arg)
 		query = xstrdup_printf("select lft from \"%s_%s\" "
 				       "where acct='root' and user=''",
 				       cluster_name, assoc_table);
-		if(!(result = mysql_db_query_ret(&mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(&mysql_conn, query, 0))) {
 			xfree(query);
 			rc = SLURM_ERROR;
 			goto end_it;
 		}
 		xfree(query);
 
-		if(!(row = mysql_fetch_row(result))) {
+		if (!(row = mysql_fetch_row(result))) {
 			mysql_free_result(result);
 			error("Couldn't find root association "
 			      "for cluster %s", cluster_name);
@@ -120,7 +120,7 @@ static void *_convert_cluster_tables(void *arg)
 		}
 		diff = slurm_atoul(row[0]) - 1;
 		mysql_free_result(result);
-		if(diff < 0) {
+		if (diff < 0) {
 			error("lft was %d that can't happen!", diff+1);
 			rc = SLURM_ERROR;
 			goto end_it;
@@ -137,7 +137,7 @@ static void *_convert_cluster_tables(void *arg)
 		debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't update assoc table correctly");
 			goto end_it;
 		}
@@ -194,14 +194,14 @@ static void *_convert_cluster_tables(void *arg)
 		       THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't update assoc usage "
 			      "table correctly");
 			goto end_it;
 		}
 	}
 
-	if(events) {
+	if (events) {
 		info("Converting old event table for %s, "
 		     "this may take some time, please do not restart.",
 		     cluster_name);
@@ -220,13 +220,13 @@ static void *_convert_cluster_tables(void *arg)
 		debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't update event table correctly");
 			goto end_it;
 		}
 	}
 
-	if(jobs) {
+	if (jobs) {
 		info("Converting old job table for %s, "
 		     "this may take some time, please do not restart.",
 		     cluster_name);
@@ -256,13 +256,13 @@ static void *_convert_cluster_tables(void *arg)
 		debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't update job table correctly");
 			goto end_it;
 		}
 	}
 
-	if(last_ran) {
+	if (last_ran) {
 		info("Converting old last ran table for %s, "
 		     "this may take some time, please do not restart.",
 		     cluster_name);
@@ -279,13 +279,13 @@ static void *_convert_cluster_tables(void *arg)
 		debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't update last ran table correctly");
 			goto end_it;
 		}
 	}
 
-	if(resvs) {
+	if (resvs) {
 		info("Converting old reservation table for %s, "
 		     "this may take some time, please do not restart.",
 		     cluster_name);
@@ -306,14 +306,14 @@ static void *_convert_cluster_tables(void *arg)
 		debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't update reserve "
 			      "table correctly");
 			goto end_it;
 		}
 	}
 
-	if(steps) {
+	if (steps) {
 		info("Converting old step table for %s, "
 		     "this may take some time, please do not restart.",
 		     cluster_name);
@@ -350,13 +350,13 @@ static void *_convert_cluster_tables(void *arg)
 		debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't update step table correctly");
 			goto end_it;
 		}
 	}
 
-	if(suspends) {
+	if (suspends) {
 		info("Converting old suspend table for %s, "
 		     "this may take some time, please do not restart.",
 		     cluster_name);
@@ -373,14 +373,14 @@ static void *_convert_cluster_tables(void *arg)
 		debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't update suspend "
 			      "table correctly");
 			goto end_it;
 		}
 	}
 
-	if(usage) {
+	if (usage) {
 		info("Converting old usage tables for %s, "
 		     "this may take some time, please do not restart.",
 		     cluster_name);
@@ -438,14 +438,14 @@ static void *_convert_cluster_tables(void *arg)
 		debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't update cluster usage "
 			      "tables correctly");
 			goto end_it;
 		}
 	}
 
-	if(wckeys) {
+	if (wckeys) {
 		info("Converting old wckey tables for %s, "
 		     "this may take some time, please do not restart.",
 		     cluster_name);
@@ -463,7 +463,7 @@ static void *_convert_cluster_tables(void *arg)
 		debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't update wckey table correctly");
 			goto end_it;
 		}
@@ -526,7 +526,7 @@ static void *_convert_cluster_tables(void *arg)
 		       THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't update wckey usage "
 			      "table correctly");
 			goto end_it;
@@ -539,8 +539,8 @@ static void *_convert_cluster_tables(void *arg)
 
 
 end_it:
-	if(rc == SLURM_SUCCESS) {
-		if(mysql_db_commit(&mysql_conn)) {
+	if (rc == SLURM_SUCCESS) {
+		if (mysql_db_commit(&mysql_conn)) {
 			error("Commit failed, didn't update cluster %s",
 			      cluster_name);
 			rc = SLURM_ERROR;
@@ -548,7 +548,7 @@ end_it:
 			verbose("Cluster %s updated", cluster_name);
 	} else {
 		verbose("Cluster %s update failed", cluster_name);
-		if(mysql_db_rollback(&mysql_conn))
+		if (mysql_db_rollback(&mysql_conn))
 			error("rollback failed");
 	}
 
@@ -774,37 +774,37 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	query = xstrdup_printf("show tables like '%s';", assoc_table);
 
 	debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		goto end_it;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
+	if ((row = mysql_fetch_row(result))) {
 		/* make it up to date */
-		if(mysql_db_create_table(mysql_conn, assoc_table,
-					 assoc_table_fields_2_1,
-					 ", primary key (id), "
-					 " unique index (user(20), acct(20), "
-					 "cluster(20), partition(20)))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, assoc_table,
+					  assoc_table_fields_2_1,
+					  ", primary key (id), "
+					  " unique index (user(20), acct(20), "
+					  "cluster(20), partition(20)))")
+		    == SLURM_ERROR)
 			goto end_it;
-		if(mysql_db_create_table(mysql_conn, "assoc_day_usage_table",
-					 assoc_usage_table_fields_2_1,
-					 ", primary key (id, period_start))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, "assoc_day_usage_table",
+					  assoc_usage_table_fields_2_1,
+					  ", primary key (id, period_start))")
+		    == SLURM_ERROR)
 			goto end_it;
 
-		if(mysql_db_create_table(mysql_conn, "assoc_hour_usage_table",
-					 assoc_usage_table_fields_2_1,
-					 ", primary key (id, period_start))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, "assoc_hour_usage_table",
+					  assoc_usage_table_fields_2_1,
+					  ", primary key (id, period_start))")
+		    == SLURM_ERROR)
 			goto end_it;
 
-		if(mysql_db_create_table(mysql_conn, "assoc_month_usage_table",
-					 assoc_usage_table_fields_2_1,
-					 ", primary key (id, period_start))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, "assoc_month_usage_table",
+					  assoc_usage_table_fields_2_1,
+					  ", primary key (id, period_start))")
+		    == SLURM_ERROR)
 			goto end_it;
 
 		assocs = 1;
@@ -815,19 +815,19 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	/* now do events */
 	query = xstrdup_printf("show tables like 'cluster_event_table';");
 	debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		goto end_it;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
+	if ((row = mysql_fetch_row(result))) {
 		/* make it up to date */
-		if(mysql_db_create_table(mysql_conn, "cluster_event_table",
-					 event_table_fields_2_1,
-					 ", primary key (node_name(20), "
-					 "cluster(20), period_start))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, "cluster_event_table",
+					  event_table_fields_2_1,
+					  ", primary key (node_name(20), "
+					  "cluster(20), period_start))")
+		    == SLURM_ERROR)
 			goto end_it;
 		events = 1;
 	}
@@ -838,20 +838,20 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	query = xstrdup_printf("show tables like '%s';", job_table);
 
 	debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		goto end_it;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
+	if ((row = mysql_fetch_row(result))) {
 		/* make it up to date */
-		if(mysql_db_create_table(mysql_conn, job_table,
-					 job_table_fields_2_1,
-					 ", primary key (id), "
-					 "unique index (jobid, "
-					 "associd, submit))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, job_table,
+					  job_table_fields_2_1,
+					  ", primary key (id), "
+					  "unique index (jobid, "
+					  "associd, submit))")
+		    == SLURM_ERROR)
 			goto end_it;
 		jobs = 1;
 	}
@@ -862,17 +862,17 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	query = xstrdup_printf("show tables like '%s';", last_ran_table);
 
 	debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		goto end_it;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
+	if ((row = mysql_fetch_row(result))) {
 		/* make it up to date */
-		if(mysql_db_create_table(mysql_conn, last_ran_table,
-					 last_ran_table_fields_2_1,
-					 ")") == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, last_ran_table,
+					  last_ran_table_fields_2_1,
+					  ")") == SLURM_ERROR)
 			goto end_it;
 		last_ran = 1;
 	}
@@ -883,19 +883,19 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	query = xstrdup_printf("show tables like '%s';", resv_table);
 
 	debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		goto end_it;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
+	if ((row = mysql_fetch_row(result))) {
 		/* make it up to date */
-		if(mysql_db_create_table(mysql_conn, resv_table,
-					 resv_table_fields_2_1,
-					 ", primary key (id, start, "
-					 "cluster(20)))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, resv_table,
+					  resv_table_fields_2_1,
+					  ", primary key (id, start, "
+					  "cluster(20)))")
+		    == SLURM_ERROR)
 			goto end_it;
 		resvs = 1;
 	}
@@ -906,18 +906,18 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	query = xstrdup_printf("show tables like '%s';", step_table);
 
 	debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		goto end_it;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
+	if ((row = mysql_fetch_row(result))) {
 		/* make it up to date */
-		if(mysql_db_create_table(mysql_conn, step_table,
-					 step_table_fields_2_1,
-					 ", primary key (id, stepid))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, step_table,
+					  step_table_fields_2_1,
+					  ", primary key (id, stepid))")
+		    == SLURM_ERROR)
 			goto end_it;
 		steps = 1;
 	}
@@ -928,18 +928,18 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	query = xstrdup_printf("show tables like '%s';", suspend_table);
 
 	debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		goto end_it;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
+	if ((row = mysql_fetch_row(result))) {
 		/* make it up to date */
-		if(mysql_db_create_table(mysql_conn, suspend_table,
-					 suspend_table_fields_2_1,
-					 ")")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, suspend_table,
+					  suspend_table_fields_2_1,
+					  ")")
+		    == SLURM_ERROR)
 			goto end_it;
 		suspends = 1;
 	}
@@ -950,34 +950,35 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	query = xstrdup("show tables like 'cluster_hour_usage_table';");
 
 	debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		goto end_it;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
+	if ((row = mysql_fetch_row(result))) {
 		/* make it up to date */
-		if(mysql_db_create_table(mysql_conn, "cluster_day_usage_table",
-					 cluster_usage_table_fields_2_1,
-					 ", primary key (cluster(20), "
-					 "period_start))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, "cluster_day_usage_table",
+					  cluster_usage_table_fields_2_1,
+					  ", primary key (cluster(20), "
+					  "period_start))")
+		    == SLURM_ERROR)
 			goto end_it;
 
-		if(mysql_db_create_table(mysql_conn, "cluster_hour_usage_table",
-					 cluster_usage_table_fields_2_1,
-					 ", primary key (cluster(20), "
-					 "period_start))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn,
+					  "cluster_hour_usage_table",
+					  cluster_usage_table_fields_2_1,
+					  ", primary key (cluster(20), "
+					  "period_start))")
+		    == SLURM_ERROR)
 			goto end_it;
 
-		if(mysql_db_create_table(mysql_conn,
-					 "cluster_month_usage_table",
-					 cluster_usage_table_fields_2_1,
-					 ", primary key (cluster(20), "
-					 "period_start))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn,
+					  "cluster_month_usage_table",
+					  cluster_usage_table_fields_2_1,
+					  ", primary key (cluster(20), "
+					  "period_start))")
+		    == SLURM_ERROR)
 			goto end_it;
 
 		usage = 1;
@@ -989,37 +990,37 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	query = xstrdup_printf("show tables like '%s';", wckey_table);
 
 	debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		goto end_it;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result))) {
+	if ((row = mysql_fetch_row(result))) {
 		/* make it up to date */
-		if(mysql_db_create_table(mysql_conn, wckey_table,
-					 wckey_table_fields_2_1,
-					 ", primary key (id), "
-					 " unique index (name(20), user(20), "
-					 "cluster(20)))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, wckey_table,
+					  wckey_table_fields_2_1,
+					  ", primary key (id), "
+					  " unique index (name(20), user(20), "
+					  "cluster(20)))")
+		    == SLURM_ERROR)
 			goto end_it;
-		if(mysql_db_create_table(mysql_conn, "wckey_day_usage_table",
-					 wckey_usage_table_fields_2_1,
-					 ", primary key (id, period_start))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, "wckey_day_usage_table",
+					  wckey_usage_table_fields_2_1,
+					  ", primary key (id, period_start))")
+		    == SLURM_ERROR)
 			goto end_it;
 
-		if(mysql_db_create_table(mysql_conn, "wckey_hour_usage_table",
-					 wckey_usage_table_fields_2_1,
-					 ", primary key (id, period_start))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, "wckey_hour_usage_table",
+					  wckey_usage_table_fields_2_1,
+					  ", primary key (id, period_start))")
+		    == SLURM_ERROR)
 			goto end_it;
 
-		if(mysql_db_create_table(mysql_conn, "wckey_month_usage_table",
-					 wckey_usage_table_fields_2_1,
-					 ", primary key (id, period_start))")
-		   == SLURM_ERROR)
+		if (mysql_db_create_table(mysql_conn, "wckey_month_usage_table",
+					  wckey_usage_table_fields_2_1,
+					  ", primary key (id, period_start))")
+		    == SLURM_ERROR)
 			goto end_it;
 		wckeys = 1;
 	}
@@ -1028,19 +1029,19 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 
 	rc = SLURM_SUCCESS;
 
-	if(!assocs && !events && !jobs && !last_ran && !resvs
-	   && !steps && !suspends && !usage && !wckeys)
+	if (!assocs && !events && !jobs && !last_ran && !resvs
+	    && !steps && !suspends && !usage && !wckeys)
 		goto end_it;
 
 	/* Rename the old tables first so we don't have to worry about
 	   clusters actually named "cluster" or "wckey".
 	*/
-	if(assocs) {
-		if(!drop_query)
+	if (assocs) {
+		if (!drop_query)
 			drop_query = xstrdup("drop table if exists ");
 		else
 			xstrcat(drop_query, ", ");
-		if(!query)
+		if (!query)
 			query = xstrdup("rename table ");
 		else
 			xstrcat(query, ", ");
@@ -1061,12 +1062,12 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 			   "assoc_month_usage_table");
 	}
 
-	if(events) {
-		if(!drop_query)
+	if (events) {
+		if (!drop_query)
 			drop_query = xstrdup("drop table if exists ");
 		else
 			xstrcat(drop_query, ", ");
-		if(!query)
+		if (!query)
 			query = xstrdup("rename table ");
 		else
 			xstrcat(query, ", ");
@@ -1075,12 +1076,12 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 			"cluster_event_table to cluster_event_table_old");
 	}
 
-	if(jobs) {
-		if(!drop_query)
+	if (jobs) {
+		if (!drop_query)
 			drop_query = xstrdup("drop table if exists ");
 		else
 			xstrcat(drop_query, ", ");
-		if(!query)
+		if (!query)
 			query = xstrdup("rename table ");
 		else
 			xstrcat(query, ", ");
@@ -1088,12 +1089,12 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 		xstrfmtcat(query, "%s to %s_old", job_table, job_table);
 	}
 
-	if(last_ran) {
-		if(!drop_query)
+	if (last_ran) {
+		if (!drop_query)
 			drop_query = xstrdup("drop table if exists ");
 		else
 			xstrcat(drop_query, ", ");
-		if(!query)
+		if (!query)
 			query = xstrdup("rename table ");
 		else
 			xstrcat(query, ", ");
@@ -1102,12 +1103,12 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 			   last_ran_table, last_ran_table);
 	}
 
-	if(resvs) {
-		if(!drop_query)
+	if (resvs) {
+		if (!drop_query)
 			drop_query = xstrdup("drop table if exists ");
 		else
 			xstrcat(drop_query, ", ");
-		if(!query)
+		if (!query)
 			query = xstrdup("rename table ");
 		else
 			xstrcat(query, ", ");
@@ -1115,12 +1116,12 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 		xstrfmtcat(query, "%s to %s_old", resv_table, resv_table);
 	}
 
-	if(steps) {
-		if(!drop_query)
+	if (steps) {
+		if (!drop_query)
 			drop_query = xstrdup("drop table if exists ");
 		else
 			xstrcat(drop_query, ", ");
-		if(!query)
+		if (!query)
 			query = xstrdup("rename table ");
 		else
 			xstrcat(query, ", ");
@@ -1128,12 +1129,12 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 		xstrfmtcat(query, "%s to %s_old", step_table, step_table);
 	}
 
-	if(suspends) {
-		if(!drop_query)
+	if (suspends) {
+		if (!drop_query)
 			drop_query = xstrdup("drop table if exists ");
 		else
 			xstrcat(drop_query, ", ");
-		if(!query)
+		if (!query)
 			query = xstrdup("rename table ");
 		else
 			xstrcat(query, ", ");
@@ -1141,12 +1142,12 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 		xstrfmtcat(query, "%s to %s_old", suspend_table, suspend_table);
 	}
 
-	if(usage) {
-		if(!drop_query)
+	if (usage) {
+		if (!drop_query)
 			drop_query = xstrdup("drop table if exists ");
 		else
 			xstrcat(drop_query, ", ");
-		if(!query)
+		if (!query)
 			query = xstrdup("rename table ");
 		else
 			xstrcat(query, ", ");
@@ -1164,12 +1165,12 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 			   "cluster_month_usage_table");
 	}
 
-	if(wckeys) {
-		if(!drop_query)
+	if (wckeys) {
+		if (!drop_query)
 			drop_query = xstrdup("drop table if exists ");
 		else
 			xstrcat(drop_query, ", ");
-		if(!query)
+		if (!query)
 			query = xstrdup("rename table ");
 		else
 			xstrcat(query, ", ");
@@ -1190,13 +1191,13 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 			   "wckey_month_usage_table");
 	}
 
-	if(query) {
+	if (query) {
 		xstrfmtcat(drop_query, ";%s;", query);
 		xfree(query);
 		info("Renaming old tables with _old behind them.");
 		rc = mysql_db_query(mysql_conn, drop_query);
 		xfree(drop_query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't rename tables");
 			goto end_it;
 		}
@@ -1208,7 +1209,7 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	slurm_mutex_lock(&as_mysql_cluster_list_lock);
 	/* now convert to new form */
 	itr = list_iterator_create(as_mysql_cluster_list);
-	while((cluster_name = list_next(itr))) {
+	while ((cluster_name = list_next(itr))) {
 		pthread_t convert_tid;
 		pthread_attr_t convert_attr;
 		slurm_attr_init(&convert_attr);
@@ -1224,9 +1225,9 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	/* This has to be done after the threads because of a locking
 	   issue on this table. */
 	list_iterator_reset(itr);
-	while((cluster_name = list_next(itr))) {
+	while ((cluster_name = list_next(itr))) {
 		char *txn_ids = NULL;
-		if(assocs) {
+		if (assocs) {
 			/* Since there isn't a cluster name in the
 			   assoc usage tables we need to get all the ids from
 			   the assoc_table and query against that.  Since
@@ -1240,17 +1241,17 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 					       "where cluster='%s'",
 					       "assoc_table_old", cluster_name);
 			debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-			if(!(result = mysql_db_query_ret(
-				     mysql_conn, query, 0))) {
+			if (!(result = mysql_db_query_ret(
+				      mysql_conn, query, 0))) {
 				xfree(query);
 				rc = SLURM_ERROR;
 				goto end_it;
 			}
 			xfree(query);
 
-			if(mysql_num_rows(result)) {
-				while((row = mysql_fetch_row(result))) {
-					if(txn_ids)
+			if (mysql_num_rows(result)) {
+				while ((row = mysql_fetch_row(result))) {
+					if (txn_ids)
 						xstrcat(txn_ids, " || ");
 					else
 						xstrcat(txn_ids, "(");
@@ -1265,7 +1266,7 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 			mysql_free_result(result);
 			result = NULL;
 
-			if(txn_ids) {
+			if (txn_ids) {
 				query = xstrdup_printf(
 					"update %s set cluster='%s' where "
 					"(action= %d || action = %d "
@@ -1275,10 +1276,10 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 					DBD_REMOVE_ASSOCS, txn_ids);
 				xfree(txn_ids);
 				debug4("(%s:%d) query\n%s",
-				     THIS_FILE, __LINE__, query);
+				       THIS_FILE, __LINE__, query);
 				rc = mysql_db_query(mysql_conn, query);
 				xfree(query);
-				if(rc != SLURM_SUCCESS) {
+				if (rc != SLURM_SUCCESS) {
 					error("Couldn't update assoc "
 					      "txn's correctly");
 					goto end_it;
@@ -1286,7 +1287,7 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 			}
 		}
 
-		if(wckeys) {
+		if (wckeys) {
 			/* Since there isn't a cluster name in the
 			   wckey usage tables we need to get all the ids from
 			   the wckey_table query against that.  Since
@@ -1300,17 +1301,17 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 					       "cluster='%s'",
 					       "wckey_table_old", cluster_name);
 			debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-			if(!(result = mysql_db_query_ret(
-				     mysql_conn, query, 0))) {
+			if (!(result = mysql_db_query_ret(
+				      mysql_conn, query, 0))) {
 				xfree(query);
 				rc = SLURM_ERROR;
 				goto end_it;
 			}
 			xfree(query);
 
-			if(mysql_num_rows(result)) {
-				while((row = mysql_fetch_row(result))) {
-					if(txn_ids)
+			if (mysql_num_rows(result)) {
+				while ((row = mysql_fetch_row(result))) {
+					if (txn_ids)
 						xstrcat(txn_ids, " || ");
 					else
 						xstrcat(txn_ids, "(");
@@ -1324,7 +1325,7 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 			}
 			mysql_free_result(result);
 			result = NULL;
-			if(txn_ids) {
+			if (txn_ids) {
 				query = xstrdup_printf(
 					"update %s set cluster='%s' where "
 					"(action= %d || action = %d "
@@ -1334,10 +1335,10 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 					DBD_REMOVE_WCKEYS, txn_ids);
 				xfree(txn_ids);
 				debug4("(%s:%d) query\n%s",
-				     THIS_FILE, __LINE__, query);
+				       THIS_FILE, __LINE__, query);
 				rc = mysql_db_query(mysql_conn, query);
 				xfree(query);
-				if(rc != SLURM_SUCCESS) {
+				if (rc != SLURM_SUCCESS) {
 					error("Couldn't update wckey "
 					      "txn's correctly");
 					goto end_it;
@@ -1349,7 +1350,7 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
 	/* Now make some sort of destinction as to what an id is. */
-	if(assocs) {
+	if (assocs) {
 		xstrfmtcat(query, "update %s set name=replace(name, 'id=', "
 			   "'id_assoc=') where (action = %d || action = %d);",
 			   txn_table, DBD_MODIFY_ASSOCS, DBD_REMOVE_ASSOCS);
@@ -1359,7 +1360,7 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 			   "where action = %d;",
 			   txn_table, DBD_ADD_ASSOCS);
 	}
-	if(wckeys) {
+	if (wckeys) {
 		xstrfmtcat(query, "update %s set name=replace(name, 'id=', "
 			   "'id_wckey=') where (action = %d || action = %d);",
 			   txn_table, DBD_MODIFY_WCKEYS, DBD_REMOVE_WCKEYS);
@@ -1370,16 +1371,16 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 			   txn_table, DBD_ADD_WCKEYS);
 	}
 
-	if(query) {
+	if (query) {
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't replace id='s in txn table");
 			goto end_it;
 		}
 	}
 
-	while(converted < list_count(as_mysql_cluster_list)) {
+	while (converted < list_count(as_mysql_cluster_list)) {
 		pthread_cond_wait(&converted_cond, &converted_lock);
 		debug2("Got %d converted", converted);
 	}
@@ -1389,7 +1390,7 @@ extern int as_mysql_convert_tables(mysql_conn_t *mysql_conn)
 	pthread_cond_destroy(&converted_cond);
 
 end_it:
-	if(result)
+	if (result)
 		mysql_free_result(result);
 
 	return rc;
@@ -1426,7 +1427,7 @@ extern int as_mysql_convert_user_defs(mysql_conn_t *mysql_conn,
 			       user_table);
 
 	debug4("(%s:%d) query\n%s", THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
@@ -1458,7 +1459,7 @@ extern int as_mysql_convert_user_defs(mysql_conn_t *mysql_conn,
 	}
 	xfree(query);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		/* now convert to new form */
 		xstrfmtcat(query,
 			   "update \"%s_%s\" set mod_time=%ld, is_def=1 "
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_job.c b/src/plugins/accounting_storage/mysql/as_mysql_job.c
index bb3ffc358d7..23183fe2a66 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_job.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_job.c
@@ -58,14 +58,14 @@ static int _get_db_index(mysql_conn_t *mysql_conn,
 				     mysql_conn->cluster_name, job_table,
 				     (int)submit, jobid, associd);
 
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return 0;
 	}
 	xfree(query);
 
 	row = mysql_fetch_row(result);
-	if(!row) {
+	if (!row) {
 		mysql_free_result(result);
 		debug4("We can't get a db_index for this combo, "
 		       "time_submit=%d and id_job=%u and id_assoc=%u.  "
@@ -100,14 +100,14 @@ static char *_get_user_from_associd(mysql_conn_t *mysql_conn,
 
 	debug4("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result =
-	     mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result =
+	      mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return NULL;
 	}
 	xfree(query);
 
-	if((row = mysql_fetch_row(result)))
+	if ((row = mysql_fetch_row(result)))
 		user = xstrdup(row[0]);
 
 	mysql_free_result(result);
@@ -120,7 +120,7 @@ static uint32_t _get_wckeyid(mysql_conn_t *mysql_conn, char **name,
 {
 	uint32_t wckeyid = 0;
 
-	if(slurm_get_track_wckey()) {
+	if (slurm_get_track_wckey()) {
 		/* Here we are looking for the wckeyid if it doesn't
 		 * exist we will create one.  We don't need to check
 		 * if it is good or not.  Right now this is the only
@@ -135,26 +135,26 @@ static uint32_t _get_wckeyid(mysql_conn_t *mysql_conn, char **name,
 		/* since we are unable to rely on uids here (someone could
 		   not have there uid in the system yet) we must
 		   first get the user name from the associd */
-		if(!(user = _get_user_from_associd(
-			     mysql_conn, cluster, associd))) {
+		if (!(user = _get_user_from_associd(
+			      mysql_conn, cluster, associd))) {
 			error("No user for associd %u", associd);
 			goto no_wckeyid;
 		}
 		/* get the default key */
-		if(!*name) {
+		if (!*name) {
 			slurmdb_user_rec_t user_rec;
 			memset(&user_rec, 0, sizeof(slurmdb_user_rec_t));
 			user_rec.uid = NO_VAL;
 			user_rec.name = user;
-			if(assoc_mgr_fill_in_user(mysql_conn, &user_rec,
-						  1, NULL) != SLURM_SUCCESS) {
+			if (assoc_mgr_fill_in_user(mysql_conn, &user_rec,
+						   1, NULL) != SLURM_SUCCESS) {
 				error("No user by name of %s assoc %u",
 				      user, associd);
 				xfree(user);
 				goto no_wckeyid;
 			}
 
-			if(user_rec.default_wckey)
+			if (user_rec.default_wckey)
 				*name = xstrdup_printf("*%s",
 						       user_rec.default_wckey);
 			else
@@ -166,9 +166,9 @@ static uint32_t _get_wckeyid(mysql_conn_t *mysql_conn, char **name,
 		wckey_rec.uid = NO_VAL;
 		wckey_rec.user = user;
 		wckey_rec.cluster = cluster;
-		if(assoc_mgr_fill_in_wckey(mysql_conn, &wckey_rec,
-					   ACCOUNTING_ENFORCE_WCKEYS,
-					   NULL) != SLURM_SUCCESS) {
+		if (assoc_mgr_fill_in_wckey(mysql_conn, &wckey_rec,
+					    ACCOUNTING_ENFORCE_WCKEYS,
+					    NULL) != SLURM_SUCCESS) {
 			List wckey_list = NULL;
 			slurmdb_wckey_rec_t *wckey_ptr = NULL;
 
@@ -185,10 +185,10 @@ static uint32_t _get_wckeyid(mysql_conn_t *mysql_conn, char **name,
 			/* we have already checked to make
 			   sure this was the slurm user before
 			   calling this */
-			if(as_mysql_add_wckeys(mysql_conn,
-					       slurm_get_slurm_user_id(),
-					       wckey_list)
-			   == SLURM_SUCCESS)
+			if (as_mysql_add_wckeys(mysql_conn,
+						slurm_get_slurm_user_id(),
+						wckey_list)
+			    == SLURM_SUCCESS)
 				acct_storage_p_commit(mysql_conn, 1);
 			/* If that worked lets get it */
 			assoc_mgr_fill_in_wckey(mysql_conn, &wckey_rec,
@@ -228,7 +228,7 @@ extern int as_mysql_job_start(mysql_conn_t *mysql_conn,
 		return SLURM_ERROR;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	debug2("as_mysql_slurmdb_job_start() called");
@@ -239,9 +239,9 @@ extern int as_mysql_job_start(mysql_conn_t *mysql_conn,
 	 * removed. This is most likely the only time we are going to
 	 * be notified of the change also so make the state without
 	 * the resize. */
-	if(IS_JOB_RESIZING(job_ptr)) {
+	if (IS_JOB_RESIZING(job_ptr)) {
 		/* If we have a db_index lets end the previous record. */
-		if(job_ptr->db_index)
+		if (job_ptr->db_index)
 			as_mysql_job_complete(mysql_conn, job_ptr);
 		else
 			error("We don't have a db_index for job %u, "
@@ -273,7 +273,7 @@ extern int as_mysql_job_start(mysql_conn_t *mysql_conn,
 		check_time = submit_time;
 
 	slurm_mutex_lock(&rollup_lock);
-	if(check_time < global_last_rollup) {
+	if (check_time < global_last_rollup) {
 		MYSQL_RES *result = NULL;
 		MYSQL_ROW row;
 
@@ -289,14 +289,14 @@ extern int as_mysql_job_start(mysql_conn_t *mysql_conn,
 				       submit_time, begin_time, start_time);
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result =
-		     mysql_db_query_ret(mysql_conn, query, 0))) {
+		if (!(result =
+		      mysql_db_query_ret(mysql_conn, query, 0))) {
 			xfree(query);
 			slurm_mutex_unlock(&rollup_lock);
 			return SLURM_ERROR;
 		}
 		xfree(query);
-		if((row = mysql_fetch_row(result))) {
+		if ((row = mysql_fetch_row(result))) {
 			mysql_free_result(result);
 			debug4("revieved an update for a "
 			       "job (%u) already known about",
@@ -306,13 +306,13 @@ extern int as_mysql_job_start(mysql_conn_t *mysql_conn,
 		}
 		mysql_free_result(result);
 
-		if(job_ptr->start_time)
+		if (job_ptr->start_time)
 			debug("Need to reroll usage from %sJob %u "
 			      "from %s started then and we are just "
 			      "now hearing about it.",
 			      ctime(&check_time),
 			      job_ptr->job_id, mysql_conn->cluster_name);
-		else if(begin_time)
+		else if (begin_time)
 			debug("Need to reroll usage from %sJob %u "
 			      "from %s became eligible then and we are just "
 			      "now hearing about it.",
@@ -360,17 +360,17 @@ no_rollup_change:
 	else
 		nodes = "None assigned";
 
-	if(job_ptr->batch_flag)
+	if (job_ptr->batch_flag)
 		track_steps = 1;
 
-	if(slurmdbd_conf) {
+	if (slurmdbd_conf) {
 		block_id = xstrdup(job_ptr->comment);
 		node_cnt = job_ptr->total_nodes;
 		node_inx = job_ptr->network;
 	} else {
 		char temp_bit[BUF_SIZE];
 
-		if(job_ptr->node_bitmap) {
+		if (job_ptr->node_bitmap) {
 			node_inx = bit_fmt(temp_bit, sizeof(temp_bit),
 					   job_ptr->node_bitmap);
 		}
@@ -388,15 +388,15 @@ no_rollup_change:
 
 	/* If there is a start_time get the wckeyid.  If the job is
 	 * cancelled before the job starts we also want to grab it. */
-	if(job_ptr->assoc_id
-	   && (job_ptr->start_time || IS_JOB_CANCELLED(job_ptr)))
+	if (job_ptr->assoc_id
+	    && (job_ptr->start_time || IS_JOB_CANCELLED(job_ptr)))
 		wckeyid = _get_wckeyid(mysql_conn, &job_ptr->wckey,
 				       job_ptr->user_id,
 				       mysql_conn->cluster_name,
 				       job_ptr->assoc_id);
 
-	if(!job_ptr->db_index) {
-		if(!begin_time)
+	if (!job_ptr->db_index) {
+		if (!begin_time)
 			begin_time = submit_time;
 		query = xstrdup_printf(
 			"insert into \"%s_%s\" "
@@ -407,15 +407,15 @@ no_rollup_change:
 			"cpus_alloc, nodes_alloc",
 			mysql_conn->cluster_name, job_table);
 
-		if(job_ptr->account)
+		if (job_ptr->account)
 			xstrcat(query, ", account");
-		if(job_ptr->partition)
+		if (job_ptr->partition)
 			xstrcat(query, ", partition");
-		if(block_id)
+		if (block_id)
 			xstrcat(query, ", id_block");
-		if(job_ptr->wckey)
+		if (job_ptr->wckey)
 			xstrcat(query, ", wckey");
-		if(node_inx)
+		if (node_inx)
 			xstrcat(query, ", node_inx");
 
 		xstrfmtcat(query,
@@ -430,15 +430,15 @@ no_rollup_change:
 			   job_ptr->priority, job_ptr->details->min_cpus,
 			   job_ptr->total_cpus, node_cnt);
 
-		if(job_ptr->account)
+		if (job_ptr->account)
 			xstrfmtcat(query, ", '%s'", job_ptr->account);
-		if(job_ptr->partition)
+		if (job_ptr->partition)
 			xstrfmtcat(query, ", '%s'", job_ptr->partition);
-		if(block_id)
+		if (block_id)
 			xstrfmtcat(query, ", '%s'", block_id);
-		if(job_ptr->wckey)
+		if (job_ptr->wckey)
 			xstrfmtcat(query, ", '%s'", job_ptr->wckey);
-		if(node_inx)
+		if (node_inx)
 			xstrfmtcat(query, ", '%s'", node_inx);
 
 		xstrfmtcat(query,
@@ -457,24 +457,24 @@ no_rollup_change:
 			   job_ptr->priority, job_ptr->details->min_cpus,
 			   job_ptr->total_cpus, node_cnt);
 
-		if(job_ptr->account)
+		if (job_ptr->account)
 			xstrfmtcat(query, ", account='%s'", job_ptr->account);
-		if(job_ptr->partition)
+		if (job_ptr->partition)
 			xstrfmtcat(query, ", partition='%s'",
 				   job_ptr->partition);
-		if(block_id)
+		if (block_id)
 			xstrfmtcat(query, ", id_block='%s'", block_id);
-		if(job_ptr->wckey)
+		if (job_ptr->wckey)
 			xstrfmtcat(query, ", wckey='%s'", job_ptr->wckey);
-		if(node_inx)
+		if (node_inx)
 			xstrfmtcat(query, ", node_inx='%s'", node_inx);
 
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 	try_again:
-		if(!(job_ptr->db_index = mysql_db_insert_ret_id(
-			     mysql_conn, query))) {
-			if(!reinit) {
+		if (!(job_ptr->db_index = mysql_db_insert_ret_id(
+			      mysql_conn, query))) {
+			if (!reinit) {
 				error("It looks like the storage has gone "
 				      "away trying to reconnect");
 				mysql_db_close_db_connection(
@@ -491,16 +491,16 @@ no_rollup_change:
 				       mysql_conn->cluster_name,
 				       job_table, nodes);
 
-		if(job_ptr->account)
+		if (job_ptr->account)
 			xstrfmtcat(query, "account='%s', ", job_ptr->account);
-		if(job_ptr->partition)
+		if (job_ptr->partition)
 			xstrfmtcat(query, "partition='%s', ",
 				   job_ptr->partition);
-		if(block_id)
+		if (block_id)
 			xstrfmtcat(query, "id_block='%s', ", block_id);
-		if(job_ptr->wckey)
+		if (job_ptr->wckey)
 			xstrfmtcat(query, "wckey='%s', ", job_ptr->wckey);
-		if(node_inx)
+		if (node_inx)
 			xstrfmtcat(query, "node_inx='%s', ", node_inx);
 
 		xstrfmtcat(query, "time_start=%ld, job_name='%s', state=%u, "
@@ -521,8 +521,8 @@ no_rollup_change:
 	xfree(query);
 
 	/* now we will reset all the steps */
-	if(IS_JOB_RESIZING(job_ptr)) {
-		if(IS_JOB_SUSPENDED(job_ptr))
+	if (IS_JOB_RESIZING(job_ptr)) {
+		if (IS_JOB_SUSPENDED(job_ptr))
 			as_mysql_suspend(mysql_conn, job_db_inx, job_ptr);
 		/* Here we aren't sure how many cpus are being changed here in
 		   the step since we don't have that information from the
@@ -546,8 +546,8 @@ no_rollup_change:
 }
 
 extern List as_mysql_modify_job(mysql_conn_t *mysql_conn, uint32_t uid,
-			     slurmdb_job_modify_cond_t *job_cond,
-			     slurmdb_job_rec_t *job)
+				slurmdb_job_modify_cond_t *job_cond,
+				slurmdb_job_rec_t *job)
 {
 	List ret_list = NULL;
 	int rc = SLURM_SUCCESS;
@@ -560,15 +560,15 @@ extern List as_mysql_modify_job(mysql_conn_t *mysql_conn, uint32_t uid,
 	MYSQL_RES *result = NULL;
 	MYSQL_ROW row;
 
-	if(!job_cond || !job) {
+	if (!job_cond || !job) {
 		error("we need something to change");
 		return NULL;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
-	if(job_cond->job_id == NO_VAL) {
+	if (job_cond->job_id == NO_VAL) {
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		error("Job ID was not specified for job modification\n");
 		return NULL;
@@ -577,10 +577,10 @@ extern List as_mysql_modify_job(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	xstrfmtcat(extra, " && id_user=%u", uid);
 
-	if(job->derived_ec != NO_VAL)
+	if (job->derived_ec != NO_VAL)
 		xstrfmtcat(vals, ", derived_ec=%u", job->derived_ec);
 
-	if(job->derived_es)
+	if (job->derived_es)
 		xstrfmtcat(vals, ", derived_es='%s'", job->derived_es);
 
 	if (!vals) {
@@ -603,14 +603,14 @@ extern List as_mysql_modify_job(mysql_conn_t *mysql_conn, uint32_t uid,
 	}
 
 	xfree(extra);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(vals);
 		xfree(query);
 		return NULL;
 	}
 
 	ret_list = list_create(slurm_destroy_char);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		submit_time = (time_t)atol(row[1]);
 		if (submit_time > most_recent) {
 			most_recent = submit_time;
@@ -664,7 +664,7 @@ extern int as_mysql_job_complete(mysql_conn_t *mysql_conn,
 		return SLURM_ERROR;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 	debug2("as_mysql_slurmdb_job_complete() called");
 
@@ -689,7 +689,7 @@ extern int as_mysql_job_complete(mysql_conn_t *mysql_conn,
 	}
 
 	slurm_mutex_lock(&rollup_lock);
-	if(end_time < global_last_rollup) {
+	if (end_time < global_last_rollup) {
 		global_last_rollup = job_ptr->end_time;
 		slurm_mutex_unlock(&rollup_lock);
 
@@ -711,17 +711,17 @@ extern int as_mysql_job_complete(mysql_conn_t *mysql_conn,
 	else
 		nodes = "None assigned";
 
-	if(!job_ptr->db_index) {
-		if(!(job_ptr->db_index =
-		     _get_db_index(mysql_conn,
-				   submit_time,
-				   job_ptr->job_id,
-				   job_ptr->assoc_id))) {
+	if (!job_ptr->db_index) {
+		if (!(job_ptr->db_index =
+		      _get_db_index(mysql_conn,
+				    submit_time,
+				    job_ptr->job_id,
+				    job_ptr->assoc_id))) {
 			/* If we get an error with this just fall
 			 * through to avoid an infinite loop
 			 */
-			if(as_mysql_job_start(
-				   mysql_conn, job_ptr) == SLURM_ERROR) {
+			if (as_mysql_job_start(
+				    mysql_conn, job_ptr) == SLURM_ERROR) {
 				error("couldn't add job %u at job completion",
 				      job_ptr->job_id);
 				return SLURM_SUCCESS;
@@ -771,16 +771,16 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn,
 
 	if (step_ptr->job_ptr->resize_time) {
 		submit_time = start_time = step_ptr->job_ptr->resize_time;
-		if(step_ptr->start_time > submit_time)
+		if (step_ptr->start_time > submit_time)
 			start_time = step_ptr->start_time;
 	} else {
 		start_time = step_ptr->start_time;
 		submit_time = step_ptr->job_ptr->details->submit_time;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
-	if(slurmdbd_conf) {
+	if (slurmdbd_conf) {
 		tasks = step_ptr->job_ptr->details->num_tasks;
 		cpus = step_ptr->cpu_count;
 		snprintf(node_list, BUFFER_SIZE, "%s",
@@ -791,7 +791,7 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn,
 	} else if (step_ptr->step_id == SLURM_BATCH_SCRIPT) {
 		char temp_bit[BUF_SIZE];
 
-		if(step_ptr->step_node_bitmap) {
+		if (step_ptr->step_node_bitmap) {
 			node_inx = bit_fmt(temp_bit, sizeof(temp_bit),
 					   step_ptr->step_node_bitmap);
 		}
@@ -803,7 +803,7 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn,
 	} else {
 		char temp_bit[BUF_SIZE];
 
-		if(step_ptr->step_node_bitmap) {
+		if (step_ptr->step_node_bitmap) {
 			node_inx = bit_fmt(temp_bit, sizeof(temp_bit),
 					   step_ptr->step_node_bitmap);
 		}
@@ -812,7 +812,7 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn,
 		select_g_select_jobinfo_get(step_ptr->job_ptr->select_jobinfo,
 					    SELECT_JOBDATA_IONODES,
 					    &ionodes);
-		if(ionodes) {
+		if (ionodes) {
 			snprintf(node_list, BUFFER_SIZE,
 				 "%s[%s]", step_ptr->job_ptr->nodes, ionodes);
 			xfree(ionodes);
@@ -823,7 +823,8 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn,
 					    SELECT_JOBDATA_NODE_CNT,
 					    &nodes);
 #else
-		if(!step_ptr->step_layout || !step_ptr->step_layout->task_cnt) {
+		if (!step_ptr->step_layout
+		    || !step_ptr->step_layout->task_cnt) {
 			tasks = cpus = step_ptr->job_ptr->total_cpus;
 			snprintf(node_list, BUFFER_SIZE, "%s",
 				 step_ptr->job_ptr->nodes);
@@ -839,17 +840,17 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn,
 #endif
 	}
 
-	if(!step_ptr->job_ptr->db_index) {
-		if(!(step_ptr->job_ptr->db_index =
-		     _get_db_index(mysql_conn,
-				   submit_time,
-				   step_ptr->job_ptr->job_id,
-				   step_ptr->job_ptr->assoc_id))) {
+	if (!step_ptr->job_ptr->db_index) {
+		if (!(step_ptr->job_ptr->db_index =
+		      _get_db_index(mysql_conn,
+				    submit_time,
+				    step_ptr->job_ptr->job_id,
+				    step_ptr->job_ptr->assoc_id))) {
 			/* If we get an error with this just fall
 			 * through to avoid an infinite loop
 			 */
-			if(as_mysql_job_start(mysql_conn, step_ptr->job_ptr)
-			   == SLURM_ERROR) {
+			if (as_mysql_job_start(mysql_conn, step_ptr->job_ptr)
+			    == SLURM_ERROR) {
 				error("couldn't add job %u at step start",
 				      step_ptr->job_ptr->job_id);
 				return SLURM_SUCCESS;
@@ -912,7 +913,7 @@ extern int as_mysql_step_complete(mysql_conn_t *mysql_conn,
 
 	if (step_ptr->job_ptr->resize_time) {
 		submit_time = start_time = step_ptr->job_ptr->resize_time;
-		if(step_ptr->start_time > submit_time)
+		if (step_ptr->start_time > submit_time)
 			start_time = step_ptr->start_time;
 	} else {
 		start_time = step_ptr->start_time;
@@ -925,10 +926,10 @@ extern int as_mysql_step_complete(mysql_conn_t *mysql_conn,
 		jobacct = &dummy_jobacct;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
-	if(slurmdbd_conf) {
+	if (slurmdbd_conf) {
 		now = step_ptr->job_ptr->end_time;
 		tasks = step_ptr->job_ptr->details->num_tasks;
 		cpus = step_ptr->cpu_count;
@@ -941,7 +942,7 @@ extern int as_mysql_step_complete(mysql_conn_t *mysql_conn,
 		tasks = cpus = step_ptr->job_ptr->details->min_cpus;
 
 #else
-		if(!step_ptr->step_layout || !step_ptr->step_layout->task_cnt)
+		if (!step_ptr->step_layout || !step_ptr->step_layout->task_cnt)
 			tasks = cpus = step_ptr->job_ptr->total_cpus;
 		else {
 			cpus = step_ptr->cpu_count;
@@ -964,7 +965,7 @@ extern int as_mysql_step_complete(mysql_conn_t *mysql_conn,
 	}
 
 	/* figure out the ave of the totals sent */
-	if(cpus > 0) {
+	if (cpus > 0) {
 		ave_vsize = (double)jobacct->tot_vsize;
 		ave_vsize /= (double)cpus;
 		ave_rss = (double)jobacct->tot_rss;
@@ -975,21 +976,21 @@ extern int as_mysql_step_complete(mysql_conn_t *mysql_conn,
 		ave_cpu /= (double)cpus;
 	}
 
-	if(jobacct->min_cpu != NO_VAL) {
+	if (jobacct->min_cpu != NO_VAL) {
 		ave_cpu2 = (double)jobacct->min_cpu;
 	}
 
-	if(!step_ptr->job_ptr->db_index) {
-		if(!(step_ptr->job_ptr->db_index =
-		     _get_db_index(mysql_conn,
-				   submit_time,
-				   step_ptr->job_ptr->job_id,
-				   step_ptr->job_ptr->assoc_id))) {
+	if (!step_ptr->job_ptr->db_index) {
+		if (!(step_ptr->job_ptr->db_index =
+		      _get_db_index(mysql_conn,
+				    submit_time,
+				    step_ptr->job_ptr->job_id,
+				    step_ptr->job_ptr->assoc_id))) {
 			/* If we get an error with this just fall
 			 * through to avoid an infinite loop
 			 */
-			if(as_mysql_job_start(mysql_conn, step_ptr->job_ptr)
-			   == SLURM_ERROR) {
+			if (as_mysql_job_start(mysql_conn, step_ptr->job_ptr)
+			    == SLURM_ERROR) {
 				error("couldn't add job %u "
 				      "at step completion",
 				      step_ptr->job_ptr->job_id);
@@ -1059,7 +1060,7 @@ extern int as_mysql_suspend(mysql_conn_t *mysql_conn,
 	time_t submit_time;
 	uint32_t job_db_inx;
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	if (job_ptr->resize_time)
@@ -1067,17 +1068,17 @@ extern int as_mysql_suspend(mysql_conn_t *mysql_conn,
 	else
 		submit_time = job_ptr->details->submit_time;
 
-	if(!job_ptr->db_index) {
-		if(!(job_ptr->db_index =
-		     _get_db_index(mysql_conn,
-				   submit_time,
-				   job_ptr->job_id,
-				   job_ptr->assoc_id))) {
+	if (!job_ptr->db_index) {
+		if (!(job_ptr->db_index =
+		      _get_db_index(mysql_conn,
+				    submit_time,
+				    job_ptr->job_id,
+				    job_ptr->assoc_id))) {
 			/* If we get an error with this just fall
 			 * through to avoid an infinite loop
 			 */
-			if(as_mysql_job_start(
-				   mysql_conn, job_ptr) == SLURM_ERROR) {
+			if (as_mysql_job_start(
+				    mysql_conn, job_ptr) == SLURM_ERROR) {
 				error("couldn't suspend job %u",
 				      job_ptr->job_id);
 				return SLURM_SUCCESS;
@@ -1085,8 +1086,8 @@ extern int as_mysql_suspend(mysql_conn_t *mysql_conn,
 		}
 	}
 
-	if(IS_JOB_RESIZING(job_ptr)) {
-		if(!old_db_inx) {
+	if (IS_JOB_RESIZING(job_ptr)) {
+		if (!old_db_inx) {
 			error("No old db inx given for job %u cluster %s, "
 			      "can't update suspend table.",
 			      job_ptr->job_id, mysql_conn->cluster_name);
@@ -1112,7 +1113,7 @@ extern int as_mysql_suspend(mysql_conn_t *mysql_conn,
 		   (int)job_ptr->suspend_time,
 		   job_ptr->job_state & JOB_STATE_BASE,
 		   job_db_inx);
-	if(IS_JOB_SUSPENDED(job_ptr))
+	if (IS_JOB_SUSPENDED(job_ptr))
 		xstrfmtcat(query,
 			   "insert into \"%s_%s\" (job_db_inx, id_assoc, "
 			   "time_start, time_end) values (%u, %u, %d, 0);",
@@ -1131,7 +1132,7 @@ extern int as_mysql_suspend(mysql_conn_t *mysql_conn,
 	rc = mysql_db_query(mysql_conn, query);
 
 	xfree(query);
-	if(rc != SLURM_ERROR) {
+	if (rc != SLURM_ERROR) {
 		xstrfmtcat(query,
 			   "update \"%s_%s\" set "
 			   "time_suspended=%u-time_suspended, "
@@ -1157,7 +1158,7 @@ extern int as_mysql_flush_jobs_on_cluster(
 	char *id_char = NULL;
 	char *suspended_char = NULL;
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	/* First we need to get the job_db_inx's and states so we can clean up
@@ -1169,17 +1170,17 @@ extern int as_mysql_flush_jobs_on_cluster(
 		mysql_conn->cluster_name, job_table);
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result =
-	     mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result =
+	      mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		int state = slurm_atoul(row[1]);
-		if(state == JOB_SUSPENDED) {
-			if(suspended_char)
+		if (state == JOB_SUSPENDED) {
+			if (suspended_char)
 				xstrfmtcat(suspended_char,
 					   " || job_db_inx=%s", row[0]);
 			else
@@ -1187,14 +1188,14 @@ extern int as_mysql_flush_jobs_on_cluster(
 					   row[0]);
 		}
 
-		if(id_char)
+		if (id_char)
 			xstrfmtcat(id_char, " || job_db_inx=%s", row[0]);
 		else
 			xstrfmtcat(id_char, "job_db_inx=%s", row[0]);
 	}
 	mysql_free_result(result);
 
-	if(suspended_char) {
+	if (suspended_char) {
 		xstrfmtcat(query,
 			   "update \"%s_%s\" set "
 			   "time_suspended=%ld-time_suspended "
@@ -1214,7 +1215,7 @@ extern int as_mysql_flush_jobs_on_cluster(
 			   event_time, suspended_char);
 		xfree(suspended_char);
 	}
-	if(id_char) {
+	if (id_char) {
 		xstrfmtcat(query,
 			   "update \"%s_%s\" set state=%d, "
 			   "time_end=%ld where %s;",
@@ -1228,7 +1229,7 @@ extern int as_mysql_flush_jobs_on_cluster(
 		xfree(id_char);
 	}
 
-	if(query) {
+	if (query) {
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_jobacct_process.c b/src/plugins/accounting_storage/mysql/as_mysql_jobacct_process.c
index 69692c50c95..31312f8f739 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_jobacct_process.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_jobacct_process.c
@@ -210,15 +210,15 @@ static void _state_time_string(char **extra, uint32_t state,
 {
 	int base_state = state & JOB_STATE_BASE;
 
-	if(!start && !end) {
+	if (!start && !end) {
 		xstrfmtcat(*extra, "t1.state='%u'", state);
 		return;
 	}
 
  	switch(base_state) {
 	case JOB_PENDING:
-		if(start) {
-			if(!end) {
+		if (start) {
+			if (!end) {
 				xstrfmtcat(*extra,
 					   "(t1.time_eligible && "
 					   "((!t1.time_start && !t1.time_end) "
@@ -245,8 +245,8 @@ static void _state_time_string(char **extra, uint32_t state,
 		/* FIX ME: this should do something with the suspended
 		   table, but it doesn't right now. */
 	case JOB_RUNNING:
-		if(start) {
-			if(!end) {
+		if (start) {
+			if (!end) {
 				xstrfmtcat(*extra,
 					   "(t1.time_start && "
 					   "((!t1.time_end && t1.state=%d) || "
@@ -275,8 +275,8 @@ static void _state_time_string(char **extra, uint32_t state,
 	case JOB_NODE_FAIL:
 	default:
 		xstrfmtcat(*extra, "(t1.state='%u' && (t1.time_end && ", state);
-		if(start) {
-			if(!end) {
+		if (start) {
+			if (!end) {
 				xstrfmtcat(*extra, "(t1.time_end >= %d)))",
 					   start);
 			} else {
@@ -284,7 +284,7 @@ static void _state_time_string(char **extra, uint32_t state,
 					   "(t1.time_end between %d and %d)))",
 					   start, end);
 			}
-		} else if(end) {
+		} else if (end) {
 			xstrfmtcat(*extra, "(t1.time_end <= %d)))", end);
 		}
 		break;
@@ -296,8 +296,8 @@ static void _state_time_string(char **extra, uint32_t state,
 static void _destroy_local_cluster(void *object)
 {
 	local_cluster_t *local_cluster = (local_cluster_t *)object;
-	if(local_cluster) {
-		if(local_cluster->hl)
+	if (local_cluster) {
+		if (local_cluster->hl)
 			hostlist_destroy(local_cluster->hl);
 		FREE_NULL_BITMAP(local_cluster->asked_bitmap);
 		xfree(local_cluster);
@@ -334,14 +334,14 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 	 * if this flag is set.  We also include any accounts they may be
 	 * coordinator of.
 	 */
-	if(!is_admin && (private_data & PRIVATE_DATA_JOBS)) {
+	if (!is_admin && (private_data & PRIVATE_DATA_JOBS)) {
 		query = xstrdup_printf("select lft from \"%s_%s\" "
 				       "where user='%s'",
 				       cluster_name, assoc_table, user->name);
-		if(user->coord_accts) {
+		if (user->coord_accts) {
 			slurmdb_coord_rec_t *coord = NULL;
 			itr = list_iterator_create(user->coord_accts);
-			while((coord = list_next(itr))) {
+			while ((coord = list_next(itr))) {
 				xstrfmtcat(query, " || acct='%s'",
 					   coord->name);
 			}
@@ -349,8 +349,8 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 		}
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(extra);
 			xfree(query);
 			rc = SLURM_ERROR;
@@ -358,14 +358,14 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 		}
 		xfree(query);
 		set = 0;
-		while((row = mysql_fetch_row(result))) {
-			if(set) {
+		while ((row = mysql_fetch_row(result))) {
+			if (set) {
 				xstrfmtcat(extra,
 					   " || (%s between %s.lft and %s.rgt)",
 					   row[0], prefix, prefix);
 			} else {
 				set = 1;
-				if(extra)
+				if (extra)
 					xstrfmtcat(extra,
 						   " && ((%s between %s.lft "
 						   "and %s.rgt)",
@@ -379,7 +379,7 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 						   prefix);
 			}
 		}
-		if(set)
+		if (set)
 			xstrcat(extra,")");
 		mysql_free_result(result);
 	}
@@ -392,7 +392,7 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 			       "on t1.id_assoc=t2.id_assoc",
 			       job_fields, cluster_name, job_table,
 			       cluster_name, assoc_table);
-	if(extra) {
+	if (extra) {
 		xstrcat(query, extra);
 		xfree(extra);
 	}
@@ -405,7 +405,7 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		rc = SLURM_ERROR;
 		goto end_it;
@@ -419,32 +419,32 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 	   things work.  This should go before the setup of conds
 	   since we could update the start/end time.
 	*/
-	if(job_cond && job_cond->used_nodes) {
+	if (job_cond && job_cond->used_nodes) {
 		local_cluster_list = setup_cluster_list_with_inx(
 			mysql_conn, job_cond, (void **)&curr_cluster);
-		if(!local_cluster_list) {
+		if (!local_cluster_list) {
 			rc = SLURM_ERROR;
 			goto end_it;
 		}
 	}
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		char *id = row[JOB_REQ_ID];
 		bool job_ended = 0;
 		int submit = slurm_atoul(row[JOB_REQ_SUBMIT]);
 
 		curr_id = slurm_atoul(row[JOB_REQ_JOBID]);
 
-		if(job_cond && !job_cond->duplicates
-		   && (curr_id == last_id)
-		   && (slurm_atoul(row[JOB_REQ_STATE]) != JOB_RESIZING))
+		if (job_cond && !job_cond->duplicates
+		    && (curr_id == last_id)
+		    && (slurm_atoul(row[JOB_REQ_STATE]) != JOB_RESIZING))
 			continue;
 
 		/* check the bitmap to see if this is one of the jobs
 		   we are looking for */
-		if(!good_nodes_from_inx(local_cluster_list,
-					(void **)&curr_cluster,
-					row[JOB_REQ_NODE_INX], submit)) {
+		if (!good_nodes_from_inx(local_cluster_list,
+					 (void **)&curr_cluster,
+					 row[JOB_REQ_NODE_INX], submit)) {
 			last_id = curr_id;
 			continue;
 		}
@@ -452,7 +452,7 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 		job = slurmdb_create_job_rec();
 		job->state = slurm_atoul(row[JOB_REQ_STATE]);
 		last_state = job->state;
-		if(curr_id == last_id)
+		if (curr_id == last_id)
 			/* put in reverse so we order by the submit getting
 			   larger which it is given to us in reverse
 			   order from the database */
@@ -469,26 +469,26 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 		job->cluster = xstrdup(cluster_name);
 
 		/* we want a blank wckey if the name is null */
-		if(row[JOB_REQ_WCKEY])
+		if (row[JOB_REQ_WCKEY])
 			job->wckey = xstrdup(row[JOB_REQ_WCKEY]);
 		else
 			job->wckey = xstrdup("");
 		job->wckeyid = slurm_atoul(row[JOB_REQ_WCKEYID]);
 
-		if(row[JOB_REQ_USER_NAME])
+		if (row[JOB_REQ_USER_NAME])
 			job->user = xstrdup(row[JOB_REQ_USER_NAME]);
 		else
 			job->uid = slurm_atoul(row[JOB_REQ_UID]);
 
-		if(row[JOB_REQ_LFT])
+		if (row[JOB_REQ_LFT])
 			job->lft = slurm_atoul(row[JOB_REQ_LFT]);
 
-		if(row[JOB_REQ_ACCOUNT] && row[JOB_REQ_ACCOUNT][0])
+		if (row[JOB_REQ_ACCOUNT] && row[JOB_REQ_ACCOUNT][0])
 			job->account = xstrdup(row[JOB_REQ_ACCOUNT]);
-		else if(row[JOB_REQ_ACCOUNT1] && row[JOB_REQ_ACCOUNT1][0])
+		else if (row[JOB_REQ_ACCOUNT1] && row[JOB_REQ_ACCOUNT1][0])
 			job->account = xstrdup(row[JOB_REQ_ACCOUNT1]);
 
-		if(row[JOB_REQ_BLOCKID])
+		if (row[JOB_REQ_BLOCKID])
 			job->blockid = xstrdup(row[JOB_REQ_BLOCKID]);
 
 		job->eligible = slurm_atoul(row[JOB_REQ_ELIGIBLE]);
@@ -498,26 +498,26 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 		job->timelimit = slurm_atoul(row[JOB_REQ_TIMELIMIT]);
 
 		/* since the job->end could be set later end it here */
-		if(job->end) {
+		if (job->end) {
 			job_ended = 1;
-			if(!job->start || (job->start > job->end))
+			if (!job->start || (job->start > job->end))
 				job->start = job->end;
 		}
 
-		if(job_cond && !job_cond->without_usage_truncation
-		   && job_cond->usage_start) {
-			if(job->start && (job->start < job_cond->usage_start))
+		if (job_cond && !job_cond->without_usage_truncation
+		    && job_cond->usage_start) {
+			if (job->start && (job->start < job_cond->usage_start))
 				job->start = job_cond->usage_start;
 
-			if(!job->end || job->end > job_cond->usage_end)
+			if (!job->end || job->end > job_cond->usage_end)
 				job->end = job_cond->usage_end;
 
-			if(!job->start)
+			if (!job->start)
 				job->start = job->end;
 
 			job->elapsed = job->end - job->start;
 
-			if(row[JOB_REQ_SUSPENDED]) {
+			if (row[JOB_REQ_SUSPENDED]) {
 				MYSQL_RES *result2 = NULL;
 				MYSQL_ROW row2;
 				/* get the suspended time for this job */
@@ -535,29 +535,29 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 				debug4("%d(%s:%d) query\n%s",
 				       mysql_conn->conn, THIS_FILE,
 				       __LINE__, query);
-				if(!(result2 = mysql_db_query_ret(
-					     mysql_conn,
-					     query, 0))) {
+				if (!(result2 = mysql_db_query_ret(
+					      mysql_conn,
+					      query, 0))) {
 					list_destroy(job_list);
 					job_list = NULL;
 					break;
 				}
 				xfree(query);
-				while((row2 = mysql_fetch_row(result2))) {
+				while ((row2 = mysql_fetch_row(result2))) {
 					time_t local_start =
 						slurm_atoul(row2[0]);
 					time_t local_end =
 						slurm_atoul(row2[1]);
 
-					if(!local_start)
+					if (!local_start)
 						continue;
 
-					if(job->start > local_start)
+					if (job->start > local_start)
 						local_start = job->start;
-					if(job->end < local_end)
+					if (job->end < local_end)
 						local_end = job->end;
 
-					if((local_end - local_start) < 1)
+					if ((local_end - local_start) < 1)
 						continue;
 
 					job->elapsed -=
@@ -572,11 +572,11 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 			job->suspended = slurm_atoul(row[JOB_REQ_SUSPENDED]);
 
 			/* fix the suspended number to be correct */
-			if(job->state == JOB_SUSPENDED)
+			if (job->state == JOB_SUSPENDED)
 				job->suspended = now - job->suspended;
-			if(!job->start) {
+			if (!job->start) {
 				job->elapsed = 0;
-			} else if(!job->end) {
+			} else if (!job->end) {
 				job->elapsed = now - job->start;
 			} else {
 				job->elapsed = job->end - job->start;
@@ -585,7 +585,7 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 			job->elapsed -= job->suspended;
 		}
 
-		if((int)job->elapsed < 0)
+		if ((int)job->elapsed < 0)
 			job->elapsed = 0;
 
 		job->jobid = curr_id;
@@ -595,10 +595,10 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 		job->derived_ec = slurm_atoul(row[JOB_REQ_DERIVED_EC]);
 		job->derived_es = xstrdup(row[JOB_REQ_DERIVED_ES]);
 
-		if(row[JOB_REQ_PARTITION])
+		if (row[JOB_REQ_PARTITION])
 			job->partition = xstrdup(row[JOB_REQ_PARTITION]);
 
-		if(row[JOB_REQ_NODELIST])
+		if (row[JOB_REQ_NODELIST])
 			job->nodes = xstrdup(row[JOB_REQ_NODELIST]);
 
 		if (!job->nodes || !strcmp(job->nodes, "(null)")) {
@@ -613,15 +613,15 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 		job->qosid = slurm_atoul(row[JOB_REQ_QOS]);
 		job->show_full = 1;
 
-		if(only_pending || (job_cond && job_cond->without_steps))
+		if (only_pending || (job_cond && job_cond->without_steps))
 			goto skip_steps;
 
-		if(job_cond && job_cond->step_list
-		   && list_count(job_cond->step_list)) {
+		if (job_cond && job_cond->step_list
+		    && list_count(job_cond->step_list)) {
 			set = 0;
 			itr = list_iterator_create(job_cond->step_list);
-			while((selected_step = list_next(itr))) {
-				if(selected_step->jobid != job->jobid) {
+			while ((selected_step = list_next(itr))) {
+				if (selected_step->jobid != job->jobid) {
 					continue;
 				} else if (selected_step->stepid == NO_VAL) {
 					job->show_full = 1;
@@ -630,7 +630,7 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 					selected_step->stepid =
 						SLURM_BATCH_SCRIPT;
 
-				if(set)
+				if (set)
 					xstrcat(extra, " || ");
 				else
 					xstrcat(extra, " && (");
@@ -642,14 +642,14 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 				job->show_full = 0;
 			}
 			list_iterator_destroy(itr);
-			if(set)
+			if (set)
 				xstrcat(extra, ")");
 		}
 		query =	xstrdup_printf("select %s from \"%s_%s\" as t1 "
 				       "where t1.job_db_inx=%s",
 				       step_fields, cluster_name,
 				       step_table, id);
-		if(extra) {
+		if (extra) {
 			xstrcat(query, extra);
 			xfree(extra);
 		}
@@ -657,8 +657,8 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 		debug4("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 
-		if(!(step_result = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(step_result = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
 			rc = SLURM_ERROR;
 			goto end_it;
@@ -672,17 +672,17 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 		while ((step_row = mysql_fetch_row(step_result))) {
 			/* check the bitmap to see if this is one of the steps
 			   we are looking for */
-			if(!good_nodes_from_inx(local_cluster_list,
-						(void **)&curr_cluster,
-						step_row[STEP_REQ_NODE_INX],
-						submit))
+			if (!good_nodes_from_inx(local_cluster_list,
+						 (void **)&curr_cluster,
+						 step_row[STEP_REQ_NODE_INX],
+						 submit))
 				continue;
 
 			step = slurmdb_create_step_rec();
 			step->tot_cpu_sec = 0;
 			step->tot_cpu_usec = 0;
 			step->job_ptr = job;
-			if(!job->first_step_ptr)
+			if (!job->first_step_ptr)
 				job->first_step_ptr = step;
 			list_append(job->steps, step);
 			step->stepid = slurm_atoul(step_row[STEP_REQ_STEPID]);
@@ -697,43 +697,43 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 			step->ntasks = slurm_atoul(step_row[STEP_REQ_TASKS]);
 			step->task_dist =
 				slurm_atoul(step_row[STEP_REQ_TASKDIST]);
-			if(!step->ntasks)
+			if (!step->ntasks)
 				step->ntasks = step->ncpus;
 
 			step->start = slurm_atoul(step_row[STEP_REQ_START]);
 
 			step->end = slurm_atoul(step_row[STEP_REQ_END]);
 			/* if the job has ended end the step also */
-			if(!step->end && job_ended) {
+			if (!step->end && job_ended) {
 				step->end = job->end;
 				step->state = job->state;
 			}
 
-			if(job_cond && !job_cond->without_usage_truncation
-			   && job_cond->usage_start) {
-				if(step->start
-				   && (step->start < job_cond->usage_start))
+			if (job_cond && !job_cond->without_usage_truncation
+			    && job_cond->usage_start) {
+				if (step->start
+				    && (step->start < job_cond->usage_start))
 					step->start = job_cond->usage_start;
 
-				if(!step->start && step->end)
+				if (!step->start && step->end)
 					step->start = step->end;
 
-				if(!step->end
-				   || (step->end > job_cond->usage_end))
+				if (!step->end
+				    || (step->end > job_cond->usage_end))
 					step->end = job_cond->usage_end;
 			}
 
 			/* figure this out by start stop */
 			step->suspended =
 				slurm_atoul(step_row[STEP_REQ_SUSPENDED]);
-			if(!step->end) {
+			if (!step->end) {
 				step->elapsed = now - step->start;
 			} else {
 				step->elapsed = step->end - step->start;
 			}
 			step->elapsed -= step->suspended;
 
-			if((int)step->elapsed < 0)
+			if ((int)step->elapsed < 0)
 				step->elapsed = 0;
 
 			step->user_cpu_sec =
@@ -787,7 +787,7 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 		}
 		mysql_free_result(step_result);
 
-		if(!job->track_steps) {
+		if (!job->track_steps) {
 			/* If we don't have track_steps we want to see
 			   if we have multiple steps.  If we only have
 			   1 step check the job name against the step
@@ -795,10 +795,10 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 			   different.  If it is different print out
 			   the step separate.
 			*/
-			if(list_count(job->steps) > 1)
+			if (list_count(job->steps) > 1)
 				job->track_steps = 1;
-			else if(step && step->stepname && job->jobname) {
-				if(strcmp(step->stepname, job->jobname))
+			else if (step && step->stepname && job->jobname) {
+				if (strcmp(step->stepname, job->jobname))
 					job->track_steps = 1;
 			}
 		}
@@ -809,10 +809,10 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 	mysql_free_result(result);
 
 end_it:
-	if(local_cluster_list)
+	if (local_cluster_list)
 		list_destroy(local_cluster_list);
 
-	if(rc == SLURM_SUCCESS)
+	if (rc == SLURM_SUCCESS)
 		list_transfer(sent_list, job_list);
 
 	list_destroy(job_list);
@@ -831,10 +831,11 @@ extern List setup_cluster_list_with_inx(mysql_conn_t *mysql_conn,
 	hostlist_iterator_t h_itr = NULL;
 	char *query = NULL;
 
-	if(!job_cond || !job_cond->used_nodes)
+	if (!job_cond || !job_cond->used_nodes)
 		return NULL;
 
-	if(!job_cond->cluster_list || list_count(job_cond->cluster_list) != 1) {
+	if (!job_cond->cluster_list
+	    || list_count(job_cond->cluster_list) != 1) {
 		error("If you are doing a query against nodes "
 		      "you must only have 1 cluster "
 		      "you are asking for.");
@@ -842,7 +843,7 @@ extern List setup_cluster_list_with_inx(mysql_conn_t *mysql_conn,
 	}
 
 	temp_hl = hostlist_create(job_cond->used_nodes);
-	if(!hostlist_count(temp_hl)) {
+	if (!hostlist_count(temp_hl)) {
 		error("we didn't get any real hosts to look for.");
 		goto no_hosts;
 	}
@@ -854,8 +855,8 @@ extern List setup_cluster_list_with_inx(mysql_conn_t *mysql_conn,
 			       (char *)list_peek(job_cond->cluster_list),
 			       event_table);
 
-	if(job_cond->usage_start) {
-		if(!job_cond->usage_end)
+	if (job_cond->usage_start) {
+		if (!job_cond->usage_end)
 			job_cond->usage_end = now;
 
 		xstrfmtcat(query,
@@ -866,7 +867,7 @@ extern List setup_cluster_list_with_inx(mysql_conn_t *mysql_conn,
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		hostlist_destroy(temp_hl);
 		return NULL;
@@ -874,7 +875,7 @@ extern List setup_cluster_list_with_inx(mysql_conn_t *mysql_conn,
 	xfree(query);
 
 	local_cluster_list = list_create(_destroy_local_cluster);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		char *host = NULL;
 		int loc = 0;
 		local_cluster_t *local_cluster =
@@ -884,16 +885,16 @@ extern List setup_cluster_list_with_inx(mysql_conn_t *mysql_conn,
 		local_cluster->end   = slurm_atoul(row[2]);
 		local_cluster->asked_bitmap =
 			bit_alloc(hostlist_count(local_cluster->hl));
-		while((host = hostlist_next(h_itr))) {
-			if((loc = hostlist_find(
-				    local_cluster->hl, host)) != -1)
+		while ((host = hostlist_next(h_itr))) {
+			if ((loc = hostlist_find(
+				     local_cluster->hl, host)) != -1)
 				bit_set(local_cluster->asked_bitmap, loc);
 			free(host);
 		}
 		hostlist_iterator_reset(h_itr);
-		if(bit_ffs(local_cluster->asked_bitmap) != -1) {
+		if (bit_ffs(local_cluster->asked_bitmap) != -1) {
 			list_append(local_cluster_list, local_cluster);
-			if(local_cluster->end == 0) {
+			if (local_cluster->end == 0) {
 				local_cluster->end = now;
 				(*curr_cluster) = local_cluster;
 			}
@@ -902,7 +903,7 @@ extern List setup_cluster_list_with_inx(mysql_conn_t *mysql_conn,
 	}
 	mysql_free_result(result);
 	hostlist_iterator_destroy(h_itr);
-	if(!list_count(local_cluster_list)) {
+	if (!list_count(local_cluster_list)) {
 		hostlist_destroy(temp_hl);
 		list_destroy(local_cluster_list);
 		return NULL;
@@ -922,30 +923,30 @@ extern int good_nodes_from_inx(List local_cluster_list,
 
 	/* check the bitmap to see if this is one of the jobs
 	   we are looking for */
-	if(*curr_cluster) {
+	if (*curr_cluster) {
 		bitstr_t *job_bitmap = NULL;
-		if(!node_inx || !node_inx[0])
+		if (!node_inx || !node_inx[0])
 			return 0;
-		if((submit < (*curr_cluster)->start)
-		   || (submit > (*curr_cluster)->end)) {
+		if ((submit < (*curr_cluster)->start)
+		    || (submit > (*curr_cluster)->end)) {
 			local_cluster_t *local_cluster = NULL;
 
 			ListIterator itr =
 				list_iterator_create(local_cluster_list);
-			while((local_cluster = list_next(itr))) {
-				if((submit >= local_cluster->start)
-				   && (submit <= local_cluster->end)) {
+			while ((local_cluster = list_next(itr))) {
+				if ((submit >= local_cluster->start)
+				    && (submit <= local_cluster->end)) {
 					*curr_cluster = local_cluster;
 					break;
 				}
 			}
 			list_iterator_destroy(itr);
-			if(!local_cluster)
+			if (!local_cluster)
 				return 0;
 		}
 		job_bitmap = bit_alloc(hostlist_count((*curr_cluster)->hl));
 		bit_unfmt(job_bitmap, node_inx);
-		if(!bit_overlap((*curr_cluster)->asked_bitmap, job_bitmap)) {
+		if (!bit_overlap((*curr_cluster)->asked_bitmap, job_bitmap)) {
 			FREE_NULL_BITMAP(job_bitmap);
 			return 0;
 		}
@@ -962,12 +963,12 @@ extern char *setup_job_cluster_cond_limits(mysql_conn_t *mysql_conn,
 	ListIterator itr = NULL;
 	char *object = NULL;
 
-	if(!job_cond)
+	if (!job_cond)
 		return NULL;
 
 	/* this must be done before resvid_list since we set
 	   resvid_list up here */
-	if(job_cond->resv_list && list_count(job_cond->resv_list)) {
+	if (job_cond->resv_list && list_count(job_cond->resv_list)) {
 		char *query = xstrdup_printf(
 			"select distinct job_db_inx from \"%s_%s\" where (",
 			cluster_name, job_table);
@@ -976,39 +977,39 @@ extern char *setup_job_cluster_cond_limits(mysql_conn_t *mysql_conn,
 		MYSQL_ROW row;
 
 		itr = list_iterator_create(job_cond->resv_list);
-		while((object = list_next(itr))) {
-			if(my_set)
+		while ((object = list_next(itr))) {
+			if (my_set)
 				xstrcat(query, " || ");
 			xstrfmtcat(query, "resv_name='%s'", object);
 			my_set = 1;
 		}
 		list_iterator_destroy(itr);
 		xstrcat(query, ")");
-		if(!(result = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
 			error("couldn't query the database");
 			goto no_resv;
 		}
 		xfree(query);
-		if(!job_cond->resvid_list)
+		if (!job_cond->resvid_list)
 			job_cond->resvid_list = list_create(slurm_destroy_char);
-		while((row = mysql_fetch_row(result))) {
+		while ((row = mysql_fetch_row(result))) {
 			list_append(job_cond->resvid_list, xstrdup(row[0]));
 		}
 		mysql_free_result(result);
 	}
 no_resv:
 
-	if(job_cond->resvid_list && list_count(job_cond->resvid_list)) {
+	if (job_cond->resvid_list && list_count(job_cond->resvid_list)) {
 		set = 0;
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 		itr = list_iterator_create(job_cond->resvid_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "t1.id_resv='%s'", object);
 			set = 1;
@@ -1029,18 +1030,18 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 	char *object = NULL;
 	slurmdb_selected_step_t *selected_step = NULL;
 
-	if(!job_cond)
+	if (!job_cond)
 		return 0;
 
-	if(job_cond->acct_list && list_count(job_cond->acct_list)) {
+	if (job_cond->acct_list && list_count(job_cond->acct_list)) {
 		set = 0;
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 		itr = list_iterator_create(job_cond->acct_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "t1.account='%s'", object);
 			set = 1;
@@ -1049,15 +1050,15 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 		xstrcat(*extra, ")");
 	}
 
-	if(job_cond->associd_list && list_count(job_cond->associd_list)) {
+	if (job_cond->associd_list && list_count(job_cond->associd_list)) {
 		set = 0;
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 		itr = list_iterator_create(job_cond->associd_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "t1.id_assoc='%s'", object);
 			set = 1;
@@ -1066,16 +1067,16 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 		xstrcat(*extra, ")");
 	}
 
-	if(job_cond->userid_list && list_count(job_cond->userid_list)) {
+	if (job_cond->userid_list && list_count(job_cond->userid_list)) {
 		set = 0;
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 
 		itr = list_iterator_create(job_cond->userid_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "t1.id_user='%s'", object);
 			set = 1;
@@ -1084,15 +1085,15 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 		xstrcat(*extra, ")");
 	}
 
-	if(job_cond->groupid_list && list_count(job_cond->groupid_list)) {
+	if (job_cond->groupid_list && list_count(job_cond->groupid_list)) {
 		set = 0;
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 		itr = list_iterator_create(job_cond->groupid_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "t1.id_group='%s'", object);
 			set = 1;
@@ -1101,15 +1102,15 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 		xstrcat(*extra, ")");
 	}
 
-	if(job_cond->partition_list && list_count(job_cond->partition_list)) {
+	if (job_cond->partition_list && list_count(job_cond->partition_list)) {
 		set = 0;
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 		itr = list_iterator_create(job_cond->partition_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "t1.partition='%s'", object);
 			set = 1;
@@ -1118,15 +1119,15 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 		xstrcat(*extra, ")");
 	}
 
-	if(job_cond->qos_list && list_count(job_cond->qos_list)) {
+	if (job_cond->qos_list && list_count(job_cond->qos_list)) {
 		set = 0;
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 		itr = list_iterator_create(job_cond->qos_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "t1.id_qos='%s'", object);
 			set = 1;
@@ -1135,15 +1136,15 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 		xstrcat(*extra, ")");
 	}
 
-	if(job_cond->step_list && list_count(job_cond->step_list)) {
+	if (job_cond->step_list && list_count(job_cond->step_list)) {
 		set = 0;
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 		itr = list_iterator_create(job_cond->step_list);
-		while((selected_step = list_next(itr))) {
-			if(set)
+		while ((selected_step = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "t1.id_job=%u",
 				   selected_step->jobid);
@@ -1153,13 +1154,13 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 		xstrcat(*extra, ")");
 	}
 
-	if(job_cond->cpus_min) {
-		if(*extra)
+	if (job_cond->cpus_min) {
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 
-		if(job_cond->cpus_max) {
+		if (job_cond->cpus_max) {
 			xstrfmtcat(*extra, "(t1.alloc_cpus between %u and %u))",
 				   job_cond->cpus_min, job_cond->cpus_max);
 
@@ -1170,13 +1171,13 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 		}
 	}
 
-	if(job_cond->nodes_min) {
-		if(*extra)
+	if (job_cond->nodes_min) {
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 
-		if(job_cond->nodes_max) {
+		if (job_cond->nodes_max) {
 			xstrfmtcat(*extra,
 				   "(t1.alloc_nodes between %u and %u))",
 				   job_cond->nodes_min, job_cond->nodes_max);
@@ -1188,13 +1189,13 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 		}
 	}
 
-	if(job_cond->timelimit_min) {
-		if(*extra)
+	if (job_cond->timelimit_min) {
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 
-		if(job_cond->timelimit_max) {
+		if (job_cond->timelimit_max) {
 			xstrfmtcat(*extra, "(t1.timelimit between %u and %u))",
 				   job_cond->timelimit_min,
 				   job_cond->timelimit_max);
@@ -1206,16 +1207,16 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 		}
 	}
 
-	if(job_cond->state_list && list_count(job_cond->state_list)) {
+	if (job_cond->state_list && list_count(job_cond->state_list)) {
 		set = 0;
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 
 		itr = list_iterator_create(job_cond->state_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			_state_time_string(extra, (uint32_t)slurm_atoul(object),
 					   job_cond->usage_start,
@@ -1227,13 +1228,13 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 	} else {
 		/* Only do this (default of all eligible jobs) if no
 		   state is given */
-		if(job_cond->usage_start) {
-			if(*extra)
+		if (job_cond->usage_start) {
+			if (*extra)
 				xstrcat(*extra, " && (");
 			else
 				xstrcat(*extra, " where (");
 
-			if(!job_cond->usage_end)
+			if (!job_cond->usage_end)
 				xstrfmtcat(*extra,
 					   "(t1.time_end >= %ld "
 					   "|| t1.time_end = 0))",
@@ -1245,8 +1246,8 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 					   "|| t1.time_end = 0)))",
 					   job_cond->usage_end,
 					   job_cond->usage_start);
-		} else if(job_cond->usage_end) {
-			if(*extra)
+		} else if (job_cond->usage_end) {
+			if (*extra)
 				xstrcat(*extra, " && (");
 			else
 				xstrcat(*extra, " where (");
@@ -1256,16 +1257,16 @@ extern int setup_job_cond_limits(mysql_conn_t *mysql_conn,
 		}
 	}
 
-	if(job_cond->wckey_list && list_count(job_cond->wckey_list)) {
+	if (job_cond->wckey_list && list_count(job_cond->wckey_list)) {
 		set = 0;
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 
 		itr = list_iterator_create(job_cond->wckey_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "t1.wckey='%s'", object);
 			set = 1;
@@ -1297,8 +1298,8 @@ extern List as_mysql_jobacct_process_get_jobs(mysql_conn_t *mysql_conn,
 
 	private_data = slurm_get_private_data();
 	if (private_data & PRIVATE_DATA_JOBS) {
-		if(!(is_admin = is_user_min_admin_level(
-			     mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
+		if (!(is_admin = is_user_min_admin_level(
+			      mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
 			if (!is_user_any_coord(mysql_conn, &user)) {
 				error("Only admins/coordinators can "
 				      "access job data");
@@ -1308,9 +1309,9 @@ extern List as_mysql_jobacct_process_get_jobs(mysql_conn_t *mysql_conn,
 		}
 	}
 
-	if(job_cond
-	   && job_cond->state_list && (list_count(job_cond->state_list) == 1)
-	   && (slurm_atoul(list_peek(job_cond->state_list)) == JOB_PENDING))
+	if (job_cond
+	    && job_cond->state_list && (list_count(job_cond->state_list) == 1)
+	    && (slurm_atoul(list_peek(job_cond->state_list)) == JOB_PENDING))
 		only_pending = 1;
 
 	setup_job_cond_limits(mysql_conn, job_cond, &extra);
@@ -1327,26 +1328,26 @@ extern List as_mysql_jobacct_process_get_jobs(mysql_conn_t *mysql_conn,
 		xstrfmtcat(tmp2, ", %s", step_req_inx[i]);
 	}
 
-	if(job_cond
-	   && job_cond->cluster_list && list_count(job_cond->cluster_list))
+	if (job_cond
+	    && job_cond->cluster_list && list_count(job_cond->cluster_list))
 		use_cluster_list = job_cond->cluster_list;
 	else
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 
 	job_list = list_create(slurmdb_destroy_job_rec);
 	itr = list_iterator_create(use_cluster_list);
-	while((cluster_name = list_next(itr))) {
+	while ((cluster_name = list_next(itr))) {
 		int rc;
-		if((rc = _cluster_get_jobs(mysql_conn, &user, job_cond,
-					   cluster_name, tmp, tmp2, extra,
-					   is_admin, only_pending, job_list))
-		   != SLURM_SUCCESS)
+		if ((rc = _cluster_get_jobs(mysql_conn, &user, job_cond,
+					    cluster_name, tmp, tmp2, extra,
+					    is_admin, only_pending, job_list))
+		    != SLURM_SUCCESS)
 			error("Problem getting jobs for cluster %s",
 			      cluster_name);
 	}
 	list_iterator_destroy(itr);
 
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
 	xfree(tmp);
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_problems.c b/src/plugins/accounting_storage/mysql/as_mysql_problems.c
index cb804958daa..787c70ba1a4 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_problems.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_problems.c
@@ -51,15 +51,15 @@ static int _setup_association_cond_limits(
 
 	xstrfmtcat(*extra, "where deleted=0");
 
-	if(!assoc_cond)
+	if (!assoc_cond)
 		return 0;
 
-	if(assoc_cond->acct_list && list_count(assoc_cond->acct_list)) {
+	if (assoc_cond->acct_list && list_count(assoc_cond->acct_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->acct_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "acct='%s'", object);
 			set = 1;
@@ -68,31 +68,31 @@ static int _setup_association_cond_limits(
 		xstrcat(*extra, ")");
 	}
 
-	if(assoc_cond->user_list && list_count(assoc_cond->user_list)) {
+	if (assoc_cond->user_list && list_count(assoc_cond->user_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->user_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "user='%s'", object);
 			set = 1;
 		}
 		list_iterator_destroy(itr);
 		xstrcat(*extra, ")");
-	} else if(user_query) {
+	} else if (user_query) {
 		/* we want all the users, but no non-user associations */
 		set = 1;
 		xstrcat(*extra, " && (user!='')");
 	}
 
-	if(assoc_cond->partition_list
-	   && list_count(assoc_cond->partition_list)) {
+	if (assoc_cond->partition_list
+	    && list_count(assoc_cond->partition_list)) {
 		set = 0;
 		xstrcat(*extra, " && (");
 		itr = list_iterator_create(assoc_cond->partition_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "partition='%s'", object);
 			set = 1;
@@ -106,8 +106,8 @@ static int _setup_association_cond_limits(
 
 
 extern int as_mysql_acct_no_assocs(mysql_conn_t *mysql_conn,
-				slurmdb_association_cond_t *assoc_cond,
-				List ret_list)
+				   slurmdb_association_cond_t *assoc_cond,
+				   List ret_list)
 {
 	int rc = SLURM_SUCCESS;
 	char *query = NULL;
@@ -121,15 +121,15 @@ extern int as_mysql_acct_no_assocs(mysql_conn_t *mysql_conn,
 
 	query = xstrdup_printf("select name from %s where deleted=0",
 			       acct_table);
-	if(assoc_cond &&
-	   assoc_cond->acct_list && list_count(assoc_cond->acct_list)) {
+	if (assoc_cond &&
+	    assoc_cond->acct_list && list_count(assoc_cond->acct_list)) {
 		int set = 0;
 		ListIterator itr = NULL;
 		char *object = NULL;
 		xstrcat(query, " && (");
 		itr = list_iterator_create(assoc_cond->acct_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(query, " || ");
 			xstrfmtcat(query, "name='%s'", object);
 			set = 1;
@@ -138,28 +138,28 @@ extern int as_mysql_acct_no_assocs(mysql_conn_t *mysql_conn,
 		xstrcat(query, ")");
 	}
 
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(assoc_cond &&
-	   assoc_cond->cluster_list && list_count(assoc_cond->cluster_list))
+	if (assoc_cond &&
+	    assoc_cond->cluster_list && list_count(assoc_cond->cluster_list))
 		use_cluster_list = assoc_cond->cluster_list;
 	else
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 
 	itr = list_iterator_create(use_cluster_list);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		MYSQL_RES *result2 = NULL;
 		int cnt = 0;
 		slurmdb_association_rec_t *assoc = NULL;
 
 		/* See if we have at least 1 association in the system */
-		while((cluster_name = list_next(itr))) {
-			if(query)
+		while ((cluster_name = list_next(itr))) {
+			if (query)
 				xstrcat(query, " union ");
 			xstrfmtcat(query,
 				   "select distinct id_assoc from \"%s_%s\" "
@@ -169,8 +169,8 @@ extern int as_mysql_acct_no_assocs(mysql_conn_t *mysql_conn,
 		}
 		list_iterator_reset(itr);
 
-		if(!(result2 = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result2 = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
 			rc = SLURM_ERROR;
 			break;
@@ -180,7 +180,7 @@ extern int as_mysql_acct_no_assocs(mysql_conn_t *mysql_conn,
 		cnt = mysql_num_rows(result2);
 		mysql_free_result(result2);
 
-		if(cnt)
+		if (cnt)
 			continue;
 
 		assoc =	xmalloc(sizeof(slurmdb_association_rec_t));
@@ -192,7 +192,7 @@ extern int as_mysql_acct_no_assocs(mysql_conn_t *mysql_conn,
 	mysql_free_result(result);
 
 	list_iterator_destroy(itr);
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
 	return rc;
@@ -239,16 +239,16 @@ extern int as_mysql_acct_no_users(mysql_conn_t *mysql_conn,
 		xstrfmtcat(tmp, ", %s", assoc_req_inx[i]);
 	}
 
-	if(assoc_cond &&
-	   assoc_cond->cluster_list && list_count(assoc_cond->cluster_list))
+	if (assoc_cond &&
+	    assoc_cond->cluster_list && list_count(assoc_cond->cluster_list))
 		use_cluster_list = assoc_cond->cluster_list;
 	else
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 
 	itr = list_iterator_create(use_cluster_list);
-	while((cluster_name = list_next(itr))) {
+	while ((cluster_name = list_next(itr))) {
 		/* only get the account associations */
-		if(query)
+		if (query)
 			xstrcat(query, " union ");
 		xstrfmtcat(query, "select distinct %s, '%s' as cluster "
 			   "from \"%s_%s\" %s && user='' && lft=(rgt-1) ",
@@ -256,24 +256,24 @@ extern int as_mysql_acct_no_users(mysql_conn_t *mysql_conn,
 			   assoc_table, extra);
 	}
 	list_iterator_destroy(itr);
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
-	if(query)
+	if (query)
 		xstrcat(query, " order by cluster, acct;");
 
 	xfree(tmp);
 	xfree(extra);
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_association_rec_t *assoc =
 			xmalloc(sizeof(slurmdb_association_rec_t));
 
@@ -281,15 +281,15 @@ extern int as_mysql_acct_no_users(mysql_conn_t *mysql_conn,
 
 		assoc->id = SLURMDB_PROBLEM_ACCT_NO_USERS;
 
-		if(row[ASSOC_REQ_USER][0])
+		if (row[ASSOC_REQ_USER][0])
 			assoc->user = xstrdup(row[ASSOC_REQ_USER]);
 		assoc->acct = xstrdup(row[ASSOC_REQ_ACCT]);
 		assoc->cluster = xstrdup(row[ASSOC_REQ_COUNT]);
 
-		if(row[ASSOC_REQ_PARENT][0])
+		if (row[ASSOC_REQ_PARENT][0])
 			assoc->parent_acct = xstrdup(row[ASSOC_REQ_PARENT]);
 
-		if(row[ASSOC_REQ_PART][0])
+		if (row[ASSOC_REQ_PART][0])
 			assoc->partition = xstrdup(row[ASSOC_REQ_PART]);
 	}
 	mysql_free_result(result);
@@ -297,9 +297,10 @@ extern int as_mysql_acct_no_users(mysql_conn_t *mysql_conn,
 	return rc;
 }
 
-extern int as_mysql_user_no_assocs_or_no_uid(mysql_conn_t *mysql_conn,
-					  slurmdb_association_cond_t *assoc_cond,
-					  List ret_list)
+extern int as_mysql_user_no_assocs_or_no_uid(
+	mysql_conn_t *mysql_conn,
+	slurmdb_association_cond_t *assoc_cond,
+	List ret_list)
 {
 	int rc = SLURM_SUCCESS;
 	char *query = NULL;
@@ -313,14 +314,14 @@ extern int as_mysql_user_no_assocs_or_no_uid(mysql_conn_t *mysql_conn,
 
 	query = xstrdup_printf("select name from %s where deleted=0",
 			       user_table);
-	if(assoc_cond &&
-	   assoc_cond->user_list && list_count(assoc_cond->user_list)) {
+	if (assoc_cond &&
+	    assoc_cond->user_list && list_count(assoc_cond->user_list)) {
 		int set = 0;
 		char *object = NULL;
 		xstrcat(query, " && (");
 		itr = list_iterator_create(assoc_cond->user_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(query, " || ");
 			xstrfmtcat(query, "name='%s'", object);
 			set = 1;
@@ -329,21 +330,21 @@ extern int as_mysql_user_no_assocs_or_no_uid(mysql_conn_t *mysql_conn,
 		xstrcat(query, ")");
 	}
 
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(assoc_cond &&
-	   assoc_cond->cluster_list && list_count(assoc_cond->cluster_list))
+	if (assoc_cond &&
+	    assoc_cond->cluster_list && list_count(assoc_cond->cluster_list))
 		use_cluster_list = assoc_cond->cluster_list;
 	else
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 
 	itr = list_iterator_create(use_cluster_list);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		MYSQL_RES *result2 = NULL;
 		int cnt = 0;
 		slurmdb_association_rec_t *assoc = NULL;
@@ -360,8 +361,8 @@ extern int as_mysql_user_no_assocs_or_no_uid(mysql_conn_t *mysql_conn,
 		}
 
 		/* See if we have at least 1 association in the system */
-		while((cluster_name = list_next(itr))) {
-			if(query)
+		while ((cluster_name = list_next(itr))) {
+			if (query)
 				xstrcat(query, " union ");
 			xstrfmtcat(query,
 				   "select distinct id_assoc from \"%s_%s\" "
@@ -371,8 +372,8 @@ extern int as_mysql_user_no_assocs_or_no_uid(mysql_conn_t *mysql_conn,
 		}
 		list_iterator_reset(itr);
 
-		if(!(result2 = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result2 = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
 			rc = SLURM_ERROR;
 			break;
@@ -382,7 +383,7 @@ extern int as_mysql_user_no_assocs_or_no_uid(mysql_conn_t *mysql_conn,
 		cnt = mysql_num_rows(result2);
 		mysql_free_result(result2);
 
-		if(cnt)
+		if (cnt)
 			continue;
 
 		assoc =	xmalloc(sizeof(slurmdb_association_rec_t));
@@ -394,7 +395,7 @@ extern int as_mysql_user_no_assocs_or_no_uid(mysql_conn_t *mysql_conn,
 	mysql_free_result(result);
 
 	list_iterator_destroy(itr);
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
 	return rc;
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_qos.c b/src/plugins/accounting_storage/mysql/as_mysql_qos.c
index 8b34a89aac4..5db0f655225 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_qos.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_qos.c
@@ -49,7 +49,7 @@ static int _preemption_loop(mysql_conn_t *mysql_conn, int begin_qosid,
 
 	/* check in the preempt list for all qos's preempted */
 	for(i=0; i<bit_size(preempt_bitstr); i++) {
-		if(!bit_test(preempt_bitstr, i))
+		if (!bit_test(preempt_bitstr, i))
 			continue;
 
 		memset(&qos_rec, 0, sizeof(qos_rec));
@@ -59,17 +59,17 @@ static int _preemption_loop(mysql_conn_t *mysql_conn, int begin_qosid,
 				      NULL);
 		/* check if the begin_qosid is preempted by this qos
 		 * if so we have a loop */
-		if(qos_rec.preempt_bitstr
-		   && bit_test(qos_rec.preempt_bitstr, begin_qosid)) {
+		if (qos_rec.preempt_bitstr
+		    && bit_test(qos_rec.preempt_bitstr, begin_qosid)) {
 			error("QOS id %d has a loop at QOS %s",
 			      begin_qosid, qos_rec.name);
 			rc = 1;
 			break;
-		} else if(qos_rec.preempt_bitstr) {
+		} else if (qos_rec.preempt_bitstr) {
 			/* check this qos' preempt list and make sure
 			   no loops exist there either */
-			if((rc = _preemption_loop(mysql_conn, begin_qosid,
-						  qos_rec.preempt_bitstr)))
+			if ((rc = _preemption_loop(mysql_conn, begin_qosid,
+						   qos_rec.preempt_bitstr)))
 				break;
 		}
 	}
@@ -80,10 +80,10 @@ static int _setup_qos_limits(slurmdb_qos_rec_t *qos,
 			     char **cols, char **vals,
 			     char **extra, char **added_preempt)
 {
-	if(!qos)
+	if (!qos)
 		return SLURM_ERROR;
 
-	if(qos->description) {
+	if (qos->description) {
 		xstrcat(*cols, ", description");
 		xstrfmtcat(*vals, ", '%s'", qos->description);
 		xstrfmtcat(*extra, ", description='%s'",
@@ -111,12 +111,12 @@ static int _setup_qos_limits(slurmdb_qos_rec_t *qos,
 		}
 	}
 
-	if(qos->grp_cpu_mins == (uint64_t)INFINITE) {
+	if (qos->grp_cpu_mins == (uint64_t)INFINITE) {
 		xstrcat(*cols, ", grp_cpu_mins");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_cpu_mins=NULL");
-	} else if((qos->grp_cpu_mins != (uint64_t)NO_VAL)
-		  && ((int64_t)qos->grp_cpu_mins >= 0)) {
+	} else if ((qos->grp_cpu_mins != (uint64_t)NO_VAL)
+		   && ((int64_t)qos->grp_cpu_mins >= 0)) {
 		xstrcat(*cols, ", grp_cpu_mins");
 		xstrfmtcat(*vals, ", %"PRIu64"",
 			   qos->grp_cpu_mins);
@@ -124,12 +124,12 @@ static int _setup_qos_limits(slurmdb_qos_rec_t *qos,
 			   qos->grp_cpu_mins);
 	}
 
-	if(qos->grp_cpu_run_mins == (uint64_t)INFINITE) {
+	if (qos->grp_cpu_run_mins == (uint64_t)INFINITE) {
 		xstrcat(*cols, ", grp_cpu_run_mins");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_cpu_run_mins=NULL");
-	} else if((qos->grp_cpu_run_mins != (uint64_t)NO_VAL)
-		  && (int64_t)qos->grp_cpu_run_mins >= 0) {
+	} else if ((qos->grp_cpu_run_mins != (uint64_t)NO_VAL)
+		   && (int64_t)qos->grp_cpu_run_mins >= 0) {
 		xstrcat(*cols, ", grp_cpu_run_mins");
 		xstrfmtcat(*vals, ", %"PRIu64"",
 			   qos->grp_cpu_run_mins);
@@ -137,68 +137,68 @@ static int _setup_qos_limits(slurmdb_qos_rec_t *qos,
 			   qos->grp_cpu_run_mins);
 	}
 
-	if(qos->grp_cpus == INFINITE) {
+	if (qos->grp_cpus == INFINITE) {
 		xstrcat(*cols, ", grp_cpus");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_cpus=NULL");
-	} else if((qos->grp_cpus != NO_VAL)
-		  && ((int32_t)qos->grp_cpus >= 0)) {
+	} else if ((qos->grp_cpus != NO_VAL)
+		   && ((int32_t)qos->grp_cpus >= 0)) {
 		xstrcat(*cols, ", grp_cpus");
 		xstrfmtcat(*vals, ", %u", qos->grp_cpus);
 		xstrfmtcat(*extra, ", grp_cpus=%u", qos->grp_cpus);
 	}
 
-	if(qos->grp_jobs == INFINITE) {
+	if (qos->grp_jobs == INFINITE) {
 		xstrcat(*cols, ", grp_jobs");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_jobs=NULL");
-	} else if((qos->grp_jobs != NO_VAL)
-		  && ((int32_t)qos->grp_jobs >= 0)) {
+	} else if ((qos->grp_jobs != NO_VAL)
+		   && ((int32_t)qos->grp_jobs >= 0)) {
 		xstrcat(*cols, ", grp_jobs");
 		xstrfmtcat(*vals, ", %u", qos->grp_jobs);
 		xstrfmtcat(*extra, ", grp_jobs=%u", qos->grp_jobs);
 	}
 
-	if(qos->grp_nodes == INFINITE) {
+	if (qos->grp_nodes == INFINITE) {
 		xstrcat(*cols, ", grp_nodes");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_nodes=NULL");
-	} else if((qos->grp_nodes != NO_VAL)
-		  && ((int32_t)qos->grp_nodes >= 0)) {
+	} else if ((qos->grp_nodes != NO_VAL)
+		   && ((int32_t)qos->grp_nodes >= 0)) {
 		xstrcat(*cols, ", grp_nodes");
 		xstrfmtcat(*vals, ", %u", qos->grp_nodes);
 		xstrfmtcat(*extra, ", grp_nodes=%u", qos->grp_nodes);
 	}
 
-	if(qos->grp_submit_jobs == INFINITE) {
+	if (qos->grp_submit_jobs == INFINITE) {
 		xstrcat(*cols, ", grp_submit_jobs");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_submit_jobs=NULL");
-	} else if((qos->grp_submit_jobs != NO_VAL)
-		  && ((int32_t)qos->grp_submit_jobs >= 0)) {
+	} else if ((qos->grp_submit_jobs != NO_VAL)
+		   && ((int32_t)qos->grp_submit_jobs >= 0)) {
 		xstrcat(*cols, ", grp_submit_jobs");
 		xstrfmtcat(*vals, ", %u", qos->grp_submit_jobs);
 		xstrfmtcat(*extra, ", grp_submit_jobs=%u",
 			   qos->grp_submit_jobs);
 	}
 
-	if(qos->grp_wall == INFINITE) {
+	if (qos->grp_wall == INFINITE) {
 		xstrcat(*cols, ", grp_wall");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", grp_wall=NULL");
-	} else if((qos->grp_wall != NO_VAL)
-		  && ((int32_t)qos->grp_wall >= 0)) {
+	} else if ((qos->grp_wall != NO_VAL)
+		   && ((int32_t)qos->grp_wall >= 0)) {
 		xstrcat(*cols, ", grp_wall");
 		xstrfmtcat(*vals, ", %u", qos->grp_wall);
 		xstrfmtcat(*extra, ", grp_wall=%u", qos->grp_wall);
 	}
 
-	if(qos->max_cpu_mins_pj == (uint64_t)INFINITE) {
+	if (qos->max_cpu_mins_pj == (uint64_t)INFINITE) {
 		xstrcat(*cols, ", max_cpu_mins_per_job");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_cpu_mins_per_job=NULL");
-	} else if((qos->max_cpu_mins_pj != (uint64_t)NO_VAL)
-		  && ((int64_t)qos->max_cpu_mins_pj >= 0)) {
+	} else if ((qos->max_cpu_mins_pj != (uint64_t)NO_VAL)
+		   && ((int64_t)qos->max_cpu_mins_pj >= 0)) {
 		xstrcat(*cols, ", max_cpu_mins_per_job");
 		xstrfmtcat(*vals, ", %"PRIu64"",
 			   qos->max_cpu_mins_pj);
@@ -206,12 +206,12 @@ static int _setup_qos_limits(slurmdb_qos_rec_t *qos,
 			   qos->max_cpu_mins_pj);
 	}
 
-	if(qos->max_cpu_run_mins_pu == (uint64_t)INFINITE) {
+	if (qos->max_cpu_run_mins_pu == (uint64_t)INFINITE) {
 		xstrcat(*cols, ", max_cpu_run_mins_per_user");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_cpu_run_mins_per_user=NULL");
-	} else if((qos->max_cpu_run_mins_pu != (uint64_t)NO_VAL)
-		  && ((int64_t)qos->max_cpu_run_mins_pu >= 0)) {
+	} else if ((qos->max_cpu_run_mins_pu != (uint64_t)NO_VAL)
+		   && ((int64_t)qos->max_cpu_run_mins_pu >= 0)) {
 		xstrcat(*cols, ", max_cpu_run_mins_per_user");
 		xstrfmtcat(*vals, ", %"PRIu64"",
 			   qos->max_cpu_run_mins_pu);
@@ -219,65 +219,65 @@ static int _setup_qos_limits(slurmdb_qos_rec_t *qos,
 			   qos->max_cpu_run_mins_pu);
 	}
 
-	if(qos->max_cpus_pj == INFINITE) {
+	if (qos->max_cpus_pj == INFINITE) {
 		xstrcat(*cols, ", max_cpus_per_job");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_cpus_per_job=NULL");
-	} else if((qos->max_cpus_pj != NO_VAL)
-		  && ((int32_t)qos->max_cpus_pj >= 0)) {
+	} else if ((qos->max_cpus_pj != NO_VAL)
+		   && ((int32_t)qos->max_cpus_pj >= 0)) {
 		xstrcat(*cols, ", max_cpus_per_job");
 		xstrfmtcat(*vals, ", %u", qos->max_cpus_pj);
 		xstrfmtcat(*extra, ", max_cpus_per_job=%u", qos->max_cpus_pj);
 	}
 
-	if(qos->max_jobs_pu == INFINITE) {
+	if (qos->max_jobs_pu == INFINITE) {
 		xstrcat(*cols, ", max_jobs_per_user");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_jobs_per_user=NULL");
-	} else if((qos->max_jobs_pu != NO_VAL)
-		  && ((int32_t)qos->max_jobs_pu >= 0)) {
+	} else if ((qos->max_jobs_pu != NO_VAL)
+		   && ((int32_t)qos->max_jobs_pu >= 0)) {
 		xstrcat(*cols, ", max_jobs_per_user");
 		xstrfmtcat(*vals, ", %u", qos->max_jobs_pu);
 		xstrfmtcat(*extra, ", max_jobs_per_user=%u", qos->max_jobs_pu);
 	}
 
-	if(qos->max_nodes_pj == INFINITE) {
+	if (qos->max_nodes_pj == INFINITE) {
 		xstrcat(*cols, ", max_nodes_per_job");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_nodes_per_job=NULL");
-	} else if((qos->max_nodes_pj != NO_VAL)
-		  && ((int32_t)qos->max_nodes_pj >= 0)) {
+	} else if ((qos->max_nodes_pj != NO_VAL)
+		   && ((int32_t)qos->max_nodes_pj >= 0)) {
 		xstrcat(*cols, ", max_nodes_per_job");
 		xstrfmtcat(*vals, ", %u", qos->max_nodes_pj);
 		xstrfmtcat(*extra, ", max_nodes_per_job=%u",
 			   qos->max_nodes_pj);
 	}
 
-	if(qos->max_submit_jobs_pu == INFINITE) {
+	if (qos->max_submit_jobs_pu == INFINITE) {
 		xstrcat(*cols, ", max_submit_jobs_per_user");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_submit_jobs_per_user=NULL");
-	} else if((qos->max_submit_jobs_pu != NO_VAL)
-		  && ((int32_t)qos->max_submit_jobs_pu >= 0)) {
+	} else if ((qos->max_submit_jobs_pu != NO_VAL)
+		   && ((int32_t)qos->max_submit_jobs_pu >= 0)) {
 		xstrcat(*cols, ", max_submit_jobs_per_user");
 		xstrfmtcat(*vals, ", %u", qos->max_submit_jobs_pu);
 		xstrfmtcat(*extra, ", max_submit_jobs_per_user=%u",
 			   qos->max_submit_jobs_pu);
 	}
 
-	if((qos->max_wall_pj != NO_VAL)
-	   && ((int32_t)qos->max_wall_pj >= 0)) {
+	if ((qos->max_wall_pj != NO_VAL)
+	    && ((int32_t)qos->max_wall_pj >= 0)) {
 		xstrcat(*cols, ", max_wall_duration_per_job");
 		xstrfmtcat(*vals, ", %u", qos->max_wall_pj);
 		xstrfmtcat(*extra, ", max_wall_duration_per_job=%u",
 			   qos->max_wall_pj);
-	} else if(qos->max_wall_pj == INFINITE) {
+	} else if (qos->max_wall_pj == INFINITE) {
 		xstrcat(*cols, ", max_wall_duration_per_job");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", max_wall_duration_per_job=NULL");
 	}
 
-	if(qos->preempt_list && list_count(qos->preempt_list)) {
+	if (qos->preempt_list && list_count(qos->preempt_list)) {
 		char *preempt_val = NULL;
 		char *tmp_char = NULL, *begin_preempt = NULL;
 		ListIterator preempt_itr =
@@ -287,27 +287,27 @@ static int _setup_qos_limits(slurmdb_qos_rec_t *qos,
 
 		begin_preempt = xstrdup("preempt");
 
-		while((tmp_char = list_next(preempt_itr))) {
-			if(tmp_char[0] == '-') {
+		while ((tmp_char = list_next(preempt_itr))) {
+			if (tmp_char[0] == '-') {
 				xstrfmtcat(preempt_val,
 					   "replace(%s, ',%s', '')",
 					   begin_preempt, tmp_char+1);
 				xfree(begin_preempt);
 				begin_preempt = preempt_val;
-			} else if(tmp_char[0] == '+') {
+			} else if (tmp_char[0] == '+') {
 				xstrfmtcat(preempt_val,
 					   "concat("
 					   "replace(%s, ',%s', ''), ',%s')",
 					   begin_preempt,
 					   tmp_char+1, tmp_char+1);
-				if(added_preempt)
+				if (added_preempt)
 					xstrfmtcat(*added_preempt, ",%s",
 						   tmp_char+1);
 				xfree(begin_preempt);
 				begin_preempt = preempt_val;
-			} else if(tmp_char[0]) {
+			} else if (tmp_char[0]) {
 				xstrfmtcat(preempt_val, ",%s", tmp_char);
-				if(added_preempt)
+				if (added_preempt)
 					xstrfmtcat(*added_preempt, ",%s",
 						   tmp_char);
 			} else
@@ -321,8 +321,8 @@ static int _setup_qos_limits(slurmdb_qos_rec_t *qos,
 		xfree(preempt_val);
 	}
 
-	if((qos->usage_factor != (int16_t)NO_VAL)
-	   && ((int16_t)qos->preempt_mode >= 0)) {
+	if ((qos->usage_factor != (int16_t)NO_VAL)
+	    && ((int16_t)qos->preempt_mode >= 0)) {
 		qos->preempt_mode &= (~PREEMPT_MODE_GANG);
 		xstrcat(*cols, ", preempt_mode");
 		xstrfmtcat(*vals, ", %u", qos->preempt_mode);
@@ -333,30 +333,30 @@ static int _setup_qos_limits(slurmdb_qos_rec_t *qos,
 		xstrcat(*cols, ", priority");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", priority=NULL");
-	} else if((qos->priority != NO_VAL)
-		  && ((int32_t)qos->priority >= 0)) {
+	} else if ((qos->priority != NO_VAL)
+		   && ((int32_t)qos->priority >= 0)) {
 		xstrcat(*cols, ", priority");
 		xstrfmtcat(*vals, ", %u", qos->priority);
 		xstrfmtcat(*extra, ", priority=%u", qos->priority);
 	}
 
-	if(qos->usage_factor == (double)INFINITE) {
+	if (qos->usage_factor == (double)INFINITE) {
 		xstrcat(*cols, ", usage_factor");
 		xstrcat(*vals, ", 1");
 		xstrcat(*extra, ", usage_factor=1");
-	} else if((qos->usage_factor != (double)NO_VAL)
-		  && (qos->usage_factor >= 0)) {
+	} else if ((qos->usage_factor != (double)NO_VAL)
+		   && (qos->usage_factor >= 0)) {
 		xstrcat(*cols, ", usage_factor");
 		xstrfmtcat(*vals, ", %f", qos->usage_factor);
 		xstrfmtcat(*extra, ", usage_factor=%f", qos->usage_factor);
 	}
 
-	if(qos->usage_thres == (double)INFINITE) {
+	if (qos->usage_thres == (double)INFINITE) {
 		xstrcat(*cols, ", usage_thres");
 		xstrcat(*vals, ", NULL");
 		xstrcat(*extra, ", usage_thres=NULL");
-	} else if((qos->usage_thres != (double)NO_VAL)
-		  && (qos->usage_thres >= 0)) {
+	} else if ((qos->usage_thres != (double)NO_VAL)
+		   && (qos->usage_thres >= 0)) {
 		xstrcat(*cols, ", usage_thres");
 		xstrfmtcat(*vals, ", %f", qos->usage_thres);
 		xstrfmtcat(*extra, ", usage_thres=%f", qos->usage_thres);
@@ -380,13 +380,13 @@ extern int as_mysql_add_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 	int added = 0;
 	char *added_preempt = NULL;
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	user_name = uid_to_string((uid_t) uid);
 	itr = list_iterator_create(qos_list);
-	while((object = list_next(itr))) {
-		if(!object->name || !object->name[0]) {
+	while ((object = list_next(itr))) {
+		if (!object->name || !object->name[0]) {
 			error("We need a qos name to add.");
 			rc = SLURM_ERROR;
 			continue;
@@ -397,7 +397,7 @@ extern int as_mysql_add_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrfmtcat(extra, ", mod_time=%ld", now);
 
 		_setup_qos_limits(object, &cols, &vals, &extra, &added_preempt);
-		if(added_preempt) {
+		if (added_preempt) {
 			object->preempt_bitstr = bit_alloc(g_qos_count);
 			bit_unfmt(object->preempt_bitstr, added_preempt+1);
 			xfree(added_preempt);
@@ -414,7 +414,7 @@ extern int as_mysql_add_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 		object->id = mysql_db_insert_ret_id(mysql_conn, query);
 		xfree(query);
-		if(!object->id) {
+		if (!object->id) {
 			error("Couldn't add qos %s", object->name);
 			added=0;
 			xfree(cols);
@@ -425,7 +425,7 @@ extern int as_mysql_add_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 
 		affect_rows = last_affected_rows(mysql_conn);
 
-		if(!affect_rows) {
+		if (!affect_rows) {
 			debug2("nothing changed %d", affect_rows);
 			xfree(cols);
 			xfree(extra);
@@ -451,12 +451,12 @@ extern int as_mysql_add_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 		debug4("query\n%s",query);
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't add txn");
 		} else {
-			if(addto_update_list(mysql_conn->update_list,
-					     SLURMDB_ADD_QOS,
-					     object) == SLURM_SUCCESS)
+			if (addto_update_list(mysql_conn->update_list,
+					      SLURMDB_ADD_QOS,
+					      object) == SLURM_SUCCESS)
 				list_remove(itr);
 			added++;
 		}
@@ -465,7 +465,7 @@ extern int as_mysql_add_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 	list_iterator_destroy(itr);
 	xfree(user_name);
 
-	if(!added) {
+	if (!added) {
 		reset_mysql_conn(mysql_conn);
 	}
 
@@ -490,23 +490,23 @@ extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 	bitstr_t *preempt_bitstr = NULL;
 	char *added_preempt = NULL;
 
-	if(!qos_cond || !qos) {
+	if (!qos_cond || !qos) {
 		error("we need something to change");
 		return NULL;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	xstrcat(extra, "where deleted=0");
 
-	if(qos_cond->description_list
-	   && list_count(qos_cond->description_list)) {
+	if (qos_cond->description_list
+	    && list_count(qos_cond->description_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(qos_cond->description_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "description='%s'", object);
 			set = 1;
@@ -515,13 +515,13 @@ extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(qos_cond->id_list
-	   && list_count(qos_cond->id_list)) {
+	if (qos_cond->id_list
+	    && list_count(qos_cond->id_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(qos_cond->id_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "id='%s'", object);
 			set = 1;
@@ -530,13 +530,13 @@ extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(qos_cond->name_list
-	   && list_count(qos_cond->name_list)) {
+	if (qos_cond->name_list
+	    && list_count(qos_cond->name_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(qos_cond->name_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "name='%s'", object);
 			set = 1;
@@ -546,7 +546,7 @@ extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 	}
 
 	_setup_qos_limits(qos, &tmp_char1, &tmp_char2, &vals, &added_preempt);
-	if(added_preempt) {
+	if (added_preempt) {
 		preempt_bitstr = bit_alloc(g_qos_count);
 		bit_unfmt(preempt_bitstr, added_preempt+1);
 		xfree(added_preempt);
@@ -554,7 +554,7 @@ extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 	xfree(tmp_char1);
 	xfree(tmp_char2);
 
-	if(!extra || !vals) {
+	if (!extra || !vals) {
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		FREE_NULL_BITMAP(preempt_bitstr);
 		error("Nothing to change");
@@ -563,7 +563,7 @@ extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 	query = xstrdup_printf("select name, preempt, id from %s %s;",
 			       qos_table, extra);
 	xfree(extra);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		FREE_NULL_BITMAP(preempt_bitstr);
 		return NULL;
@@ -571,16 +571,16 @@ extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	rc = 0;
 	ret_list = list_create(slurm_destroy_char);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_qos_rec_t *qos_rec = NULL;
 		uint32_t id = slurm_atoul(row[2]);
-		if(preempt_bitstr) {
-			if(_preemption_loop(mysql_conn, id, preempt_bitstr))
+		if (preempt_bitstr) {
+			if (_preemption_loop(mysql_conn, id, preempt_bitstr))
 				break;
 		}
 		object = xstrdup(row[0]);
 		list_append(ret_list, object);
-		if(!rc) {
+		if (!rc) {
 			xstrfmtcat(name_char, "(name='%s'", object);
 			rc = 1;
 		} else  {
@@ -611,25 +611,25 @@ extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 		qos_rec->preempt_mode = qos->preempt_mode;
 		qos_rec->priority = qos->priority;
 
-		if(qos->preempt_list) {
+		if (qos->preempt_list) {
 			ListIterator new_preempt_itr =
 				list_iterator_create(qos->preempt_list);
 			char *new_preempt = NULL;
 
 			qos_rec->preempt_bitstr = bit_alloc(g_qos_count);
-			if(row[1] && row[1][0])
+			if (row[1] && row[1][0])
 				bit_unfmt(qos_rec->preempt_bitstr, row[1]+1);
 
-			while((new_preempt = list_next(new_preempt_itr))) {
+			while ((new_preempt = list_next(new_preempt_itr))) {
 				bool cleared = 0;
-				if(new_preempt[0] == '-') {
+				if (new_preempt[0] == '-') {
 					bit_clear(qos_rec->preempt_bitstr,
 						  atol(new_preempt+1));
-				} else if(new_preempt[0] == '+') {
+				} else if (new_preempt[0] == '+') {
 					bit_set(qos_rec->preempt_bitstr,
 						atol(new_preempt+1));
 				} else {
-					if(!cleared) {
+					if (!cleared) {
 						cleared = 1;
 						bit_nclear(
 							qos_rec->preempt_bitstr,
@@ -656,7 +656,7 @@ extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	FREE_NULL_BITMAP(preempt_bitstr);
 
-	if(row) {
+	if (row) {
 		xfree(vals);
 		xfree(name_char);
 		xfree(query);
@@ -666,7 +666,7 @@ extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 		return ret_list;
 	}
 
-	if(!list_count(ret_list)) {
+	if (!list_count(ret_list)) {
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		debug3("didn't effect anything\n%s", query);
 		xfree(vals);
@@ -706,22 +706,22 @@ extern List as_mysql_remove_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 	MYSQL_RES *result = NULL;
 	MYSQL_ROW row;
 
-	if(!qos_cond) {
+	if (!qos_cond) {
 		error("we need something to change");
 		return NULL;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	xstrcat(extra, "where deleted=0");
-	if(qos_cond->description_list
-	   && list_count(qos_cond->description_list)) {
+	if (qos_cond->description_list
+	    && list_count(qos_cond->description_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(qos_cond->description_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "description='%s'", object);
 			set = 1;
@@ -730,15 +730,15 @@ extern List as_mysql_remove_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(qos_cond->id_list
-	   && list_count(qos_cond->id_list)) {
+	if (qos_cond->id_list
+	    && list_count(qos_cond->id_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(qos_cond->id_list);
-		while((object = list_next(itr))) {
-			if(!object[0])
+		while ((object = list_next(itr))) {
+			if (!object[0])
 				continue;
-			if(set)
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "id='%s'", object);
 			set = 1;
@@ -747,15 +747,15 @@ extern List as_mysql_remove_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(qos_cond->name_list
-	   && list_count(qos_cond->name_list)) {
+	if (qos_cond->name_list
+	    && list_count(qos_cond->name_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(qos_cond->name_list);
-		while((object = list_next(itr))) {
-			if(!object[0])
+		while ((object = list_next(itr))) {
+			if (!object[0])
 				continue;
-			if(set)
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "name='%s'", object);
 			set = 1;
@@ -764,30 +764,30 @@ extern List as_mysql_remove_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(!extra) {
+	if (!extra) {
 		error("Nothing to remove");
 		return NULL;
 	}
 
 	query = xstrdup_printf("select id, name from %s %s;", qos_table, extra);
 	xfree(extra);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return NULL;
 	}
 
 	name_char = NULL;
 	ret_list = list_create(slurm_destroy_char);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_qos_rec_t *qos_rec = NULL;
 
 		list_append(ret_list, xstrdup(row[1]));
-		if(!name_char)
+		if (!name_char)
 			xstrfmtcat(name_char, "id='%s'", row[0]);
 		else
 			xstrfmtcat(name_char, " || id='%s'", row[0]);
-		if(!assoc_char)
+		if (!assoc_char)
 			xstrfmtcat(assoc_char, "id_qos='%s'", row[0]);
 		else
 			xstrfmtcat(assoc_char, " || id_qos='%s'", row[0]);
@@ -807,7 +807,7 @@ extern List as_mysql_remove_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 	}
 	mysql_free_result(result);
 
-	if(!list_count(ret_list)) {
+	if (!list_count(ret_list)) {
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		debug3("didn't effect anything\n%s", query);
 		xfree(query);
@@ -823,7 +823,7 @@ extern List as_mysql_remove_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
 	rc = mysql_db_query(mysql_conn, query);
 	xfree(query);
-	if(rc != SLURM_SUCCESS) {
+	if (rc != SLURM_SUCCESS) {
 		reset_mysql_conn(mysql_conn);
 		list_destroy(ret_list);
 		return NULL;
@@ -833,11 +833,11 @@ extern List as_mysql_remove_qos(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	slurm_mutex_lock(&as_mysql_cluster_list_lock);
 	itr = list_iterator_create(as_mysql_cluster_list);
-	while((object = list_next(itr))) {
-		if((rc = remove_common(mysql_conn, DBD_REMOVE_QOS, now,
-				       user_name, qos_table, name_char,
-				       assoc_char, object, NULL, NULL))
-		   != SLURM_SUCCESS)
+	while ((object = list_next(itr))) {
+		if ((rc = remove_common(mysql_conn, DBD_REMOVE_QOS, now,
+					user_name, qos_table, name_char,
+					assoc_char, object, NULL, NULL))
+		    != SLURM_SUCCESS)
 			break;
 	}
 	list_iterator_destroy(itr);
@@ -921,27 +921,27 @@ extern List as_mysql_get_qos(mysql_conn_t *mysql_conn, uid_t uid,
 		QOS_REQ_COUNT
 	};
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
-	if(!qos_cond) {
+	if (!qos_cond) {
 		xstrcat(extra, "where deleted=0");
 		goto empty;
 	}
 
-	if(qos_cond->with_deleted)
+	if (qos_cond->with_deleted)
 		xstrcat(extra, "where (deleted=0 || deleted=1)");
 	else
 		xstrcat(extra, "where deleted=0");
 
 
-	if(qos_cond->description_list
-	   && list_count(qos_cond->description_list)) {
+	if (qos_cond->description_list
+	    && list_count(qos_cond->description_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(qos_cond->description_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "description='%s'", object);
 			set = 1;
@@ -950,13 +950,13 @@ extern List as_mysql_get_qos(mysql_conn_t *mysql_conn, uid_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(qos_cond->id_list
-	   && list_count(qos_cond->id_list)) {
+	if (qos_cond->id_list
+	    && list_count(qos_cond->id_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(qos_cond->id_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "id='%s'", object);
 			set = 1;
@@ -965,13 +965,13 @@ extern List as_mysql_get_qos(mysql_conn_t *mysql_conn, uid_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(qos_cond->name_list
-	   && list_count(qos_cond->name_list)) {
+	if (qos_cond->name_list
+	    && list_count(qos_cond->name_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(qos_cond->name_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "name='%s'", object);
 			set = 1;
@@ -994,8 +994,8 @@ empty:
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return NULL;
 	}
@@ -1003,94 +1003,94 @@ empty:
 
 	qos_list = list_create(slurmdb_destroy_qos_rec);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_qos_rec_t *qos = xmalloc(sizeof(slurmdb_qos_rec_t));
 		list_append(qos_list, qos);
 
-		if(row[QOS_REQ_DESC] && row[QOS_REQ_DESC][0])
+		if (row[QOS_REQ_DESC] && row[QOS_REQ_DESC][0])
 			qos->description = xstrdup(row[QOS_REQ_DESC]);
 
 		qos->id = slurm_atoul(row[QOS_REQ_ID]);
 
 		qos->flags = slurm_atoul(row[QOS_REQ_FLAGS]);
 
-		if(row[QOS_REQ_NAME] && row[QOS_REQ_NAME][0])
+		if (row[QOS_REQ_NAME] && row[QOS_REQ_NAME][0])
 			qos->name = xstrdup(row[QOS_REQ_NAME]);
 
-		if(row[QOS_REQ_GCM])
+		if (row[QOS_REQ_GCM])
 			qos->grp_cpu_mins = slurm_atoull(row[QOS_REQ_GCM]);
 		else
 			qos->grp_cpu_mins = INFINITE;
-		if(row[QOS_REQ_GCRM])
+		if (row[QOS_REQ_GCRM])
 			qos->grp_cpu_run_mins = slurm_atoull(row[QOS_REQ_GCRM]);
 		else
 			qos->grp_cpu_run_mins = INFINITE;
-		if(row[QOS_REQ_GC])
+		if (row[QOS_REQ_GC])
 			qos->grp_cpus = slurm_atoul(row[QOS_REQ_GC]);
 		else
 			qos->grp_cpus = INFINITE;
-		if(row[QOS_REQ_GJ])
+		if (row[QOS_REQ_GJ])
 			qos->grp_jobs = slurm_atoul(row[QOS_REQ_GJ]);
 		else
 			qos->grp_jobs = INFINITE;
-		if(row[QOS_REQ_GN])
+		if (row[QOS_REQ_GN])
 			qos->grp_nodes = slurm_atoul(row[QOS_REQ_GN]);
 		else
 			qos->grp_nodes = INFINITE;
-		if(row[QOS_REQ_GSJ])
+		if (row[QOS_REQ_GSJ])
 			qos->grp_submit_jobs = slurm_atoul(row[QOS_REQ_GSJ]);
 		else
 			qos->grp_submit_jobs = INFINITE;
-		if(row[QOS_REQ_GW])
+		if (row[QOS_REQ_GW])
 			qos->grp_wall = slurm_atoul(row[QOS_REQ_GW]);
 		else
 			qos->grp_wall = INFINITE;
 
-		if(row[QOS_REQ_MCMPJ])
+		if (row[QOS_REQ_MCMPJ])
 			qos->max_cpu_mins_pj = slurm_atoull(row[QOS_REQ_MCMPJ]);
 		else
 			qos->max_cpu_mins_pj = (uint64_t)INFINITE;
-		if(row[QOS_REQ_MCRM])
+		if (row[QOS_REQ_MCRM])
 			qos->max_cpu_run_mins_pu =
 				slurm_atoull(row[QOS_REQ_MCRM]);
 		else
 			qos->max_cpu_run_mins_pu = (uint64_t)INFINITE;
-		if(row[QOS_REQ_MCPJ])
+		if (row[QOS_REQ_MCPJ])
 			qos->max_cpus_pj = slurm_atoul(row[QOS_REQ_MCPJ]);
 		else
 			qos->max_cpus_pj = INFINITE;
-		if(row[QOS_REQ_MJPU])
+		if (row[QOS_REQ_MJPU])
 			qos->max_jobs_pu = slurm_atoul(row[QOS_REQ_MJPU]);
 		else
 			qos->max_jobs_pu = INFINITE;
-		if(row[QOS_REQ_MNPJ])
+		if (row[QOS_REQ_MNPJ])
 			qos->max_nodes_pj = slurm_atoul(row[QOS_REQ_MNPJ]);
 		else
 			qos->max_nodes_pj = INFINITE;
-		if(row[QOS_REQ_MSJPU])
+		if (row[QOS_REQ_MSJPU])
 			qos->max_submit_jobs_pu =
 				slurm_atoul(row[QOS_REQ_MSJPU]);
 		else
 			qos->max_submit_jobs_pu = INFINITE;
-		if(row[QOS_REQ_MWPJ])
+		if (row[QOS_REQ_MWPJ])
 			qos->max_wall_pj = slurm_atoul(row[QOS_REQ_MWPJ]);
 		else
 			qos->max_wall_pj = INFINITE;
 
-		if(row[QOS_REQ_PREE] && row[QOS_REQ_PREE][0]) {
-			if(!qos->preempt_bitstr)
+		if (row[QOS_REQ_PREE] && row[QOS_REQ_PREE][0]) {
+			if (!qos->preempt_bitstr)
 				qos->preempt_bitstr = bit_alloc(g_qos_count);
 			bit_unfmt(qos->preempt_bitstr, row[QOS_REQ_PREE]+1);
 		}
-		if(row[QOS_REQ_PREEM])
+		if (row[QOS_REQ_PREEM])
 			qos->preempt_mode = slurm_atoul(row[QOS_REQ_PREEM]);
-		if(row[QOS_REQ_PRIO])
+		if (row[QOS_REQ_PRIO])
 			qos->priority = slurm_atoul(row[QOS_REQ_PRIO]);
 
-		if(row[QOS_REQ_UF])
+		if (row[QOS_REQ_UF])
 			qos->usage_factor = atof(row[QOS_REQ_UF]);
 
-		if(row[QOS_REQ_UT])
+		if (row[QOS_REQ_UT])
 			qos->usage_thres = atof(row[QOS_REQ_UT]);
 		else
 			qos->usage_thres = (double)INFINITE;
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_resv.c b/src/plugins/accounting_storage/mysql/as_mysql_resv.c
index 82572e24c2a..8df6b955f86 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_resv.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_resv.c
@@ -46,14 +46,14 @@ static int _setup_resv_limits(slurmdb_reservation_rec_t *resv,
 {
 	/* strip off the action item from the flags */
 
-	if(resv->assocs) {
+	if (resv->assocs) {
 		int start = 0;
 		int len = strlen(resv->assocs)-1;
 
 		/* strip off extra ,'s */
-		if(resv->assocs[0] == ',')
+		if (resv->assocs[0] == ',')
 			start = 1;
-		if(resv->assocs[len] == ',')
+		if (resv->assocs[len] == ',')
 			resv->assocs[len] = '\0';
 
 		xstrcat(*cols, ", assoclist");
@@ -61,43 +61,43 @@ static int _setup_resv_limits(slurmdb_reservation_rec_t *resv,
 		xstrfmtcat(*extra, ", assoclist='%s'", resv->assocs+start);
 	}
 
-	if(resv->cpus != (uint32_t)NO_VAL) {
+	if (resv->cpus != (uint32_t)NO_VAL) {
 		xstrcat(*cols, ", cpus");
 		xstrfmtcat(*vals, ", %u", resv->cpus);
 		xstrfmtcat(*extra, ", cpus=%u", resv->cpus);
 	}
 
-	if(resv->flags != (uint16_t)NO_VAL) {
+	if (resv->flags != (uint16_t)NO_VAL) {
 		xstrcat(*cols, ", flags");
 		xstrfmtcat(*vals, ", %u", resv->flags);
 		xstrfmtcat(*extra, ", flags=%u", resv->flags);
 	}
 
-	if(resv->name) {
+	if (resv->name) {
 		xstrcat(*cols, ", resv_name");
 		xstrfmtcat(*vals, ", '%s'", resv->name);
 		xstrfmtcat(*extra, ", resv_name='%s'", resv->name);
 	}
 
-	if(resv->nodes) {
+	if (resv->nodes) {
 		xstrcat(*cols, ", nodelist");
 		xstrfmtcat(*vals, ", '%s'", resv->nodes);
 		xstrfmtcat(*extra, ", nodelist='%s'", resv->nodes);
 	}
 
-	if(resv->node_inx) {
+	if (resv->node_inx) {
 		xstrcat(*cols, ", node_inx");
 		xstrfmtcat(*vals, ", '%s'", resv->node_inx);
 		xstrfmtcat(*extra, ", node_inx='%s'", resv->node_inx);
 	}
 
-	if(resv->time_end) {
+	if (resv->time_end) {
 		xstrcat(*cols, ", time_end");
 		xstrfmtcat(*vals, ", %ld", resv->time_end);
 		xstrfmtcat(*extra, ", time_end=%ld", resv->time_end);
 	}
 
-	if(resv->time_start) {
+	if (resv->time_start) {
 		xstrcat(*cols, ", time_start");
 		xstrfmtcat(*vals, ", %ld", resv->time_start);
 		xstrfmtcat(*extra, ", time_start=%ld", resv->time_start);
@@ -115,18 +115,18 @@ static int _setup_resv_cond_limits(slurmdb_reservation_cond_t *resv_cond,
 	char *prefix = "t1";
 	time_t now = time(NULL);
 
-	if(!resv_cond)
+	if (!resv_cond)
 		return 0;
 
-	if(resv_cond->id_list && list_count(resv_cond->id_list)) {
+	if (resv_cond->id_list && list_count(resv_cond->id_list)) {
 		set = 0;
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 		itr = list_iterator_create(resv_cond->id_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.id_resv=%s", prefix, object);
 			set = 1;
@@ -135,15 +135,15 @@ static int _setup_resv_cond_limits(slurmdb_reservation_cond_t *resv_cond,
 		xstrcat(*extra, ")");
 	}
 
-	if(resv_cond->name_list && list_count(resv_cond->name_list)) {
+	if (resv_cond->name_list && list_count(resv_cond->name_list)) {
 		set = 0;
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
 		itr = list_iterator_create(resv_cond->name_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(*extra, " || ");
 			xstrfmtcat(*extra, "%s.resv_name='%s'",
 				   prefix, object);
@@ -153,11 +153,11 @@ static int _setup_resv_cond_limits(slurmdb_reservation_cond_t *resv_cond,
 		xstrcat(*extra, ")");
 	}
 
-	if(resv_cond->time_start) {
-		if(!resv_cond->time_end)
+	if (resv_cond->time_start) {
+		if (!resv_cond->time_end)
 			resv_cond->time_end = now;
 
-		if(*extra)
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
@@ -165,8 +165,8 @@ static int _setup_resv_cond_limits(slurmdb_reservation_cond_t *resv_cond,
 			   "(t1.time_start < %ld "
 			   "&& (t1.time_end >= %ld || t1.time_end = 0)))",
 			   resv_cond->time_end, resv_cond->time_start);
-	} else if(resv_cond->time_end) {
-		if(*extra)
+	} else if (resv_cond->time_end) {
+		if (*extra)
 			xstrcat(*extra, " && (");
 		else
 			xstrcat(*extra, " where (");
@@ -185,20 +185,20 @@ extern int as_mysql_add_resv(mysql_conn_t *mysql_conn,
 	char *cols = NULL, *vals = NULL, *extra = NULL,
 		*query = NULL;//, *tmp_extra = NULL;
 
-	if(!resv) {
+	if (!resv) {
 		error("No reservation was given to edit");
 		return SLURM_ERROR;
 	}
 
-	if(!resv->id) {
+	if (!resv->id) {
 		error("We need an id to edit a reservation.");
 		return SLURM_ERROR;
 	}
-	if(!resv->time_start) {
+	if (!resv->time_start) {
 		error("We need a start time to edit a reservation.");
 		return SLURM_ERROR;
 	}
-	if(!resv->cluster || !resv->cluster[0]) {
+	if (!resv->cluster || !resv->cluster[0]) {
 		error("We need a cluster name to edit a reservation.");
 		return SLURM_ERROR;
 	}
@@ -223,7 +223,7 @@ extern int as_mysql_add_resv(mysql_conn_t *mysql_conn,
 }
 
 extern int as_mysql_modify_resv(mysql_conn_t *mysql_conn,
-			     slurmdb_reservation_rec_t *resv)
+				slurmdb_reservation_rec_t *resv)
 {
 	MYSQL_RES *result = NULL;
 	MYSQL_ROW row;
@@ -255,25 +255,25 @@ extern int as_mysql_modify_resv(mysql_conn_t *mysql_conn,
 		RESV_COUNT
 	};
 
-	if(!resv) {
+	if (!resv) {
 		error("No reservation was given to edit");
 		return SLURM_ERROR;
 	}
 
-	if(!resv->id) {
+	if (!resv->id) {
 		error("We need an id to edit a reservation.");
 		return SLURM_ERROR;
 	}
-	if(!resv->time_start) {
+	if (!resv->time_start) {
 		error("We need a start time to edit a reservation.");
 		return SLURM_ERROR;
 	}
-	if(!resv->cluster || !resv->cluster[0]) {
+	if (!resv->cluster || !resv->cluster[0]) {
 		error("We need a cluster name to edit a reservation.");
 		return SLURM_ERROR;
 	}
 
-	if(!resv->time_start_prev) {
+	if (!resv->time_start_prev) {
 		error("We need a time to check for last "
 		      "start of reservation.");
 		return SLURM_ERROR;
@@ -297,18 +297,18 @@ extern int as_mysql_modify_resv(mysql_conn_t *mysql_conn,
 try_again:
 	debug4("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		rc = SLURM_ERROR;
 		goto end_it;
 	}
-	if(!(row = mysql_fetch_row(result))) {
+	if (!(row = mysql_fetch_row(result))) {
 		rc = SLURM_ERROR;
 		mysql_free_result(result);
 		error("There is no reservation by id %u, "
 		      "time_start %ld, and cluster '%s'", resv->id,
 		      resv->time_start_prev, resv->cluster);
-		if(!set && resv->time_end) {
+		if (!set && resv->time_end) {
 			/* This should never really happen,
 			   but just incase the controller and the
 			   database get out of sync we check
@@ -337,37 +337,37 @@ try_again:
 
 	/* check differences here */
 
-	if(!resv->name
-	   && row[RESV_NAME] && row[RESV_NAME][0])
+	if (!resv->name
+	    && row[RESV_NAME] && row[RESV_NAME][0])
 		// if this changes we just update the
 		// record, no need to create a new one since
 		// this doesn't really effect the
 		// reservation accounting wise
 		resv->name = xstrdup(row[RESV_NAME]);
 
-	if(resv->assocs)
+	if (resv->assocs)
 		set = 1;
-	else if(row[RESV_ASSOCS] && row[RESV_ASSOCS][0])
+	else if (row[RESV_ASSOCS] && row[RESV_ASSOCS][0])
 		resv->assocs = xstrdup(row[RESV_ASSOCS]);
 
-	if(resv->cpus != (uint32_t)NO_VAL)
+	if (resv->cpus != (uint32_t)NO_VAL)
 		set = 1;
 	else
 		resv->cpus = slurm_atoul(row[RESV_CPU]);
 
-	if(resv->flags != (uint16_t)NO_VAL)
+	if (resv->flags != (uint16_t)NO_VAL)
 		set = 1;
 	else
 		resv->flags = slurm_atoul(row[RESV_FLAGS]);
 
-	if(resv->nodes)
+	if (resv->nodes)
 		set = 1;
-	else if(row[RESV_NODES] && row[RESV_NODES][0]) {
+	else if (row[RESV_NODES] && row[RESV_NODES][0]) {
 		resv->nodes = xstrdup(row[RESV_NODES]);
 		resv->node_inx = xstrdup(row[RESV_NODE_INX]);
 	}
 
-	if(!resv->time_end)
+	if (!resv->time_end)
 		resv->time_end = slurm_atoul(row[RESV_END]);
 
 	mysql_free_result(result);
@@ -377,7 +377,7 @@ try_again:
 	 * just incase we have a different one from being out
 	 * of sync
 	 */
-	if((start > now) || !set) {
+	if ((start > now) || !set) {
 		/* we haven't started the reservation yet, or
 		   we are changing the associations or end
 		   time which we can just update it */
@@ -420,17 +420,17 @@ end_it:
 }
 
 extern int as_mysql_remove_resv(mysql_conn_t *mysql_conn,
-			    slurmdb_reservation_rec_t *resv)
+				slurmdb_reservation_rec_t *resv)
 {
 	int rc = SLURM_SUCCESS;
 	char *query = NULL;//, *tmp_extra = NULL;
 
-	if(!resv) {
+	if (!resv) {
 		error("No reservation was given to edit");
 		return SLURM_ERROR;
 	}
 
-	if(!resv->id || !resv->time_start || !resv->cluster) {
+	if (!resv->id || !resv->time_start || !resv->cluster) {
 		error("We need an id, start time, and cluster "
 		      "name to edit a reservation.");
 		return SLURM_ERROR;
@@ -464,7 +464,7 @@ extern int as_mysql_remove_resv(mysql_conn_t *mysql_conn,
 }
 
 extern List as_mysql_get_resvs(mysql_conn_t *mysql_conn, uid_t uid,
-			    slurmdb_reservation_cond_t *resv_cond)
+			       slurmdb_reservation_cond_t *resv_cond)
 {
 	//DEF_TIMERS;
 	char *query = NULL;
@@ -511,18 +511,18 @@ extern List as_mysql_get_resvs(mysql_conn_t *mysql_conn, uid_t uid,
 		RESV_REQ_COUNT
 	};
 
-	if(!resv_cond) {
+	if (!resv_cond) {
 		xstrcat(extra, " where deleted=0");
 		goto empty;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	private_data = slurm_get_private_data();
 	if (private_data & PRIVATE_DATA_RESERVATIONS) {
-		if(!(is_admin = is_user_min_admin_level(
-			     mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
+		if (!(is_admin = is_user_min_admin_level(
+			      mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
 			error("Only admins can look at reservations");
 			errno = ESLURM_ACCESS_DENIED;
 			return NULL;
@@ -530,14 +530,14 @@ extern List as_mysql_get_resvs(mysql_conn_t *mysql_conn, uid_t uid,
 	}
 
 	memset(&job_cond, 0, sizeof(slurmdb_job_cond_t));
-	if(resv_cond->nodes) {
+	if (resv_cond->nodes) {
 		job_cond.usage_start = resv_cond->time_start;
 		job_cond.usage_end = resv_cond->time_end;
 		job_cond.used_nodes = resv_cond->nodes;
 		job_cond.cluster_list = resv_cond->cluster_list;
 		local_cluster_list = setup_cluster_list_with_inx(
 			mysql_conn, &job_cond, (void **)&curr_cluster);
-	} else if(with_usage) {
+	} else if (with_usage) {
 		job_cond.usage_start = resv_cond->time_start;
 		job_cond.usage_end = resv_cond->time_end;
 	}
@@ -546,7 +546,7 @@ extern List as_mysql_get_resvs(mysql_conn_t *mysql_conn, uid_t uid,
 
 	with_usage = resv_cond->with_usage;
 
-	if(resv_cond->cluster_list && list_count(resv_cond->cluster_list))
+	if (resv_cond->cluster_list && list_count(resv_cond->cluster_list))
 		use_cluster_list = resv_cond->cluster_list;
 empty:
 	xfree(tmp);
@@ -555,11 +555,11 @@ empty:
 		xstrfmtcat(tmp, ", t1.%s", resv_req_inx[i]);
 	}
 
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 	itr = list_iterator_create(use_cluster_list);
-	while((cluster_name = list_next(itr))) {
-		if(query)
+	while ((cluster_name = list_next(itr))) {
+		if (query)
 			xstrcat(query, " union ");
 		//START_TIMER;
 		xstrfmtcat(query, "select distinct %s,'%s' as cluster "
@@ -567,19 +567,19 @@ empty:
 			   tmp, cluster_name, cluster_name, resv_table, extra);
 	}
 	list_iterator_destroy(itr);
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
-	if(query)
+	if (query)
 		xstrcat(query, " order by cluster, resv_name;");
 
 	xfree(tmp);
 	xfree(extra);
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
-		if(local_cluster_list)
+		if (local_cluster_list)
 			list_destroy(local_cluster_list);
 		return NULL;
 	}
@@ -587,19 +587,19 @@ empty:
 
 	resv_list = list_create(slurmdb_destroy_reservation_rec);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_reservation_rec_t *resv =
 			xmalloc(sizeof(slurmdb_reservation_rec_t));
 		int start = slurm_atoul(row[RESV_REQ_START]);
 		list_append(resv_list, resv);
 
-		if(!good_nodes_from_inx(local_cluster_list, &curr_cluster,
-					row[RESV_REQ_NODE_INX], start))
+		if (!good_nodes_from_inx(local_cluster_list, &curr_cluster,
+					 row[RESV_REQ_NODE_INX], start))
 			continue;
 
 		resv->id = slurm_atoul(row[RESV_REQ_ID]);
-		if(with_usage) {
-			if(!job_cond.resvid_list)
+		if (with_usage) {
+			if (!job_cond.resvid_list)
 				job_cond.resvid_list = list_create(NULL);
 			list_append(job_cond.resvid_list, row[RESV_REQ_ID]);
 		}
@@ -613,50 +613,50 @@ empty:
 		resv->flags = slurm_atoul(row[RESV_REQ_FLAGS]);
 	}
 
-	if(local_cluster_list)
+	if (local_cluster_list)
 		list_destroy(local_cluster_list);
 
-	if(with_usage && resv_list && list_count(resv_list)) {
+	if (with_usage && resv_list && list_count(resv_list)) {
 		List job_list = as_mysql_jobacct_process_get_jobs(
 			mysql_conn, uid, &job_cond);
 		ListIterator itr = NULL, itr2 = NULL;
 		slurmdb_job_rec_t *job = NULL;
 		slurmdb_reservation_rec_t *resv = NULL;
 
-		if(!job_list || !list_count(job_list))
+		if (!job_list || !list_count(job_list))
 			goto no_jobs;
 
 		itr = list_iterator_create(job_list);
 		itr2 = list_iterator_create(resv_list);
-		while((job = list_next(itr))) {
+		while ((job = list_next(itr))) {
 			int start = job->start;
 			int end = job->end;
 			int set = 0;
-			while((resv = list_next(itr2))) {
+			while ((resv = list_next(itr2))) {
 				int elapsed = 0;
 				/* since a reservation could have
 				   changed while a job was running we
 				   have to make sure we get the time
 				   in the correct record.
 				*/
-				if(resv->id != job->resvid)
+				if (resv->id != job->resvid)
 					continue;
 				set = 1;
 
-				if(start < resv->time_start)
+				if (start < resv->time_start)
 					start = resv->time_start;
-				if(!end || end > resv->time_end)
+				if (!end || end > resv->time_end)
 					end = resv->time_end;
 
-				if((elapsed = (end - start)) < 1)
+				if ((elapsed = (end - start)) < 1)
 					continue;
 
-				if(job->alloc_cpus)
+				if (job->alloc_cpus)
 					resv->alloc_secs +=
 						elapsed * job->alloc_cpus;
 			}
 			list_iterator_reset(itr2);
-			if(!set) {
+			if (!set) {
 				error("we got a job %u with no reservation "
 				      "associatied with it?", job->jobid);
 			}
@@ -665,11 +665,11 @@ empty:
 		list_iterator_destroy(itr2);
 		list_iterator_destroy(itr);
 	no_jobs:
-		if(job_list)
+		if (job_list)
 			list_destroy(job_list);
 	}
 
-	if(job_cond.resvid_list) {
+	if (job_cond.resvid_list) {
 		list_destroy(job_cond.resvid_list);
 		job_cond.resvid_list = NULL;
 	}
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_rollup.c b/src/plugins/accounting_storage/mysql/as_mysql_rollup.c
index 0eaffffe0cd..0bc6c731a17 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_rollup.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_rollup.c
@@ -73,7 +73,7 @@ typedef struct {
 static void _destroy_local_id_usage(void *object)
 {
 	local_id_usage_t *a_usage = (local_id_usage_t *)object;
-	if(a_usage) {
+	if (a_usage) {
 		xfree(a_usage);
 	}
 }
@@ -81,7 +81,7 @@ static void _destroy_local_id_usage(void *object)
 static void _destroy_local_cluster_usage(void *object)
 {
 	local_cluster_usage_t *c_usage = (local_cluster_usage_t *)object;
-	if(c_usage) {
+	if (c_usage) {
 		xfree(c_usage);
 	}
 }
@@ -89,8 +89,8 @@ static void _destroy_local_cluster_usage(void *object)
 static void _destroy_local_resv_usage(void *object)
 {
 	local_resv_usage_t *r_usage = (local_resv_usage_t *)object;
-	if(r_usage) {
-		if(r_usage->local_assocs)
+	if (r_usage) {
+		if (r_usage->local_assocs)
 			list_destroy(r_usage->local_assocs);
 		xfree(r_usage);
 	}
@@ -108,10 +108,10 @@ static int _process_purge(mysql_conn_t *mysql_conn,
 	/* if we didn't ask for archive data return here and don't do
 	   anything extra just rollup */
 
-	if(!archive_data)
+	if (!archive_data)
 		return SLURM_SUCCESS;
 
-	if(!slurmdbd_conf)
+	if (!slurmdbd_conf)
 		return SLURM_SUCCESS;
 
 	memset(&job_cond, 0, sizeof(job_cond));
@@ -119,19 +119,19 @@ static int _process_purge(mysql_conn_t *mysql_conn,
 	arch_cond.archive_dir = slurmdbd_conf->archive_dir;
 	arch_cond.archive_script = slurmdbd_conf->archive_script;
 
-	if(purge_period & slurmdbd_conf->purge_event)
+	if (purge_period & slurmdbd_conf->purge_event)
 		arch_cond.purge_event = slurmdbd_conf->purge_event;
 	else
 		arch_cond.purge_event = NO_VAL;
-	if(purge_period & slurmdbd_conf->purge_job)
+	if (purge_period & slurmdbd_conf->purge_job)
 		arch_cond.purge_job = slurmdbd_conf->purge_job;
 	else
 		arch_cond.purge_job = NO_VAL;
-	if(purge_period & slurmdbd_conf->purge_step)
+	if (purge_period & slurmdbd_conf->purge_step)
 		arch_cond.purge_step = slurmdbd_conf->purge_step;
 	else
 		arch_cond.purge_step = NO_VAL;
-	if(purge_period & slurmdbd_conf->purge_suspend)
+	if (purge_period & slurmdbd_conf->purge_suspend)
 		arch_cond.purge_suspend = slurmdbd_conf->purge_suspend;
 	else
 		arch_cond.purge_suspend = NO_VAL;
@@ -275,7 +275,7 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 	c_itr = list_iterator_create(cluster_usage_list);
 	w_itr = list_iterator_create(wckey_usage_list);
 	r_itr = list_iterator_create(resv_usage_list);
-	while(curr_start < end) {
+	while (curr_start < end) {
 		int last_id = -1;
 		int last_wckeyid = -1;
 		int seconds = 0;
@@ -304,40 +304,40 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(
+		if (!(result = mysql_db_query_ret(
 			     mysql_conn, query, 0))) {
 			xfree(query);
 			return SLURM_ERROR;
 		}
 		xfree(query);
 
-		while((row = mysql_fetch_row(result))) {
+		while ((row = mysql_fetch_row(result))) {
 			time_t row_start = slurm_atoul(row[EVENT_REQ_START]);
 			time_t row_end = slurm_atoul(row[EVENT_REQ_END]);
 			uint32_t row_cpu = slurm_atoul(row[EVENT_REQ_CPU]);
 
-			if(row_start < curr_start)
+			if (row_start < curr_start)
 				row_start = curr_start;
 
-			if(!row_end || row_end > curr_end)
+			if (!row_end || row_end > curr_end)
 				row_end = curr_end;
 
 			/* Don't worry about it if the time is less
 			 * than 1 second.
 			 */
-			if((row_end - row_start) < 1)
+			if ((row_end - row_start) < 1)
 				continue;
 
 			/* this means we are a cluster registration
 			   entry */
-			if(!row[EVENT_REQ_NAME][0]) {
+			if (!row[EVENT_REQ_NAME][0]) {
 				/* if the cpu count changes we will
 				 * only care about the last cpu count but
 				 * we will keep a total of the time for
 				 * all cpus to get the correct cpu time
 				 * for the entire period.
 				 */
-				if(!c_usage) {
+				if (!c_usage) {
 					c_usage = xmalloc(
 						sizeof(local_cluster_usage_t));
 					c_usage->cpu_count = row_cpu;
@@ -360,15 +360,15 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 			   are looking for.  If it was during this
 			   time period we would already have it.
 			*/
-			if(c_usage) {
+			if (c_usage) {
 				int local_start = row_start;
 				int local_end = row_end;
-				if(c_usage->start > local_start)
+				if (c_usage->start > local_start)
 					local_start = c_usage->start;
-				if(c_usage->end < local_end)
+				if (c_usage->end < local_end)
 					local_end = c_usage->end;
 
-				if((local_end - local_start) > 0) {
+				if ((local_end - local_start) > 0) {
 					seconds = (local_end - local_start);
 
 /* 					info("node %s adds " */
@@ -395,7 +395,7 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(
+		if (!(result = mysql_db_query_ret(
 			     mysql_conn, query, 0))) {
 			xfree(query);
 			return SLURM_ERROR;
@@ -421,22 +421,22 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 		   option which will allow jobs to continue to run in the
 		   reservation that aren't suppose to.
 		*/
-		while((row = mysql_fetch_row(result))) {
+		while ((row = mysql_fetch_row(result))) {
 			time_t row_start = slurm_atoul(row[RESV_REQ_START]);
 			time_t row_end = slurm_atoul(row[RESV_REQ_END]);
 			uint32_t row_cpu = slurm_atoul(row[RESV_REQ_CPU]);
 			uint32_t row_flags = slurm_atoul(row[RESV_REQ_FLAGS]);
 
-			if(row_start < curr_start)
+			if (row_start < curr_start)
 				row_start = curr_start;
 
-			if(!row_end || row_end > curr_end)
+			if (!row_end || row_end > curr_end)
 				row_end = curr_end;
 
 			/* Don't worry about it if the time is less
 			 * than 1 second.
 			 */
-			if((row_end - row_start) < 1)
+			if ((row_end - row_start) < 1)
 				continue;
 
 			r_usage = xmalloc(sizeof(local_resv_usage_t));
@@ -464,13 +464,13 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 			   registered.  This continue should rarely if
 			   ever happen.
 			*/
-			if(!c_usage)
+			if (!c_usage)
 				continue;
-			else if(row_flags & RESERVE_FLAG_MAINT)
+			else if (row_flags & RESERVE_FLAG_MAINT)
 				c_usage->pd_cpu += r_usage->total_time;
 			else
 				c_usage->a_cpu += r_usage->total_time;
-			/* char *start_char = xstrdup(ctime(&r_usage->start)); */
+			/* char *start_char = xstrdup(ctime(&r_usage->start));*/
 			/* char *end_char = xstrdup(ctime(&r_usage->end)); */
 			/* start_char[strlen(start_char)-1] = '\0'; */
 			/* info("adding this much %lld to cluster %s " */
@@ -493,14 +493,14 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(
+		if (!(result = mysql_db_query_ret(
 			     mysql_conn, query, 0))) {
 			xfree(query);
 			return SLURM_ERROR;
 		}
 		xfree(query);
 
-		while((row = mysql_fetch_row(result))) {
+		while ((row = mysql_fetch_row(result))) {
 			uint32_t job_id = slurm_atoul(row[JOB_REQ_JOBID]);
 			uint32_t assoc_id = slurm_atoul(row[JOB_REQ_ASSOCID]);
 			uint32_t wckey_id = slurm_atoul(row[JOB_REQ_WCKEYID]);
@@ -512,21 +512,21 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 			uint32_t row_rcpu = slurm_atoul(row[JOB_REQ_RCPU]);
 			seconds = 0;
 
-			if(row_start && (row_start < curr_start))
+			if (row_start && (row_start < curr_start))
 				row_start = curr_start;
 
-			if(!row_start && row_end)
+			if (!row_start && row_end)
 				row_start = row_end;
 
-			if(!row_end || row_end > curr_end)
+			if (!row_end || row_end > curr_end)
 				row_end = curr_end;
 
-			if(!row_start || ((row_end - row_start) < 1))
+			if (!row_start || ((row_end - row_start) < 1))
 				goto calc_cluster;
 
 			seconds = (row_end - row_start);
 
-			if(row[JOB_REQ_SUSPENDED]) {
+			if (row[JOB_REQ_SUSPENDED]) {
 				MYSQL_RES *result2 = NULL;
 				MYSQL_ROW row2;
 				/* get the suspended time for this job */
@@ -543,41 +543,41 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 				debug4("%d(%s:%d) query\n%s",
 				       mysql_conn->conn, THIS_FILE,
 				       __LINE__, query);
-				if(!(result2 = mysql_db_query_ret(
+				if (!(result2 = mysql_db_query_ret(
 					     mysql_conn,
 					     query, 0))) {
 					xfree(query);
 					return SLURM_ERROR;
 				}
 				xfree(query);
-				while((row2 = mysql_fetch_row(result2))) {
+				while ((row2 = mysql_fetch_row(result2))) {
 					time_t local_start = slurm_atoul(
 						row2[SUSPEND_REQ_START]);
 					time_t local_end = slurm_atoul(
 						row2[SUSPEND_REQ_END]);
 
-					if(!local_start)
+					if (!local_start)
 						continue;
 
-					if(row_start > local_start)
+					if (row_start > local_start)
 						local_start = row_start;
-					if(row_end < local_end)
+					if (row_end < local_end)
 						local_end = row_end;
 
-					if((local_end - local_start) < 1)
+					if ((local_end - local_start) < 1)
 						continue;
 
 					seconds -= (local_end - local_start);
 				}
 				mysql_free_result(result2);
 			}
-			if(seconds < 1) {
+			if (seconds < 1) {
 				debug4("This job (%u) was suspended "
 				       "the entire hour", job_id);
 				continue;
 			}
 
-			if(last_id != assoc_id) {
+			if (last_id != assoc_id) {
 				a_usage = xmalloc(sizeof(local_id_usage_t));
 				a_usage->id = assoc_id;
 				list_append(assoc_usage_list, a_usage);
@@ -586,17 +586,17 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 
 			a_usage->a_cpu += seconds * row_acpu;
 
-			if(!track_wckey)
+			if (!track_wckey)
 				goto calc_cluster;
 
 			/* do the wckey calculation */
-			if(last_wckeyid != wckey_id) {
+			if (last_wckeyid != wckey_id) {
 				list_iterator_reset(w_itr);
-				while((w_usage = list_next(w_itr)))
-					if(w_usage->id == wckey_id)
+				while ((w_usage = list_next(w_itr)))
+					if (w_usage->id == wckey_id)
 						break;
 
-				if(!w_usage) {
+				if (!w_usage) {
 					w_usage = xmalloc(
 						sizeof(local_id_usage_t));
 					w_usage->id = wckey_id;
@@ -611,8 +611,8 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 		calc_cluster:
 
 			/* first figure out the reservation */
-			if(resv_id) {
-				if(seconds <= 0)
+			if (resv_id) {
+				if (seconds <= 0)
 					continue;
 				/* Since we have already added the
 				   entire reservation as used time on
@@ -628,7 +628,7 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 				   since the job may be able to run
 				   outside of the reservation. */
 				list_iterator_reset(r_itr);
-				while((r_usage = list_next(r_itr))) {
+				while ((r_usage = list_next(r_itr))) {
 					/* since the reservation could
 					   have changed in some way,
 					   thus making a new
@@ -637,16 +637,16 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 					   sure all the reservations
 					   are checked to see if such
 					   a thing has happened */
-					if(r_usage->id == resv_id) {
+					if (r_usage->id == resv_id) {
 						int temp_end = row_end;
 						int temp_start = row_start;
-						if(r_usage->start > temp_start)
+						if (r_usage->start > temp_start)
 							temp_start =
 								r_usage->start;
-						if(r_usage->end < temp_end)
+						if (r_usage->end < temp_end)
 							temp_end = r_usage->end;
 
-						if((temp_end - temp_start)
+						if ((temp_end - temp_start)
 						   > 0) {
 							r_usage->a_cpu +=
 								(temp_end
@@ -662,10 +662,10 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 			   registered.  This continue should rarely if
 			   ever happen.
 			*/
-			if(!c_usage)
+			if (!c_usage)
 				continue;
 
-			if(row_start && (seconds > 0)) {
+			if (row_start && (seconds > 0)) {
 /* 					info("%d assoc %d adds " */
 /* 					     "(%d)(%d-%d) * %d = %d " */
 /* 					     "to %d", */
@@ -681,15 +681,15 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 			}
 
 			/* now reserved time */
-			if(!row_start || (row_start >= c_usage->start)) {
+			if (!row_start || (row_start >= c_usage->start)) {
 				row_end = row_start;
 				row_start = row_eligible;
-				if(c_usage->start > row_start)
+				if (c_usage->start > row_start)
 					row_start = c_usage->start;
-				if(c_usage->end < row_end)
+				if (c_usage->end < row_end)
 					row_end = c_usage->end;
 
-				if((row_end - row_start) > 0) {
+				if ((row_end - row_start) > 0) {
 					seconds = (row_end - row_start)
 						* row_rcpu;
 
@@ -713,12 +713,12 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 		   associations that could had run in the reservation
 		*/
 		list_iterator_reset(r_itr);
-		while((r_usage = list_next(r_itr))) {
+		while ((r_usage = list_next(r_itr))) {
 			int64_t idle = r_usage->total_time - r_usage->a_cpu;
 			char *assoc = NULL;
 			ListIterator tmp_itr = NULL;
 
-			if(idle <= 0)
+			if (idle <= 0)
 				continue;
 
 			/* now divide that time by the number of
@@ -729,19 +729,19 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 /* 			     r_usage->id, seconds, */
 /* 			     list_count(r_usage->local_assocs)); */
 			tmp_itr = list_iterator_create(r_usage->local_assocs);
-			while((assoc = list_next(tmp_itr))) {
+			while ((assoc = list_next(tmp_itr))) {
 				uint32_t associd = slurm_atoul(assoc);
-				if(last_id != associd) {
+				if (last_id != associd) {
 					list_iterator_reset(a_itr);
-					while((a_usage = list_next(a_itr))) {
-						if(!a_usage->id == associd) {
+					while ((a_usage = list_next(a_itr))) {
+						if (!a_usage->id == associd) {
 							last_id = a_usage->id;
 							break;
 						}
 					}
 				}
 
-				if(!a_usage) {
+				if (!a_usage) {
 					a_usage = xmalloc(
 						sizeof(local_id_usage_t));
 					a_usage->id = associd;
@@ -756,12 +756,12 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 
 		/* Now put the lists into the usage tables */
 		list_iterator_reset(c_itr);
-		while((c_usage = list_next(c_itr))) {
+		while ((c_usage = list_next(c_itr))) {
 			uint64_t total_used = 0;
 
 			/* sanity check to make sure we don't have more
 			   allocated cpus than possible. */
-			if(c_usage->total_time < c_usage->a_cpu) {
+			if (c_usage->total_time < c_usage->a_cpu) {
 				char *start_char = xstrdup(ctime(&curr_start));
 				char *end_char = xstrdup(ctime(&curr_end));
 				start_char[strlen(start_char)-1] = '\0';
@@ -781,7 +781,7 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 
 			/* Make sure the total time we care about
 			   doesn't go over the limit */
-			if(c_usage->total_time < (total_used)) {
+			if (c_usage->total_time < (total_used)) {
 				char *start_char = xstrdup(ctime(&curr_start));
 				char *end_char = xstrdup(ctime(&curr_end));
 				int64_t overtime;
@@ -805,14 +805,14 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 				overtime = (int64_t)(c_usage->total_time -
 						     (c_usage->a_cpu
 						      + c_usage->d_cpu));
-				if(overtime < 0)
+				if (overtime < 0)
 					c_usage->d_cpu += overtime;
 
 				overtime = (int64_t)(c_usage->total_time -
 						     (c_usage->a_cpu
 						      + c_usage->d_cpu
 						      + c_usage->pd_cpu));
-				if(overtime < 0)
+				if (overtime < 0)
 					c_usage->pd_cpu += overtime;
 
 				total_used = c_usage->a_cpu +
@@ -834,13 +834,13 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 			 */
 /* 			info("%s got idle of %lld", c_usage->name,  */
 /* 			     (int64_t)c_usage->i_cpu); */
-			if((int64_t)c_usage->i_cpu < 0) {
+			if ((int64_t)c_usage->i_cpu < 0) {
 /* 				info("got %d %d %d", c_usage->r_cpu, */
 /* 				     c_usage->i_cpu, c_usage->o_cpu); */
 				c_usage->r_cpu += (int64_t)c_usage->i_cpu;
 				c_usage->o_cpu -= (int64_t)c_usage->i_cpu;
 				c_usage->i_cpu = 0;
-				if((int64_t)c_usage->r_cpu < 0)
+				if ((int64_t)c_usage->r_cpu < 0)
 					c_usage->r_cpu = 0;
 			}
 
@@ -856,7 +856,7 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 /* 			     c_usage->total_time, */
 /* 			     ctime(&c_usage->start)); */
 /* 			info("to %s", ctime(&c_usage->end)); */
-			if(query) {
+			if (query) {
 				xstrfmtcat(query,
 					   ", (%ld, %ld, %ld, %d, "
 					   "%"PRIu64", %"PRIu64", %"PRIu64", "
@@ -893,7 +893,7 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 		   all at once in the end proves to be faster.  Just FYI
 		   so we don't go testing again and again.
 		*/
-		if(query) {
+		if (query) {
 			xstrfmtcat(query,
 				   " on duplicate key update "
 				   "mod_time=%ld, cpu_count=VALUES(cpu_count), "
@@ -908,18 +908,18 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 			       mysql_conn->conn, THIS_FILE, __LINE__, query);
 			rc = mysql_db_query(mysql_conn, query);
 			xfree(query);
-			if(rc != SLURM_SUCCESS) {
+			if (rc != SLURM_SUCCESS) {
 				error("Couldn't add cluster hour rollup");
 				goto end_it;
 			}
 		}
 
 		list_iterator_reset(a_itr);
-		while((a_usage = list_next(a_itr))) {
+		while ((a_usage = list_next(a_itr))) {
 /* 			info("association (%d) %d alloc %d", */
 /* 			     a_usage->id, last_id, */
 /* 			     a_usage->a_cpu); */
-			if(query) {
+			if (query) {
 				xstrfmtcat(query,
 					   ", (%ld, %ld, %d, %ld, %"PRIu64")",
 					   now, now,
@@ -938,7 +938,7 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 					   a_usage->a_cpu);
 			}
 		}
-		if(query) {
+		if (query) {
 			xstrfmtcat(query,
 				   " on duplicate key update "
 				   "mod_time=%ld, "
@@ -949,21 +949,21 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 			       mysql_conn->conn, THIS_FILE, __LINE__, query);
 			rc = mysql_db_query(mysql_conn, query);
 			xfree(query);
-			if(rc != SLURM_SUCCESS) {
+			if (rc != SLURM_SUCCESS) {
 				error("Couldn't add assoc hour rollup");
 				goto end_it;
 			}
 		}
 
-		if(!track_wckey)
+		if (!track_wckey)
 			goto end_loop;
 
 		list_iterator_reset(w_itr);
-		while((w_usage = list_next(w_itr))) {
+		while ((w_usage = list_next(w_itr))) {
 /* 			info("association (%d) %d alloc %d", */
 /* 			     w_usage->id, last_id, */
 /* 			     w_usage->a_cpu); */
-			if(query) {
+			if (query) {
 				xstrfmtcat(query,
 					   ", (%ld, %ld, %d, %ld, %"PRIu64")",
 					   now, now,
@@ -982,7 +982,7 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 					   w_usage->a_cpu);
 			}
 		}
-		if(query) {
+		if (query) {
 			xstrfmtcat(query,
 				   " on duplicate key update "
 				   "mod_time=%ld, "
@@ -993,7 +993,7 @@ extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 			       mysql_conn->conn, THIS_FILE, __LINE__, query);
 			rc = mysql_db_query(mysql_conn, query);
 			xfree(query);
-			if(rc != SLURM_SUCCESS) {
+			if (rc != SLURM_SUCCESS) {
 				error("Couldn't add wckey hour rollup");
 				goto end_it;
 			}
@@ -1027,7 +1027,7 @@ end_it:
 
 	/* go check to see if we archive and purge */
 
-	if(rc == SLURM_SUCCESS)
+	if (rc == SLURM_SUCCESS)
 		rc = _process_purge(mysql_conn, cluster_name, archive_data,
 				    SLURMDB_PURGE_HOURS);
 
@@ -1049,7 +1049,7 @@ extern int as_mysql_daily_rollup(mysql_conn_t *mysql_conn,
 	char *query = NULL;
 	uint16_t track_wckey = slurm_get_track_wckey();
 
-	if(!localtime_r(&curr_start, &start_tm)) {
+	if (!localtime_r(&curr_start, &start_tm)) {
 		error("Couldn't get localtime from day start %ld", curr_start);
 		return SLURM_ERROR;
 	}
@@ -1060,7 +1060,7 @@ extern int as_mysql_daily_rollup(mysql_conn_t *mysql_conn,
 	start_tm.tm_isdst = -1;
 	curr_end = mktime(&start_tm);
 
-	while(curr_start < end) {
+	while (curr_start < end) {
 		debug3("curr day is now %ld-%ld", curr_start, curr_end);
 /* 		info("start %s", ctime(&curr_start)); */
 /* 		info("end %s", ctime(&curr_end)); */
@@ -1104,7 +1104,7 @@ extern int as_mysql_daily_rollup(mysql_conn_t *mysql_conn,
 			   now, now, curr_start,
 			   cluster_name, cluster_hour_table,
 			   curr_end, curr_start, now);
-		if(track_wckey) {
+		if (track_wckey) {
 			xstrfmtcat(query,
 				   "insert into \"%s_%s\" (creation_time, "
 				   "mod_time, id_wckey, time_start, "
@@ -1123,13 +1123,13 @@ extern int as_mysql_daily_rollup(mysql_conn_t *mysql_conn,
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't add day rollup");
 			return SLURM_ERROR;
 		}
 
 		curr_start = curr_end;
-		if(!localtime_r(&curr_start, &start_tm)) {
+		if (!localtime_r(&curr_start, &start_tm)) {
 			error("Couldn't get localtime from day start %ld",
 			      curr_start);
 			return SLURM_ERROR;
@@ -1163,7 +1163,7 @@ extern int as_mysql_monthly_rollup(mysql_conn_t *mysql_conn,
 	char *query = NULL;
 	uint16_t track_wckey = slurm_get_track_wckey();
 
-	if(!localtime_r(&curr_start, &start_tm)) {
+	if (!localtime_r(&curr_start, &start_tm)) {
 		error("Couldn't get localtime from month start %ld",
 		      curr_start);
 		return SLURM_ERROR;
@@ -1176,7 +1176,7 @@ extern int as_mysql_monthly_rollup(mysql_conn_t *mysql_conn,
 	start_tm.tm_isdst = -1;
 	curr_end = mktime(&start_tm);
 
-	while(curr_start < end) {
+	while (curr_start < end) {
 		debug3("curr month is now %ld-%ld", curr_start, curr_end);
 /* 		info("start %s", ctime(&curr_start)); */
 /* 		info("end %s", ctime(&curr_end)); */
@@ -1220,7 +1220,7 @@ extern int as_mysql_monthly_rollup(mysql_conn_t *mysql_conn,
 			   now, now, curr_start,
 			   cluster_name, cluster_day_table,
 			   curr_end, curr_start, now);
-		if(track_wckey) {
+		if (track_wckey) {
 			xstrfmtcat(query,
 				   "insert into \"%s_%s\" "
 				   "(creation_time, mod_time, "
@@ -1240,13 +1240,13 @@ extern int as_mysql_monthly_rollup(mysql_conn_t *mysql_conn,
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't add day rollup");
 			return SLURM_ERROR;
 		}
 
 		curr_start = curr_end;
-		if(!localtime_r(&curr_start, &start_tm)) {
+		if (!localtime_r(&curr_start, &start_tm)) {
 			error("Couldn't get localtime from month start %ld",
 			      curr_start);
 		}
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_txn.c b/src/plugins/accounting_storage/mysql/as_mysql_txn.c
index 5c61cdd738c..5e2310c71c0 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_txn.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_txn.c
@@ -40,7 +40,7 @@
 #include "as_mysql_txn.h"
 
 extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
-			  slurmdb_txn_cond_t *txn_cond)
+			     slurmdb_txn_cond_t *txn_cond)
 {
 	char *query = NULL;
 	char *assoc_extra = NULL;
@@ -78,27 +78,27 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 		TXN_REQ_COUNT
 	};
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
-	if(!txn_cond)
+	if (!txn_cond)
 		goto empty;
 
 	/* handle query for associations first */
-	if(txn_cond->acct_list && list_count(txn_cond->acct_list)) {
+	if (txn_cond->acct_list && list_count(txn_cond->acct_list)) {
 		set = 0;
-		if(assoc_extra)
+		if (assoc_extra)
 			xstrcat(assoc_extra, " && (");
 		else
 			xstrcat(assoc_extra, " where (");
 
-		if(name_extra)
+		if (name_extra)
 			xstrcat(name_extra, " && (");
 		else
 			xstrcat(name_extra, " (");
 		itr = list_iterator_create(txn_cond->acct_list);
-		while((object = list_next(itr))) {
-			if(set) {
+		while ((object = list_next(itr))) {
+			if (set) {
 				xstrcat(assoc_extra, " || ");
 				xstrcat(name_extra, " || ");
 			}
@@ -116,16 +116,16 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 		xstrcat(name_extra, ")");
 	}
 
-	if(txn_cond->cluster_list && list_count(txn_cond->cluster_list)) {
+	if (txn_cond->cluster_list && list_count(txn_cond->cluster_list)) {
 		set = 0;
-		if(name_extra)
+		if (name_extra)
 			xstrcat(name_extra, " && (");
 		else
 			xstrcat(name_extra, "(");
 
 		itr = list_iterator_create(txn_cond->cluster_list);
-		while((object = list_next(itr))) {
-			if(set) {
+		while ((object = list_next(itr))) {
+			if (set) {
 				xstrcat(name_extra, " || ");
 			}
 			xstrfmtcat(name_extra, "(cluster='%s' || "
@@ -140,21 +140,21 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 		use_cluster_list = txn_cond->cluster_list;
 	}
 
-	if(txn_cond->user_list && list_count(txn_cond->user_list)) {
+	if (txn_cond->user_list && list_count(txn_cond->user_list)) {
 		set = 0;
-		if(assoc_extra)
+		if (assoc_extra)
 			xstrcat(assoc_extra, " && (");
 		else
 			xstrcat(assoc_extra, " where (");
 
-		if(name_extra)
+		if (name_extra)
 			xstrcat(name_extra, " && (");
 		else
 			xstrcat(name_extra, "(");
 
 		itr = list_iterator_create(txn_cond->user_list);
-		while((object = list_next(itr))) {
-			if(set) {
+		while ((object = list_next(itr))) {
+			if (set) {
 				xstrcat(assoc_extra, " || ");
 				xstrcat(name_extra, " || ");
 			}
@@ -172,27 +172,27 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 		xstrcat(name_extra, ")");
 	}
 
-	if(assoc_extra) {
-		if(!locked && (use_cluster_list == as_mysql_cluster_list)) {
+	if (assoc_extra) {
+		if (!locked && (use_cluster_list == as_mysql_cluster_list)) {
 			slurm_mutex_lock(&as_mysql_cluster_list_lock);
 			locked = 1;
 		}
 
 		itr = list_iterator_create(use_cluster_list);
-		while((object = list_next(itr))) {
+		while ((object = list_next(itr))) {
 			xstrfmtcat(query, "select id_assoc from \"%s_%s\"%s",
 				   object, assoc_table, assoc_extra);
 			debug3("%d(%s:%d) query\n%s",
 			       mysql_conn->conn, THIS_FILE, __LINE__, query);
-			if(!(result = mysql_db_query_ret(
-				     mysql_conn, query, 0))) {
+			if (!(result = mysql_db_query_ret(
+				      mysql_conn, query, 0))) {
 				xfree(query);
 				break;
 			}
 			xfree(query);
 
-			if(mysql_num_rows(result)) {
-				if(extra)
+			if (mysql_num_rows(result)) {
+				if (extra)
 					xstrfmtcat(extra,
 						   " || (cluster='%s' && (",
 						   object);
@@ -203,8 +203,8 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 
 				set = 0;
 
-				while((row = mysql_fetch_row(result))) {
-					if(set)
+				while ((row = mysql_fetch_row(result))) {
+					if (set)
 						xstrcat(extra, " || ");
 
 					xstrfmtcat(extra,
@@ -224,8 +224,8 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 		xfree(assoc_extra);
 	}
 
-	if(name_extra) {
-		if(extra)
+	if (name_extra) {
+		if (extra)
 			xstrfmtcat(extra, " && (%s)", name_extra);
 		else
 			xstrfmtcat(extra, " where (%s)", name_extra);
@@ -233,15 +233,15 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 	}
 	/*******************************************/
 
-	if(txn_cond->action_list && list_count(txn_cond->action_list)) {
+	if (txn_cond->action_list && list_count(txn_cond->action_list)) {
 		set = 0;
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
 		itr = list_iterator_create(txn_cond->action_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "action='%s'", object);
 			set = 1;
@@ -250,15 +250,15 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(txn_cond->actor_list && list_count(txn_cond->actor_list)) {
+	if (txn_cond->actor_list && list_count(txn_cond->actor_list)) {
 		set = 0;
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
 		itr = list_iterator_create(txn_cond->actor_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "actor='%s'", object);
 			set = 1;
@@ -267,14 +267,14 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(txn_cond->id_list && list_count(txn_cond->id_list)) {
+	if (txn_cond->id_list && list_count(txn_cond->id_list)) {
 		set = 0;
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
 		itr = list_iterator_create(txn_cond->id_list);
-		while((object = list_next(itr))) {
+		while ((object = list_next(itr))) {
 			char *ptr = NULL;
 			long num = strtol(object, &ptr, 10);
 			if ((num == 0) && ptr && ptr[0]) {
@@ -285,7 +285,7 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 				goto end_it;
 			}
 
-			if(set)
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "id=%s", object);
 			set = 1;
@@ -294,15 +294,15 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(txn_cond->info_list && list_count(txn_cond->info_list)) {
+	if (txn_cond->info_list && list_count(txn_cond->info_list)) {
 		set = 0;
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
 		itr = list_iterator_create(txn_cond->info_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "info like '%%%s%%'", object);
 			set = 1;
@@ -311,15 +311,15 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(txn_cond->name_list && list_count(txn_cond->name_list)) {
+	if (txn_cond->name_list && list_count(txn_cond->name_list)) {
 		set = 0;
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
 		itr = list_iterator_create(txn_cond->name_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "name like '%%%s%%'", object);
 			set = 1;
@@ -328,22 +328,22 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(txn_cond->time_start && txn_cond->time_end) {
-		if(extra)
+	if (txn_cond->time_start && txn_cond->time_end) {
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
 		xstrfmtcat(extra, "timestamp < %ld && timestamp >= %ld)",
 			   txn_cond->time_end, txn_cond->time_start);
-	} else if(txn_cond->time_start) {
-		if(extra)
+	} else if (txn_cond->time_start) {
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
 		xstrfmtcat(extra, "timestamp >= %ld)", txn_cond->time_start);
 
-	} else if(txn_cond->time_end) {
-		if(extra)
+	} else if (txn_cond->time_end) {
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, " where (");
@@ -353,12 +353,12 @@ extern List as_mysql_get_txn(mysql_conn_t *mysql_conn, uid_t uid,
 	/* make sure we can get the max length out of the database
 	 * when grouping the names
 	 */
-	if(txn_cond->with_assoc_info)
+	if (txn_cond->with_assoc_info)
 		mysql_db_query(mysql_conn,
 			       "set session group_concat_max_len=65536;");
 
 empty:
-	if(!locked && (use_cluster_list == as_mysql_cluster_list)) {
+	if (!locked && (use_cluster_list == as_mysql_cluster_list)) {
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 		locked = 1;
 	}
@@ -371,7 +371,7 @@ empty:
 
 	query = xstrdup_printf("select %s from %s", tmp, txn_table);
 
-	if(extra) {
+	if (extra) {
 		xstrfmtcat(query, "%s", extra);
 		xfree(extra);
 	}
@@ -381,8 +381,8 @@ empty:
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		goto end_it;
 	}
@@ -390,7 +390,7 @@ empty:
 
 	txn_list = list_create(slurmdb_destroy_txn_rec);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_txn_rec_t *txn = xmalloc(sizeof(slurmdb_txn_rec_t));
 
 		list_append(txn_list, txn);
@@ -403,32 +403,35 @@ empty:
 		txn->where_query = xstrdup(row[TXN_REQ_NAME]);
 		txn->clusters = xstrdup(row[TXN_REQ_CLUSTER]);
 
-		if(txn_cond && txn_cond->with_assoc_info
-		   && (txn->action == DBD_ADD_ASSOCS
-		       || txn->action == DBD_MODIFY_ASSOCS
-		       || txn->action == DBD_REMOVE_ASSOCS)) {
+		if (txn_cond && txn_cond->with_assoc_info
+		    && (txn->action == DBD_ADD_ASSOCS
+			|| txn->action == DBD_MODIFY_ASSOCS
+			|| txn->action == DBD_REMOVE_ASSOCS)) {
 			MYSQL_RES *result2 = NULL;
 			MYSQL_ROW row2;
-			if(txn->clusters) {
+			if (txn->clusters) {
 				query = xstrdup_printf(
-				"select "
-				"group_concat(distinct user order by user), "
-				"group_concat(distinct acct order by acct) "
-				"from \"%s_%s\" where %s",
-				txn->clusters, assoc_table, row[TXN_REQ_NAME]);
+					"select "
+					"group_concat(distinct user "
+					"order by user), "
+					"group_concat(distinct acct "
+					"order by acct) "
+					"from \"%s_%s\" where %s",
+					txn->clusters, assoc_table,
+					row[TXN_REQ_NAME]);
 				debug4("%d(%s:%d) query\n%s", mysql_conn->conn,
 				       THIS_FILE, __LINE__, query);
-				if(!(result2 = mysql_db_query_ret(
-					     mysql_conn, query, 0))) {
+				if (!(result2 = mysql_db_query_ret(
+					      mysql_conn, query, 0))) {
 					xfree(query);
 					continue;
 				}
 				xfree(query);
 
-				if((row2 = mysql_fetch_row(result2))) {
-					if(row2[0] && row2[0][0])
+				if ((row2 = mysql_fetch_row(result2))) {
+					if (row2[0] && row2[0][0])
 						txn->users = xstrdup(row2[0]);
-					if(row2[1] && row2[1][0])
+					if (row2[1] && row2[1][0])
 						txn->accts = xstrdup(row2[1]);
 				}
 				mysql_free_result(result2);
@@ -442,7 +445,7 @@ empty:
 	mysql_free_result(result);
 
 end_it:
-	if(locked)
+	if (locked)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
 	return txn_list;
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_usage.c b/src/plugins/accounting_storage/mysql/as_mysql_usage.c
index 39e604dd6d6..d17c233d49b 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_usage.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_usage.c
@@ -103,10 +103,10 @@ static void *_cluster_rollup_usage(void *arg)
 	 * sent from the parent thread. */
 	rc = check_connection(&mysql_conn);
 
-	if(rc != SLURM_SUCCESS)
+	if (rc != SLURM_SUCCESS)
 		goto end_it;
 
-	if(!local_rollup->sent_start) {
+	if (!local_rollup->sent_start) {
 		char *tmp = NULL;
 		int i=0;
 		xstrfmtcat(tmp, "%s", update_req_inx[i]);
@@ -120,7 +120,7 @@ static void *_cluster_rollup_usage(void *arg)
 
 		debug4("%d(%s:%d) query\n%s", mysql_conn.conn,
 		       THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(&mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(&mysql_conn, query, 0))) {
 			xfree(query);
 			rc = SLURM_ERROR;
 			goto end_it;
@@ -128,7 +128,7 @@ static void *_cluster_rollup_usage(void *arg)
 
 		xfree(query);
 		row = mysql_fetch_row(result);
-		if(row) {
+		if (row) {
 			last_hour = slurm_atoul(row[UPDATE_HOUR]);
 			last_day = slurm_atoul(row[UPDATE_DAY]);
 			last_month = slurm_atoul(row[UPDATE_MONTH]);
@@ -146,16 +146,16 @@ static void *_cluster_rollup_usage(void *arg)
 				local_rollup->cluster_name, event_table);
 			debug3("%d(%s:%d) query\n%s", mysql_conn.conn,
 			       THIS_FILE, __LINE__, query);
-			if(!(result = mysql_db_query_ret(
-				     &mysql_conn, query, 0))) {
+			if (!(result = mysql_db_query_ret(
+				      &mysql_conn, query, 0))) {
 				xfree(query);
 				rc = SLURM_ERROR;
 				goto end_it;
 			}
 			xfree(query);
-			if((row = mysql_fetch_row(result))) {
+			if ((row = mysql_fetch_row(result))) {
 				time_t check = slurm_atoul(row[0]);
-				if(check < lowest)
+				if (check < lowest)
 					lowest = check;
 			}
 			mysql_free_result(result);
@@ -176,12 +176,12 @@ static void *_cluster_rollup_usage(void *arg)
 			       THIS_FILE, __LINE__, query);
 			rc = mysql_db_query(&mysql_conn, query);
 			xfree(query);
-			if(rc != SLURM_SUCCESS) {
+			if (rc != SLURM_SUCCESS) {
 				rc = SLURM_ERROR;
 				goto end_it;
 			}
 
-			if(lowest == now) {
+			if (lowest == now) {
 				debug("Cluster %s not registered, "
 				      "not doing rollup",
 				      local_rollup->cluster_name);
@@ -193,7 +193,7 @@ static void *_cluster_rollup_usage(void *arg)
 		}
 	}
 
-	if(!my_time)
+	if (!my_time)
 		my_time = time(NULL);
 
 	/* test month gap */
@@ -212,13 +212,13 @@ static void *_cluster_rollup_usage(void *arg)
 //	last_day = 1197033199;
 //	last_month = 1204358399;
 
-	if(!localtime_r(&last_hour, &start_tm)) {
+	if (!localtime_r(&last_hour, &start_tm)) {
 		error("Couldn't get localtime from hour start %ld", last_hour);
 		rc = SLURM_ERROR;
 		goto end_it;
 	}
 
-	if(!localtime_r(&my_time, &end_tm)) {
+	if (!localtime_r(&my_time, &end_tm)) {
 		error("Couldn't get localtime from hour end %ld", my_time);
 		rc = SLURM_ERROR;
 		goto end_it;
@@ -249,7 +249,7 @@ static void *_cluster_rollup_usage(void *arg)
 	slurm_mutex_unlock(&rollup_lock);
 
 	/* set up the day period */
-	if(!localtime_r(&last_day, &start_tm)) {
+	if (!localtime_r(&last_day, &start_tm)) {
 		error("Couldn't get localtime from day %ld", last_day);
 		rc = SLURM_ERROR;
 		goto end_it;
@@ -270,7 +270,7 @@ static void *_cluster_rollup_usage(void *arg)
 /* 	info("diff is %d", day_end-day_start); */
 
 	/* set up the month period */
-	if(!localtime_r(&last_month, &start_tm)) {
+	if (!localtime_r(&last_month, &start_tm)) {
 		error("Couldn't get localtime from month %ld", last_month);
 		rc = SLURM_ERROR;
 		goto end_it;
@@ -294,7 +294,7 @@ static void *_cluster_rollup_usage(void *arg)
 /* 	info("month end %s", ctime(&month_end)); */
 /* 	info("diff is %d", month_end-month_start); */
 
-	if((hour_end - hour_start) > 0) {
+	if ((hour_end - hour_start) > 0) {
 		START_TIMER;
 		rc = as_mysql_hourly_rollup(&mysql_conn,
 					    local_rollup->cluster_name,
@@ -304,11 +304,11 @@ static void *_cluster_rollup_usage(void *arg)
 		snprintf(timer_str, sizeof(timer_str),
 			 "hourly_rollup for %s", local_rollup->cluster_name);
 		END_TIMER3(timer_str, 5000000);
-		if(rc != SLURM_SUCCESS)
+		if (rc != SLURM_SUCCESS)
 			goto end_it;
 	}
 
-	if((day_end - day_start) > 0) {
+	if ((day_end - day_start) > 0) {
 		START_TIMER;
 		rc = as_mysql_daily_rollup(&mysql_conn,
 					   local_rollup->cluster_name,
@@ -318,11 +318,11 @@ static void *_cluster_rollup_usage(void *arg)
 		snprintf(timer_str, sizeof(timer_str),
 			 "daily_rollup for %s", local_rollup->cluster_name);
 		END_TIMER3(timer_str, 5000000);
-		if(rc != SLURM_SUCCESS)
+		if (rc != SLURM_SUCCESS)
 			goto end_it;
 	}
 
-	if((month_end - month_start) > 0) {
+	if ((month_end - month_start) > 0) {
 		START_TIMER;
 		rc = as_mysql_monthly_rollup(&mysql_conn,
 					     local_rollup->cluster_name,
@@ -332,13 +332,13 @@ static void *_cluster_rollup_usage(void *arg)
 		snprintf(timer_str, sizeof(timer_str),
 			 "monthly_rollup for %s", local_rollup->cluster_name);
 		END_TIMER3(timer_str, 5000000);
-		if(rc != SLURM_SUCCESS)
+		if (rc != SLURM_SUCCESS)
 			goto end_it;
 	}
 
-	if((hour_end - hour_start) > 0) {
+	if ((hour_end - hour_start) > 0) {
 		/* If we have a sent_end do not update the last_run_table */
-		if(!local_rollup->sent_end)
+		if (!local_rollup->sent_end)
 			query = xstrdup_printf(
 				"update \"%s_%s\" set hourly_rollup=%ld",
 				local_rollup->cluster_name,
@@ -347,10 +347,10 @@ static void *_cluster_rollup_usage(void *arg)
 		debug2("No need to roll cluster %s this hour %ld <= %ld",
 		       local_rollup->cluster_name, hour_end, hour_start);
 
-	if((day_end - day_start) > 0) {
-		if(query && !local_rollup->sent_end)
+	if ((day_end - day_start) > 0) {
+		if (query && !local_rollup->sent_end)
 			xstrfmtcat(query, ", daily_rollup=%ld", day_end);
-		else if(!local_rollup->sent_end)
+		else if (!local_rollup->sent_end)
 			query = xstrdup_printf(
 				"update \"%s_%s\" set daily_rollup=%ld",
 				local_rollup->cluster_name,
@@ -359,10 +359,10 @@ static void *_cluster_rollup_usage(void *arg)
 		debug2("No need to roll cluster %s this day %ld <= %ld",
 		       local_rollup->cluster_name, day_end, day_start);
 
-	if((month_end - month_start) > 0) {
-		if(query && !local_rollup->sent_end)
+	if ((month_end - month_start) > 0) {
+		if (query && !local_rollup->sent_end)
 			xstrfmtcat(query, ", monthly_rollup=%ld", month_end);
-		else if(!local_rollup->sent_end)
+		else if (!local_rollup->sent_end)
 			query = xstrdup_printf(
 				"update \"%s_%s\" set monthly_rollup=%ld",
 				local_rollup->cluster_name,
@@ -371,22 +371,22 @@ static void *_cluster_rollup_usage(void *arg)
 		debug2("No need to roll cluster %s this month %ld <= %ld",
 		       local_rollup->cluster_name, month_end, month_start);
 
-	if(query) {
+	if (query) {
 		debug3("%d(%s:%d) query\n%s",
 		       mysql_conn.conn, THIS_FILE, __LINE__, query);
 		rc = mysql_db_query(&mysql_conn, query);
 		xfree(query);
 	}
 end_it:
-	if(rc == SLURM_SUCCESS) {
-		if(mysql_db_commit(&mysql_conn)) {
+	if (rc == SLURM_SUCCESS) {
+		if (mysql_db_commit(&mysql_conn)) {
 			error("Couldn't commit rollup of cluster %s",
 			      local_rollup->cluster_name);
 			rc = SLURM_ERROR;
 		}
 	} else {
 		error("Cluster %s rollup failed", local_rollup->cluster_name);
-		if(mysql_db_rollback(&mysql_conn))
+		if (mysql_db_rollback(&mysql_conn))
 			error("rollback failed");
 	}
 
@@ -395,7 +395,7 @@ end_it:
 
 	slurm_mutex_lock(local_rollup->rolledup_lock);
 	(*local_rollup->rolledup)++;
-	if((rc != SLURM_SUCCESS) && ((*local_rollup->rc) == SLURM_SUCCESS))
+	if ((rc != SLURM_SUCCESS) && ((*local_rollup->rc) == SLURM_SUCCESS))
 		(*local_rollup->rc) = rc;
 	pthread_cond_signal(local_rollup->rolledup_cond);
 	slurm_mutex_unlock(local_rollup->rolledup_lock);
@@ -440,13 +440,13 @@ static int _get_cluster_usage(mysql_conn_t *mysql_conn, uid_t uid,
 		CLUSTER_COUNT
 	};
 
-	if(!cluster_rec->name || !cluster_rec->name[0]) {
+	if (!cluster_rec->name || !cluster_rec->name[0]) {
 		error("We need a cluster name to set data for");
 		return SLURM_ERROR;
 	}
 
-	if(set_usage_information(&my_usage_table, type, &start, &end)
-	   != SLURM_SUCCESS) {
+	if (set_usage_information(&my_usage_table, type, &start, &end)
+	    != SLURM_SUCCESS) {
 		return SLURM_ERROR;
 	}
 
@@ -465,18 +465,18 @@ static int _get_cluster_usage(mysql_conn_t *mysql_conn, uid_t uid,
 	xfree(tmp);
 	debug4("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(!cluster_rec->accounting_list)
+	if (!cluster_rec->accounting_list)
 		cluster_rec->accounting_list =
 			list_create(slurmdb_destroy_cluster_accounting_rec);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_cluster_accounting_rec_t *accounting_rec =
 			xmalloc(sizeof(slurmdb_cluster_accounting_rec_t));
 		accounting_rec->alloc_secs = slurm_atoull(row[CLUSTER_ACPU]);
@@ -530,12 +530,12 @@ extern int get_usage_for_list(mysql_conn_t *mysql_conn,
 	};
 
 
-	if(!object_list) {
+	if (!object_list) {
 		error("We need an object to set data for getting usage");
 		return SLURM_ERROR;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	switch (type) {
@@ -549,8 +549,8 @@ extern int get_usage_for_list(mysql_conn_t *mysql_conn,
 		usage_req_inx = temp_usage;
 
 		itr = list_iterator_create(object_list);
-		while((assoc = list_next(itr))) {
-			if(id_str)
+		while ((assoc = list_next(itr))) {
+			if (id_str)
 				xstrfmtcat(id_str, " || t3.id_assoc=%d",
 					   assoc->id);
 			else
@@ -571,8 +571,8 @@ extern int get_usage_for_list(mysql_conn_t *mysql_conn,
 		usage_req_inx = temp_usage;
 
 		itr = list_iterator_create(object_list);
-		while((wckey = list_next(itr))) {
-			if(id_str)
+		while ((wckey = list_next(itr))) {
+			if (id_str)
 				xstrfmtcat(id_str, " || id_wckey=%d",
 					   wckey->id);
 			else
@@ -589,8 +589,8 @@ extern int get_usage_for_list(mysql_conn_t *mysql_conn,
 		break;
 	}
 
-	if(set_usage_information(&my_usage_table, type, &start, &end)
-	   != SLURM_SUCCESS) {
+	if (set_usage_information(&my_usage_table, type, &start, &end)
+	    != SLURM_SUCCESS) {
 		xfree(id_str);
 		return SLURM_ERROR;
 	}
@@ -633,8 +633,8 @@ extern int get_usage_for_list(mysql_conn_t *mysql_conn,
 
 	debug4("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
@@ -642,7 +642,7 @@ extern int get_usage_for_list(mysql_conn_t *mysql_conn,
 
 	usage_list = list_create(slurmdb_destroy_accounting_rec);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_accounting_rec_t *accounting_rec =
 			xmalloc(sizeof(slurmdb_accounting_rec_t));
 		accounting_rec->id = slurm_atoul(row[USAGE_ID]);
@@ -654,7 +654,7 @@ extern int get_usage_for_list(mysql_conn_t *mysql_conn,
 
 	u_itr = list_iterator_create(usage_list);
 	itr = list_iterator_create(object_list);
-	while((object = list_next(itr))) {
+	while ((object = list_next(itr))) {
 		int found = 0;
 		int id = 0;
 		List acct_list = NULL;
@@ -662,7 +662,7 @@ extern int get_usage_for_list(mysql_conn_t *mysql_conn,
 		switch (type) {
 		case DBD_GET_ASSOC_USAGE:
 			assoc = (slurmdb_association_rec_t *)object;
-			if(!assoc->accounting_list)
+			if (!assoc->accounting_list)
 				assoc->accounting_list = list_create(
 					slurmdb_destroy_accounting_rec);
 			acct_list = assoc->accounting_list;
@@ -670,7 +670,7 @@ extern int get_usage_for_list(mysql_conn_t *mysql_conn,
 			break;
 		case DBD_GET_WCKEY_USAGE:
 			wckey = (slurmdb_wckey_rec_t *)object;
-			if(!wckey->accounting_list)
+			if (!wckey->accounting_list)
 				wckey->accounting_list = list_create(
 					slurmdb_destroy_accounting_rec);
 			acct_list = wckey->accounting_list;
@@ -681,12 +681,12 @@ extern int get_usage_for_list(mysql_conn_t *mysql_conn,
 			break;
 		}
 
-		while((accounting_rec = list_next(u_itr))) {
-			if(id == accounting_rec->id) {
+		while ((accounting_rec = list_next(u_itr))) {
+			if (id == accounting_rec->id) {
 				list_append(acct_list, accounting_rec);
 				list_remove(u_itr);
 				found = 1;
-			} else if(found) {
+			} else if (found) {
 				/* here we know the
 				   list is in id order so
 				   if the next record
@@ -705,7 +705,7 @@ extern int get_usage_for_list(mysql_conn_t *mysql_conn,
 	list_iterator_destroy(itr);
 	list_iterator_destroy(u_itr);
 
-	if(list_count(usage_list))
+	if (list_count(usage_list))
 		error("we have %d records not added "
 		      "to the association list",
 		      list_count(usage_list));
@@ -788,15 +788,15 @@ extern int as_mysql_get_usage(mysql_conn_t *mysql_conn, uid_t uid,
 		break;
 	}
 
-	if(!id) {
+	if (!id) {
 		error("We need an id to set data for getting usage");
 		return SLURM_ERROR;
-	} else if(!cluster_name) {
+	} else if (!cluster_name) {
 		error("We need a cluster_name to set data for getting usage");
 		return SLURM_ERROR;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	memset(&user, 0, sizeof(slurmdb_user_rec_t));
@@ -804,18 +804,18 @@ extern int as_mysql_get_usage(mysql_conn_t *mysql_conn, uid_t uid,
 
 	private_data = slurm_get_private_data();
 	if (private_data & PRIVATE_DATA_USAGE) {
-		if(!(is_admin = is_user_min_admin_level(
-			     mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
+		if (!(is_admin = is_user_min_admin_level(
+			      mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
 			ListIterator itr = NULL;
 			slurmdb_coord_rec_t *coord = NULL;
 
-			if(username && !strcmp(slurmdb_assoc->user, user.name))
+			if (username && !strcmp(slurmdb_assoc->user, user.name))
 				goto is_user;
 
-			if(type != DBD_GET_ASSOC_USAGE)
+			if (type != DBD_GET_ASSOC_USAGE)
 				goto bad_user;
 
-			if(!slurmdb_assoc->acct) {
+			if (!slurmdb_assoc->acct) {
 				debug("No account name given "
 				      "in association.");
 				goto bad_user;
@@ -830,13 +830,13 @@ extern int as_mysql_get_usage(mysql_conn_t *mysql_conn, uid_t uid,
 			   is_user_any_coord.
 			*/
 			itr = list_iterator_create(user.coord_accts);
-			while((coord = list_next(itr)))
-				if(!strcasecmp(coord->name,
-					       slurmdb_assoc->acct))
+			while ((coord = list_next(itr)))
+				if (!strcasecmp(coord->name,
+						slurmdb_assoc->acct))
 					break;
 			list_iterator_destroy(itr);
 
-			if(coord)
+			if (coord)
 				goto is_user;
 
 		bad_user:
@@ -846,8 +846,8 @@ extern int as_mysql_get_usage(mysql_conn_t *mysql_conn, uid_t uid,
 	}
 is_user:
 
-	if(set_usage_information(&my_usage_table, type, &start, &end)
-	   != SLURM_SUCCESS) {
+	if (set_usage_information(&my_usage_table, type, &start, &end)
+	    != SLURM_SUCCESS) {
 		return SLURM_ERROR;
 	}
 
@@ -886,17 +886,17 @@ is_user:
 	xfree(tmp);
 	debug4("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(!(*my_list))
+	if (!(*my_list))
 		(*my_list) = list_create(slurmdb_destroy_accounting_rec);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_accounting_rec_t *accounting_rec =
 			xmalloc(sizeof(slurmdb_accounting_rec_t));
 		accounting_rec->id = slurm_atoul(row[USAGE_ID]);
@@ -921,7 +921,7 @@ extern int as_mysql_roll_usage(mysql_conn_t *mysql_conn,
 	pthread_cond_t rolledup_cond;
 	//DEF_TIMERS;
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	slurm_mutex_lock(&usage_rollup_lock);
@@ -932,7 +932,7 @@ extern int as_mysql_roll_usage(mysql_conn_t *mysql_conn,
 	//START_TIMER;
 	slurm_mutex_lock(&as_mysql_cluster_list_lock);
 	itr = list_iterator_create(as_mysql_cluster_list);
-	while((cluster_name = list_next(itr))) {
+	while ((cluster_name = list_next(itr))) {
 		/* pthread_t rollup_tid; */
 		/* pthread_attr_t rollup_attr; */
 		local_rollup_t *local_rollup = xmalloc(sizeof(local_rollup_t));
@@ -969,7 +969,7 @@ extern int as_mysql_roll_usage(mysql_conn_t *mysql_conn,
 	list_iterator_destroy(itr);
 	slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
-	while(rolledup < list_count(as_mysql_cluster_list)) {
+	while (rolledup < list_count(as_mysql_cluster_list)) {
 		pthread_cond_wait(&rolledup_cond, &rolledup_lock);
 		debug2("Got %d rolled up", rolledup);
 	}
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_user.c b/src/plugins/accounting_storage/mysql/as_mysql_user.c
index 356446ed564..afb4d18c00d 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_user.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_user.c
@@ -53,7 +53,7 @@ static int _change_user_name(mysql_conn_t *mysql_conn, slurmdb_user_rec_t *user)
 
 	slurm_mutex_lock(&as_mysql_cluster_list_lock);
 	itr = list_iterator_create(as_mysql_cluster_list);
-	while((cluster_name = list_next(itr))) {
+	while ((cluster_name = list_next(itr))) {
 		// Change assoc_tables
 		xstrfmtcat(query, "update \"%s_%s\" set user='%s' "
 			   "where user='%s';", cluster_name, assoc_table,
@@ -74,7 +74,7 @@ static int _change_user_name(mysql_conn_t *mysql_conn, slurmdb_user_rec_t *user)
 	rc = mysql_db_query(mysql_conn, query);
 	xfree(query);
 
-	if(rc != SLURM_SUCCESS)
+	if (rc != SLURM_SUCCESS)
 		reset_mysql_conn(mysql_conn);
 
 	return rc;
@@ -99,10 +99,10 @@ static List _get_other_user_names_to_mod(mysql_conn_t *mysql_conn, uint32_t uid,
 	memset(&assoc_cond, 0, sizeof(slurmdb_association_cond_t));
 	assoc_cond.acct_list = user_cond->def_acct_list;
 	if (user_cond->assoc_cond) {
-		if(user_cond->assoc_cond->cluster_list)
+		if (user_cond->assoc_cond->cluster_list)
 			assoc_cond.cluster_list =
 				user_cond->assoc_cond->cluster_list;
-		if(user_cond->assoc_cond->user_list)
+		if (user_cond->assoc_cond->user_list)
 			assoc_cond.user_list = user_cond->assoc_cond->user_list;
 	}
 	assoc_cond.only_defs = 1;
@@ -127,10 +127,10 @@ no_assocs:
 
 	memset(&wckey_cond, 0, sizeof(slurmdb_wckey_cond_t));
 	if (user_cond->assoc_cond) {
-		if(user_cond->assoc_cond->cluster_list)
+		if (user_cond->assoc_cond->cluster_list)
 			wckey_cond.cluster_list =
 				user_cond->assoc_cond->cluster_list;
-		if(user_cond->assoc_cond->user_list)
+		if (user_cond->assoc_cond->user_list)
 			wckey_cond.user_list = user_cond->assoc_cond->user_list;
 	}
 	wckey_cond.name_list = user_cond->def_wckey_list;
@@ -166,26 +166,26 @@ static int _get_user_coords(mysql_conn_t *mysql_conn, slurmdb_user_rec_t *user)
 	ListIterator itr = NULL, itr2 = NULL;
 	char *cluster_name = NULL;
 
-	if(!user) {
+	if (!user) {
 		error("We need a user to fill in.");
 		return SLURM_ERROR;
 	}
 
-	if(!user->coord_accts)
+	if (!user->coord_accts)
 		user->coord_accts = list_create(slurmdb_destroy_coord_rec);
 
 	query = xstrdup_printf(
 		"select acct from %s where user='%s' && deleted=0",
 		acct_coord_table, user->name);
 
-	if(!(result =
-	     mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result =
+	      mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 	xfree(query);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		coord = xmalloc(sizeof(slurmdb_coord_rec_t));
 		list_append(user->coord_accts, coord);
 		coord->name = xstrdup(row[0]);
@@ -193,19 +193,19 @@ static int _get_user_coords(mysql_conn_t *mysql_conn, slurmdb_user_rec_t *user)
 	}
 	mysql_free_result(result);
 
-	if(!list_count(user->coord_accts))
+	if (!list_count(user->coord_accts))
 		return SLURM_SUCCESS;
 
 	slurm_mutex_lock(&as_mysql_cluster_list_lock);
 	itr2 = list_iterator_create(as_mysql_cluster_list);
 	itr = list_iterator_create(user->coord_accts);
-	while((cluster_name = list_next(itr2))) {
+	while ((cluster_name = list_next(itr2))) {
 		int set = 0;
-		if(query)
+		if (query)
 			xstrcat(query, " union ");
 
-		while((coord = list_next(itr))) {
-			if(set)
+		while ((coord = list_next(itr))) {
+			if (set)
 				xstrcat(query, " || ");
 			else
 				xstrfmtcat(query,
@@ -230,24 +230,24 @@ static int _get_user_coords(mysql_conn_t *mysql_conn, slurmdb_user_rec_t *user)
 	list_iterator_destroy(itr2);
 	slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
-	if(query) {
+	if (query) {
 		debug4("%d(%s:%d) query\n%s",
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
-		if(!(result = mysql_db_query_ret(
-			     mysql_conn, query, 0))) {
+		if (!(result = mysql_db_query_ret(
+			      mysql_conn, query, 0))) {
 			xfree(query);
 			return SLURM_ERROR;
 		}
 		xfree(query);
 
-		while((row = mysql_fetch_row(result))) {
+		while ((row = mysql_fetch_row(result))) {
 			list_iterator_reset(itr);
-			while((coord = list_next(itr))) {
-				if(!strcmp(coord->name, row[0]))
+			while ((coord = list_next(itr))) {
+				if (!strcmp(coord->name, row[0]))
 					break;
 			}
 
-			if(coord)
+			if (coord)
 				continue;
 
 			coord = xmalloc(sizeof(slurmdb_coord_rec_t));
@@ -276,13 +276,13 @@ extern int as_mysql_add_users(mysql_conn_t *mysql_conn, uint32_t uid,
 	List assoc_list = list_create(slurmdb_destroy_association_rec);
 	List wckey_list = list_create(slurmdb_destroy_wckey_rec);
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	user_name = uid_to_string((uid_t) uid);
 	itr = list_iterator_create(user_list);
-	while((object = list_next(itr))) {
-		if(!object->name || !object->name[0]) {
+	while ((object = list_next(itr))) {
+		if (!object->name || !object->name[0]) {
 			error("We need a user name and "
 			      "default acct to add.");
 			rc = SLURM_ERROR;
@@ -292,7 +292,7 @@ extern int as_mysql_add_users(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrfmtcat(vals, "%ld, %ld, '%s'",
 			   (long)now, (long)now, object->name);
 
-		if(object->admin_level != SLURMDB_ADMIN_NOTSET) {
+		if (object->admin_level != SLURMDB_ADMIN_NOTSET) {
 			xstrcat(cols, ", admin_level");
 			xstrfmtcat(vals, ", %u", object->admin_level);
 			xstrfmtcat(extra, ", admin_level=%u",
@@ -311,27 +311,27 @@ extern int as_mysql_add_users(mysql_conn_t *mysql_conn, uint32_t uid,
 
 		rc = mysql_db_query(mysql_conn, query);
 		xfree(query);
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't add user %s", object->name);
 			xfree(extra);
 			continue;
 		}
 
 		affect_rows = last_affected_rows(mysql_conn);
-		if(!affect_rows) {
+		if (!affect_rows) {
 			debug("nothing changed");
 			xfree(extra);
 			continue;
 		}
 
-		if(addto_update_list(mysql_conn->update_list, SLURMDB_ADD_USER,
-				     object) == SLURM_SUCCESS)
+		if (addto_update_list(mysql_conn->update_list, SLURMDB_ADD_USER,
+				      object) == SLURM_SUCCESS)
 			list_remove(itr);
 
 		/* we always have a ', ' as the first 2 chars */
 		tmp_extra = slurm_add_slash_to_quotes(extra+2);
 
-		if(txn_query)
+		if (txn_query)
 			xstrfmtcat(txn_query,
 				   ", (%ld, %u, '%s', '%s', '%s')",
 				   (long)now, DBD_ADD_USERS, object->name,
@@ -391,13 +391,13 @@ extern int as_mysql_add_users(mysql_conn_t *mysql_conn, uint32_t uid,
 	list_iterator_destroy(itr);
 	xfree(user_name);
 
-	if(rc != SLURM_ERROR) {
-		if(txn_query) {
+	if (rc != SLURM_ERROR) {
+		if (txn_query) {
 			xstrcat(txn_query, ";");
 			rc = mysql_db_query(mysql_conn,
 					    txn_query);
 			xfree(txn_query);
-			if(rc != SLURM_SUCCESS) {
+			if (rc != SLURM_SUCCESS) {
 				error("Couldn't add txn");
 				rc = SLURM_SUCCESS;
 			}
@@ -405,18 +405,18 @@ extern int as_mysql_add_users(mysql_conn_t *mysql_conn, uint32_t uid,
 	} else
 		xfree(txn_query);
 
-	if(list_count(assoc_list)) {
-		if(as_mysql_add_assocs(mysql_conn, uid, assoc_list)
-		   == SLURM_ERROR) {
+	if (list_count(assoc_list)) {
+		if (as_mysql_add_assocs(mysql_conn, uid, assoc_list)
+		    == SLURM_ERROR) {
 			error("Problem adding user associations");
 			rc = SLURM_ERROR;
 		}
 	}
 	list_destroy(assoc_list);
 
-	if(list_count(wckey_list)) {
-		if(as_mysql_add_wckeys(mysql_conn, uid, wckey_list)
-		   == SLURM_ERROR) {
+	if (list_count(wckey_list)) {
+		if (as_mysql_add_wckeys(mysql_conn, uid, wckey_list)
+		    == SLURM_ERROR) {
 			error("Problem adding user wckeys");
 			rc = SLURM_ERROR;
 		}
@@ -435,27 +435,27 @@ extern int as_mysql_add_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 	int rc = SLURM_SUCCESS;
 	slurmdb_user_rec_t *user_rec = NULL;
 
-	if(!user_cond || !user_cond->assoc_cond
-	   || !user_cond->assoc_cond->user_list
-	   || !list_count(user_cond->assoc_cond->user_list)
-	   || !acct_list || !list_count(acct_list)) {
+	if (!user_cond || !user_cond->assoc_cond
+	    || !user_cond->assoc_cond->user_list
+	    || !list_count(user_cond->assoc_cond->user_list)
+	    || !acct_list || !list_count(acct_list)) {
 		error("we need something to add");
 		return SLURM_ERROR;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	user_name = uid_to_string((uid_t) uid);
 	itr = list_iterator_create(user_cond->assoc_cond->user_list);
 	itr2 = list_iterator_create(acct_list);
-	while((user = list_next(itr))) {
-		if(!user[0])
+	while ((user = list_next(itr))) {
+		if (!user[0])
 			continue;
-		while((acct = list_next(itr2))) {
-			if(!acct[0])
+		while ((acct = list_next(itr2))) {
+			if (!acct[0])
 				continue;
-			if(query)
+			if (query)
 				xstrfmtcat(query, ", (%ld, %ld, '%s', '%s')",
 					   (long)now, (long)now, acct, user);
 			else
@@ -466,7 +466,7 @@ extern int as_mysql_add_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 					acct_coord_table,
 					(long)now, (long)now, acct, user);
 
-			if(txn_query)
+			if (txn_query)
 				xstrfmtcat(txn_query,
 					   ", (%ld, %u, '%s', '%s', '%s')",
 					   (long)now, DBD_ADD_ACCOUNT_COORDS,
@@ -489,7 +489,7 @@ extern int as_mysql_add_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 	list_iterator_destroy(itr);
 	list_iterator_destroy(itr2);
 
-	if(query) {
+	if (query) {
 		xstrfmtcat(query,
 			   " on duplicate key update mod_time=%ld, "
 			   "deleted=0;%s",
@@ -500,13 +500,13 @@ extern int as_mysql_add_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 		xfree(query);
 		xfree(txn_query);
 
-		if(rc != SLURM_SUCCESS) {
+		if (rc != SLURM_SUCCESS) {
 			error("Couldn't add cluster hour rollup");
 			return rc;
 		}
 		/* get the update list set */
 		itr = list_iterator_create(user_cond->assoc_cond->user_list);
-		while((user = list_next(itr))) {
+		while ((user = list_next(itr))) {
 			user_rec = xmalloc(sizeof(slurmdb_user_rec_t));
 			user_rec->name = xstrdup(user);
 			_get_user_coords(mysql_conn, user_rec);
@@ -536,21 +536,21 @@ extern List as_mysql_modify_users(mysql_conn_t *mysql_conn, uint32_t uid,
 	MYSQL_RES *result = NULL;
 	MYSQL_ROW row;
 
-	if(!user_cond || !user) {
+	if (!user_cond || !user) {
 		error("we need something to change");
 		return NULL;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
-	if(user_cond->assoc_cond && user_cond->assoc_cond->user_list
-	   && list_count(user_cond->assoc_cond->user_list)) {
+	if (user_cond->assoc_cond && user_cond->assoc_cond->user_list
+	    && list_count(user_cond->assoc_cond->user_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(user_cond->assoc_cond->user_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "name='%s'", object);
 			set = 1;
@@ -565,14 +565,14 @@ extern List as_mysql_modify_users(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	ret_list = _get_other_user_names_to_mod(mysql_conn, uid, user_cond);
 
-	if(user->name)
+	if (user->name)
 		xstrfmtcat(vals, ", name='%s'", user->name);
 
-	if(user->admin_level != SLURMDB_ADMIN_NOTSET)
+	if (user->admin_level != SLURMDB_ADMIN_NOTSET)
 		xstrfmtcat(vals, ", admin_level=%u", user->admin_level);
 
-	if((!extra && !ret_list)
-	   || (!vals && !user->default_acct && !user->default_wckey)) {
+	if ((!extra && !ret_list)
+	    || (!vals && !user->default_acct && !user->default_wckey)) {
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		error("Nothing to change");
 		return NULL;
@@ -588,8 +588,8 @@ extern List as_mysql_modify_users(mysql_conn_t *mysql_conn, uint32_t uid,
 		"select distinct name from %s where deleted=0 %s;",
 		user_table, extra);
 	xfree(extra);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		if (ret_list)
 			list_destroy(ret_list);
@@ -598,7 +598,7 @@ extern List as_mysql_modify_users(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	if (!ret_list)
 		ret_list = list_create(slurm_destroy_char);
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_user_rec_t *user_rec = NULL;
 
 		object = row[0];
@@ -610,13 +610,13 @@ extern List as_mysql_modify_users(mysql_conn_t *mysql_conn, uint32_t uid,
 
 		user_rec = xmalloc(sizeof(slurmdb_user_rec_t));
 
-		if(!user->name)
+		if (!user->name)
 			user_rec->name = xstrdup(object);
 		else {
 			user_rec->name = xstrdup(user->name);
 			user_rec->old_name = xstrdup(object);
-			if(_change_user_name(mysql_conn, user_rec)
-			   != SLURM_SUCCESS)
+			if (_change_user_name(mysql_conn, user_rec)
+			    != SLURM_SUCCESS)
 				break;
 		}
 
@@ -635,7 +635,7 @@ no_user_table:
 		xfree(vals);
 		xfree(query);
 		return ret_list;
-	} else if(user->name && (list_count(ret_list) != 1)) {
+	} else if (user->name && (list_count(ret_list) != 1)) {
 		errno = ESLURM_ONE_CHANGE;
 		xfree(vals);
 		xfree(query);
@@ -689,14 +689,14 @@ no_user_table:
 		}
 		/* char *names = NULL; */
 		/* ListIterator itr = list_iterator_create(tmp_list); */
-		/* while((names = list_next(itr))) { */
+		/* while ((names = list_next(itr))) { */
 		/* 	info("%s", names); */
 		/* } */
 		/* list_iterator_destroy(itr); */
 		list_destroy(tmp_list);
 	}
 
-	if(user->default_wckey) {
+	if (user->default_wckey) {
 		slurmdb_wckey_cond_t wckey_cond;
 		slurmdb_wckey_rec_t wckey;
 		List tmp_list = NULL;
@@ -722,7 +722,7 @@ no_user_table:
 		}
 		/* char *names = NULL; */
 		/* ListIterator itr = list_iterator_create(tmp_list); */
-		/* while((names = list_next(itr))) { */
+		/* while ((names = list_next(itr))) { */
 		/* 	info("%s", names); */
 		/* } */
 		/* list_iterator_destroy(itr); */
@@ -752,23 +752,23 @@ extern List as_mysql_remove_users(mysql_conn_t *mysql_conn, uint32_t uid,
 	slurmdb_wckey_cond_t wckey_cond;
 	bool jobs_running = 0;
 
-	if(!user_cond) {
+	if (!user_cond) {
 		error("we need something to remove");
 		return NULL;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
-	if(user_cond->assoc_cond && user_cond->assoc_cond->user_list
-	   && list_count(user_cond->assoc_cond->user_list)) {
+	if (user_cond->assoc_cond && user_cond->assoc_cond->user_list
+	    && list_count(user_cond->assoc_cond->user_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(user_cond->assoc_cond->user_list);
-		while((object = list_next(itr))) {
-			if(!object[0])
+		while ((object = list_next(itr))) {
+			if (!object[0])
 				continue;
-			if(set)
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "name='%s'", object);
 			set = 1;
@@ -779,7 +779,7 @@ extern List as_mysql_remove_users(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	ret_list = _get_other_user_names_to_mod(mysql_conn, uid, user_cond);
 
-	if(user_cond->admin_level != SLURMDB_ADMIN_NOTSET) {
+	if (user_cond->admin_level != SLURMDB_ADMIN_NOTSET) {
 		xstrfmtcat(extra, " && admin_level=%u", user_cond->admin_level);
 	}
 
@@ -800,7 +800,7 @@ extern List as_mysql_remove_users(mysql_conn_t *mysql_conn, uint32_t uid,
 	query = xstrdup_printf("select name from %s where deleted=0 %s;",
 			       user_table, extra);
 	xfree(extra);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return NULL;
 	}
@@ -813,7 +813,7 @@ extern List as_mysql_remove_users(mysql_conn_t *mysql_conn, uint32_t uid,
 
 no_user_table:
 
-	if(!list_count(ret_list)) {
+	if (!list_count(ret_list)) {
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		debug3("didn't effect anything\n%s", query);
 		xfree(query);
@@ -854,14 +854,14 @@ no_user_table:
 	/* We need to remove these accounts from the coord's that have it */
 	coord_list = as_mysql_remove_coord(
 		mysql_conn, uid, NULL, &user_coord_cond);
-	if(coord_list)
+	if (coord_list)
 		list_destroy(coord_list);
 
 	/* We need to remove these users from the wckey table */
 	memset(&wckey_cond, 0, sizeof(slurmdb_wckey_cond_t));
 	wckey_cond.user_list = assoc_cond.user_list;
 	coord_list = as_mysql_remove_wckeys(mysql_conn, uid, &wckey_cond);
-	if(coord_list)
+	if (coord_list)
 		list_destroy(coord_list);
 
 	list_destroy(assoc_cond.user_list);
@@ -869,12 +869,12 @@ no_user_table:
 	user_name = uid_to_string((uid_t) uid);
 	slurm_mutex_lock(&as_mysql_cluster_list_lock);
 	itr = list_iterator_create(as_mysql_cluster_list);
-	while((object = list_next(itr))) {
-		if((rc = remove_common(mysql_conn, DBD_REMOVE_USERS, now,
-				       user_name, user_table, name_char,
-				       assoc_char, object, ret_list,
-				       &jobs_running))
-		   != SLURM_SUCCESS)
+	while ((object = list_next(itr))) {
+		if ((rc = remove_common(mysql_conn, DBD_REMOVE_USERS, now,
+					user_name, user_table, name_char,
+					assoc_char, object, ret_list,
+					&jobs_running))
+		    != SLURM_SUCCESS)
 			break;
 	}
 	list_iterator_destroy(itr);
@@ -895,13 +895,13 @@ no_user_table:
 
 	rc = mysql_db_query(mysql_conn, query);
 	xfree(query);
-	if(rc != SLURM_SUCCESS) {
+	if (rc != SLURM_SUCCESS) {
 		error("Couldn't remove user coordinators");
 		list_destroy(ret_list);
 		return NULL;
 	}
 
-	if(jobs_running)
+	if (jobs_running)
 		errno = ESLURM_JOBS_RUNNING_ON_ASSOC;
 	else
 		errno = SLURM_SUCCESS;
@@ -924,21 +924,21 @@ extern List as_mysql_remove_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 	MYSQL_ROW row;
 	slurmdb_user_rec_t user;
 
-	if(!user_cond && !acct_list) {
+	if (!user_cond && !acct_list) {
 		error("we need something to remove");
 		return NULL;
-	} else if(user_cond && user_cond->assoc_cond)
+	} else if (user_cond && user_cond->assoc_cond)
 		user_list = user_cond->assoc_cond->user_list;
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	memset(&user, 0, sizeof(slurmdb_user_rec_t));
 	user.uid = uid;
 
-	if(!(is_admin = is_user_min_admin_level(
-		     mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
-		if(!is_user_any_coord(mysql_conn, &user)) {
+	if (!(is_admin = is_user_min_admin_level(
+		      mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
+		if (!is_user_any_coord(mysql_conn, &user)) {
 			error("Only admins/coordinators can "
 			      "remove coordinators");
 			errno = ESLURM_ACCESS_DENIED;
@@ -948,18 +948,18 @@ extern List as_mysql_remove_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	/* Leave it this way since we are using extra below */
 
-	if(user_list && list_count(user_list)) {
+	if (user_list && list_count(user_list)) {
 		set = 0;
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, "(");
 
 		itr = list_iterator_create(user_list);
-		while((object = list_next(itr))) {
-			if(!object[0])
+		while ((object = list_next(itr))) {
+			if (!object[0])
 				continue;
-			if(set)
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "user='%s'", object);
 			set = 1;
@@ -968,18 +968,18 @@ extern List as_mysql_remove_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(acct_list && list_count(acct_list)) {
+	if (acct_list && list_count(acct_list)) {
 		set = 0;
-		if(extra)
+		if (extra)
 			xstrcat(extra, " && (");
 		else
 			xstrcat(extra, "(");
 
 		itr = list_iterator_create(acct_list);
-		while((object = list_next(itr))) {
-			if(!object[0])
+		while ((object = list_next(itr))) {
+			if (!object[0])
 				continue;
-			if(set)
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "acct='%s'", object);
 			set = 1;
@@ -988,7 +988,7 @@ extern List as_mysql_remove_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(!extra) {
+	if (!extra) {
 		errno = SLURM_ERROR;
 		debug3("No conditions given");
 		return NULL;
@@ -1000,8 +1000,8 @@ extern List as_mysql_remove_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result =
-	     mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result =
+	      mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		xfree(extra);
 		errno = SLURM_ERROR;
@@ -1010,11 +1010,11 @@ extern List as_mysql_remove_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 	xfree(query);
 	ret_list = list_create(slurm_destroy_char);
 	user_list = list_create(slurm_destroy_char);
-	while((row = mysql_fetch_row(result))) {
-		if(!is_admin) {
+	while ((row = mysql_fetch_row(result))) {
+		if (!is_admin) {
 			slurmdb_coord_rec_t *coord = NULL;
-			if(!user.coord_accts) { // This should never
-						// happen
+			if (!user.coord_accts) { // This should never
+				// happen
 				error("We are here with no coord accts");
 				errno = ESLURM_ACCESS_DENIED;
 				list_destroy(ret_list);
@@ -1024,13 +1024,13 @@ extern List as_mysql_remove_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 				return NULL;
 			}
 			itr = list_iterator_create(user.coord_accts);
-			while((coord = list_next(itr))) {
-				if(!strcasecmp(coord->name, row[1]))
+			while ((coord = list_next(itr))) {
+				if (!strcasecmp(coord->name, row[1]))
 					break;
 			}
 			list_iterator_destroy(itr);
 
-			if(!coord) {
+			if (!coord) {
 				error("User %s(%d) does not have the "
 				      "ability to change this account (%s)",
 				      user.name, user.uid, row[1]);
@@ -1042,7 +1042,7 @@ extern List as_mysql_remove_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 				return NULL;
 			}
 		}
-		if(!last_user || strcasecmp(last_user, row[0])) {
+		if (!last_user || strcasecmp(last_user, row[0])) {
 			list_append(user_list, xstrdup(row[0]));
 			last_user = row[0];
 		}
@@ -1066,7 +1066,7 @@ extern List as_mysql_remove_coord(mysql_conn_t *mysql_conn, uint32_t uid,
 
 	/* get the update list set */
 	itr = list_iterator_create(user_list);
-	while((last_user = list_next(itr))) {
+	while ((last_user = list_next(itr))) {
 		user_rec = xmalloc(sizeof(slurmdb_user_rec_t));
 		user_rec->name = xstrdup(last_user);
 		_get_user_coords(mysql_conn, user_rec);
@@ -1108,7 +1108,7 @@ extern List as_mysql_get_users(mysql_conn_t *mysql_conn, uid_t uid,
 		USER_REQ_COUNT
 	};
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	memset(&user, 0, sizeof(slurmdb_user_rec_t));
@@ -1116,8 +1116,8 @@ extern List as_mysql_get_users(mysql_conn_t *mysql_conn, uid_t uid,
 
 	private_data = slurm_get_private_data();
 	if (private_data & PRIVATE_DATA_USERS) {
-		if(!(is_admin = is_user_min_admin_level(
-			     mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
+		if (!(is_admin = is_user_min_admin_level(
+			      mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
 			if (!is_user_any_coord(mysql_conn, &user)) {
 				error("Only admins/coordinators can "
 				      "access user data");
@@ -1127,13 +1127,13 @@ extern List as_mysql_get_users(mysql_conn_t *mysql_conn, uid_t uid,
 		}
 	}
 
-	if(!user_cond) {
+	if (!user_cond) {
 		xstrcat(extra, "where deleted=0");
 		set = 1;
 		goto empty;
 	}
 
-	if(user_cond->with_deleted)
+	if (user_cond->with_deleted)
 		xstrcat(extra, "where (deleted=0 || deleted=1)");
 	else
 		xstrcat(extra, "where deleted=0");
@@ -1159,14 +1159,14 @@ extern List as_mysql_get_users(mysql_conn_t *mysql_conn, uid_t uid,
 		       && list_count(user_cond->def_wckey_list)))
 		return NULL;
 
-	if(user_cond->assoc_cond &&
-	   user_cond->assoc_cond->user_list
-	   && list_count(user_cond->assoc_cond->user_list)) {
+	if (user_cond->assoc_cond &&
+	    user_cond->assoc_cond->user_list
+	    && list_count(user_cond->assoc_cond->user_list)) {
 		set = 0;
 		xstrcat(extra, " && (");
 		itr = list_iterator_create(user_cond->assoc_cond->user_list);
-		while((object = list_next(itr))) {
-			if(set)
+		while ((object = list_next(itr))) {
+			if (set)
 				xstrcat(extra, " || ");
 			xstrfmtcat(extra, "name='%s'", object);
 			set = 1;
@@ -1175,7 +1175,7 @@ extern List as_mysql_get_users(mysql_conn_t *mysql_conn, uid_t uid,
 		xstrcat(extra, ")");
 	}
 
-	if(user_cond->admin_level != SLURMDB_ADMIN_NOTSET) {
+	if (user_cond->admin_level != SLURMDB_ADMIN_NOTSET) {
 		xstrfmtcat(extra, " && admin_level=%u",
 			   user_cond->admin_level);
 		set = 1;
@@ -1185,7 +1185,7 @@ empty:
 	/* This is here to make sure we are looking at only this user
 	 * if this flag is set.
 	 */
-	if(!is_admin && (private_data & PRIVATE_DATA_USERS)) {
+	if (!is_admin && (private_data & PRIVATE_DATA_USERS)) {
 		xstrfmtcat(extra, " && name='%s'", user.name);
 	}
 
@@ -1201,8 +1201,8 @@ empty:
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
 		return NULL;
 	}
@@ -1210,7 +1210,7 @@ empty:
 
 	user_list = list_create(slurmdb_destroy_user_rec);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_user_rec_t *user = xmalloc(sizeof(slurmdb_user_rec_t));
 
 		list_append(user_list, user);
@@ -1218,14 +1218,14 @@ empty:
 		user->name =  xstrdup(row[USER_REQ_NAME]);
 		user->admin_level = slurm_atoul(row[USER_REQ_AL]);
 
-		if(user_cond && user_cond->with_coords)
+		if (user_cond && user_cond->with_coords)
 			_get_user_coords(mysql_conn, user);
 	}
 	mysql_free_result(result);
 
-	if(user_cond && (user_cond->with_assocs
-			 || (user_cond->assoc_cond
-			     && user_cond->assoc_cond->only_defs))) {
+	if (user_cond && (user_cond->with_assocs
+			  || (user_cond->assoc_cond
+			      && user_cond->assoc_cond->only_defs))) {
 		ListIterator assoc_itr = NULL;
 		slurmdb_user_rec_t *user = NULL;
 		slurmdb_association_rec_t *assoc = NULL;
@@ -1244,7 +1244,7 @@ empty:
 		assoc_list = as_mysql_get_assocs(
 			mysql_conn, uid, user_cond->assoc_cond);
 
-		if(!assoc_list) {
+		if (!assoc_list) {
 			error("no associations");
 			goto get_wckeys;
 		}
@@ -1288,9 +1288,9 @@ empty:
 	}
 
 get_wckeys:
-	if(user_cond && (user_cond->with_wckeys
-			 || (user_cond->assoc_cond
-			     && user_cond->assoc_cond->only_defs))) {
+	if (user_cond && (user_cond->with_wckeys
+			  || (user_cond->assoc_cond
+			      && user_cond->assoc_cond->only_defs))) {
 		ListIterator wckey_itr = NULL;
 		slurmdb_user_rec_t *user = NULL;
 		slurmdb_wckey_rec_t *wckey = NULL;
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_wckey.c b/src/plugins/accounting_storage/mysql/as_mysql_wckey.c
index bd8ae63f334..206777afee8 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_wckey.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_wckey.c
@@ -139,8 +139,8 @@ static int _make_sure_users_have_default(
 				cluster, wckey_table, user);
 			debug4("%d(%s:%d) query\n%s",
 			       mysql_conn->conn, THIS_FILE, __LINE__, query);
-			if(!(result = mysql_db_query_ret(
-				     mysql_conn, query, 0))) {
+			if (!(result = mysql_db_query_ret(
+				      mysql_conn, query, 0))) {
 				xfree(query);
 				error("couldn't query the database");
 				rc = SLURM_ERROR;
@@ -176,7 +176,7 @@ static int _make_sure_users_have_default(
 			       mysql_conn->conn, THIS_FILE, __LINE__, query);
 			rc = mysql_db_query(mysql_conn, query);
 			xfree(query);
-			if(rc != SLURM_SUCCESS) {
+			if (rc != SLURM_SUCCESS) {
 				error("problem with update query");
 				rc = SLURM_ERROR;
 				break;
@@ -202,12 +202,12 @@ static int _setup_wckey_cond_limits(slurmdb_wckey_cond_t *wckey_cond,
 	ListIterator itr = NULL;
 	char *object = NULL;
 	char *prefix = "t1";
-	if(!wckey_cond)
+	if (!wckey_cond)
 		return 0;
 
-	if(wckey_cond->with_deleted)
+	if (wckey_cond->with_deleted)
 		xstrfmtcat(*extra, " where (%s.deleted=0 || %s.deleted=1)",
-			prefix, prefix);
+			   prefix, prefix);
 	else
 		xstrfmtcat(*extra, " where %s.deleted=0", prefix);
 
@@ -276,22 +276,22 @@ static int _cluster_remove_wckeys(mysql_conn_t *mysql_conn,
 	char *query = xstrdup_printf("select t1.id_wckey, t1.wckey_name "
 				     "from \"%s_%s\" as t1%s;",
 				     cluster_name, wckey_table, extra);
-	if(!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) {
 		xfree(query);
 		return SLURM_ERROR;
 	}
 
-	if(!mysql_num_rows(result)) {
+	if (!mysql_num_rows(result)) {
 		mysql_free_result(result);
 		xfree(query);
 		return SLURM_SUCCESS;
 	}
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_wckey_rec_t *wckey_rec = NULL;
 
 		list_append(ret_list, xstrdup(row[1]));
-		if(!assoc_char)
+		if (!assoc_char)
 			xstrfmtcat(assoc_char, "id_wckey='%s'", row[0]);
 		else
 			xstrfmtcat(assoc_char, " || id_wckey='%s'", row[0]);
@@ -308,7 +308,7 @@ static int _cluster_remove_wckeys(mysql_conn_t *mysql_conn,
 	}
 	mysql_free_result(result);
 
-	if(!list_count(ret_list)) {
+	if (!list_count(ret_list)) {
 		errno = SLURM_NO_CHANGE_IN_DATA;
 		debug3("didn't effect anything\n%s", query);
 		xfree(query);
@@ -355,7 +355,7 @@ static int _cluster_modify_wckeys(mysql_conn_t *mysql_conn,
 	if (!mysql_num_rows(result))
 		return SLURM_SUCCESS;
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_wckey_rec_t *wckey_rec = NULL;
 		char *object = xstrdup_printf(
 			"C = %-10s W = %-20s U = %-9s",
@@ -424,7 +424,7 @@ static int _cluster_get_wckeys(mysql_conn_t *mysql_conn,
 	char *query = NULL;
 	bool with_usage = 0;
 
-	if(wckey_cond)
+	if (wckey_cond)
 		with_usage = wckey_cond->with_usage;
 
 	xstrfmtcat(query, "select distinct %s from \"%s_%s\" as t1%s "
@@ -433,24 +433,24 @@ static int _cluster_get_wckeys(mysql_conn_t *mysql_conn,
 
 	debug3("%d(%s:%d) query\n%s",
 	       mysql_conn->conn, THIS_FILE, __LINE__, query);
-	if(!(result = mysql_db_query_ret(
-		     mysql_conn, query, 0))) {
+	if (!(result = mysql_db_query_ret(
+		      mysql_conn, query, 0))) {
 		xfree(query);
-		if(mysql_errno(mysql_conn->db_conn) == ER_NO_SUCH_TABLE)
+		if (mysql_errno(mysql_conn->db_conn) == ER_NO_SUCH_TABLE)
 			return SLURM_SUCCESS;
 		else
 			return SLURM_ERROR;
 	}
 	xfree(query);
 
-	if(!mysql_num_rows(result)) {
+	if (!mysql_num_rows(result)) {
 		mysql_free_result(result);
 		return SLURM_SUCCESS;
 	}
 
 	wckey_list = list_create(slurmdb_destroy_wckey_rec);
 
-	while((row = mysql_fetch_row(result))) {
+	while ((row = mysql_fetch_row(result))) {
 		slurmdb_wckey_rec_t *wckey =
 			xmalloc(sizeof(slurmdb_wckey_rec_t));
 		list_append(wckey_list, wckey);
@@ -460,7 +460,7 @@ static int _cluster_get_wckeys(mysql_conn_t *mysql_conn,
 		wckey->user = xstrdup(row[WCKEY_REQ_USER]);
 
 		/* we want a blank wckey if the name is null */
-		if(row[WCKEY_REQ_NAME])
+		if (row[WCKEY_REQ_NAME])
 			wckey->name = xstrdup(row[WCKEY_REQ_NAME]);
 		else
 			wckey->name = xstrdup("");
@@ -469,7 +469,7 @@ static int _cluster_get_wckeys(mysql_conn_t *mysql_conn,
 	}
 	mysql_free_result(result);
 
-	if(with_usage && wckey_list && list_count(wckey_list))
+	if (with_usage && wckey_list && list_count(wckey_list))
 		get_usage_for_list(mysql_conn, DBD_GET_WCKEY_USAGE,
 				   wckey_list, cluster_name,
 				   wckey_cond->usage_start,
@@ -482,7 +482,7 @@ static int _cluster_get_wckeys(mysql_conn_t *mysql_conn,
 /* extern functions */
 
 extern int as_mysql_add_wckeys(mysql_conn_t *mysql_conn, uint32_t uid,
-			    List wckey_list)
+			       List wckey_list)
 {
 	ListIterator itr = NULL;
 	int rc = SLURM_SUCCESS;
@@ -495,15 +495,15 @@ extern int as_mysql_add_wckeys(mysql_conn_t *mysql_conn, uint32_t uid,
 	int added = 0;
 	List added_user_list = NULL;
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return ESLURM_DB_CONNECTION;
 
 	user_name = uid_to_string((uid_t) uid);
 	itr = list_iterator_create(wckey_list);
-	while((object = list_next(itr))) {
-		if(!object->cluster || !object->cluster[0]
-		   || !object->user || !object->user[0]
-		   || !object->name || !object->name[0]) {
+	while ((object = list_next(itr))) {
+		if (!object->cluster || !object->cluster[0]
+		    || !object->user || !object->user[0]
+		    || !object->name || !object->name[0]) {
 			error("We need a wckey name, cluster, "
 			      "and user to add.");
 			rc = SLURM_ERROR;
@@ -518,7 +518,7 @@ extern int as_mysql_add_wckeys(mysql_conn_t *mysql_conn, uint32_t uid,
 		xstrfmtcat(extra, ", mod_time=%ld, user='%s'",
 			   now, object->user);
 
-		if(object->name) {
+		if (object->name) {
 			xstrcat(cols, ", wckey_name");
 			xstrfmtcat(vals, ", '%s'", object->name);
 			xstrfmtcat(extra, ", wckey_name='%s'", object->name);
@@ -544,7 +544,7 @@ extern int as_mysql_add_wckeys(mysql_conn_t *mysql_conn, uint32_t uid,
 		       mysql_conn->conn, THIS_FILE, __LINE__, query);
 		object->id = mysql_db_insert_ret_id(mysql_conn, query);
 		xfree(query);
-		if(!object->id) {
+		if (!object->id) {
 			error("Couldn't add wckey %s", object->name);
 			added=0;
 			xfree(cols);
@@ -555,7 +555,7 @@ extern int as_mysql_add_wckeys(mysql_conn_t *mysql_conn, uint32_t uid,
 
 		affect_rows = last_affected_rows(mysql_conn);
 
-		if(!affect_rows) {
+		if (!affect_rows) {
 			debug2("nothing changed %d", affect_rows);
 			xfree(cols);
 			xfree(extra);
@@ -595,7 +595,7 @@ extern int as_mysql_add_wckeys(mysql_conn_t *mysql_conn, uint32_t uid,
 	list_iterator_destroy(itr);
 	xfree(user_name);
 
-	if(!added) {
+	if (!added) {
 		reset_mysql_conn(mysql_conn);
 		goto end_it;
 	}
@@ -633,17 +633,17 @@ extern List as_mysql_modify_wckeys(mysql_conn_t *mysql_conn,
 	List use_cluster_list = as_mysql_cluster_list;
 	ListIterator itr;
 
-	if(!wckey_cond || !wckey) {
+	if (!wckey_cond || !wckey) {
 		error("we need something to change");
 		return NULL;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
-	if(!is_user_min_admin_level(mysql_conn, uid, SLURMDB_ADMIN_OPERATOR)) {
-		if(wckey_cond->user_list
-		   && (list_count(wckey_cond->user_list) == 1)) {
+	if (!is_user_min_admin_level(mysql_conn, uid, SLURMDB_ADMIN_OPERATOR)) {
+		if (wckey_cond->user_list
+		    && (list_count(wckey_cond->user_list) == 1)) {
 			uid_t pw_uid;
 			char *name;
 			name = list_peek(wckey_cond->user_list);
@@ -670,33 +670,33 @@ is_same_user:
 	if (wckey->is_def == 1)
 		xstrcat(vals, ", is_def=1");
 
-	if(!extra || !vals) {
+	if (!extra || !vals) {
 		error("Nothing to modify '%s' '%s'", extra, vals);
 		return NULL;
 	}
 
-	if(wckey_cond->cluster_list && list_count(wckey_cond->cluster_list))
+	if (wckey_cond->cluster_list && list_count(wckey_cond->cluster_list))
 		use_cluster_list = wckey_cond->cluster_list;
 
 	user_name = uid_to_string((uid_t) uid);
 
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 
 	ret_list = list_create(slurm_destroy_char);
 	itr = list_iterator_create(use_cluster_list);
-	while((object = list_next(itr))) {
-		if((rc = _cluster_modify_wckeys(
-			    mysql_conn, wckey, object,
-			    extra, vals, user_name, ret_list))
-		   != SLURM_SUCCESS)
+	while ((object = list_next(itr))) {
+		if ((rc = _cluster_modify_wckeys(
+			     mysql_conn, wckey, object,
+			     extra, vals, user_name, ret_list))
+		    != SLURM_SUCCESS)
 			break;
 	}
 	list_iterator_destroy(itr);
 	xfree(extra);
 	xfree(user_name);
 
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
 	if (rc == SLURM_ERROR) {
@@ -719,41 +719,41 @@ extern List as_mysql_remove_wckeys(mysql_conn_t *mysql_conn,
 	List use_cluster_list = as_mysql_cluster_list;
 	ListIterator itr;
 
-	if(!wckey_cond) {
+	if (!wckey_cond) {
 		xstrcat(extra, " where deleted=0");
 		goto empty;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	set = _setup_wckey_cond_limits(wckey_cond, &extra);
 
-	if(wckey_cond->cluster_list && list_count(wckey_cond->cluster_list))
+	if (wckey_cond->cluster_list && list_count(wckey_cond->cluster_list))
 		use_cluster_list = wckey_cond->cluster_list;
 empty:
-	if(!extra) {
+	if (!extra) {
 		error("Nothing to remove");
 		return NULL;
 	}
 
 	user_name = uid_to_string((uid_t) uid);
 
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 	ret_list = list_create(slurm_destroy_char);
 	itr = list_iterator_create(use_cluster_list);
-	while((object = list_next(itr))) {
-		if((rc = _cluster_remove_wckeys(
-			    mysql_conn, extra, object, user_name, ret_list))
-		   != SLURM_SUCCESS)
+	while ((object = list_next(itr))) {
+		if ((rc = _cluster_remove_wckeys(
+			     mysql_conn, extra, object, user_name, ret_list))
+		    != SLURM_SUCCESS)
 			break;
 	}
 	list_iterator_destroy(itr);
 	xfree(extra);
 	xfree(user_name);
 
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
 	if (rc == SLURM_ERROR) {
@@ -765,7 +765,7 @@ empty:
 }
 
 extern List as_mysql_get_wckeys(mysql_conn_t *mysql_conn, uid_t uid,
-			     slurmdb_wckey_cond_t *wckey_cond)
+				slurmdb_wckey_cond_t *wckey_cond)
 {
 	//DEF_TIMERS;
 	char *extra = NULL;
@@ -779,12 +779,12 @@ extern List as_mysql_get_wckeys(mysql_conn_t *mysql_conn, uid_t uid,
 	List use_cluster_list = as_mysql_cluster_list;
 	ListIterator itr;
 
-	if(!wckey_cond) {
+	if (!wckey_cond) {
 		xstrcat(extra, " where deleted=0");
 		goto empty;
 	}
 
-	if(check_connection(mysql_conn) != SLURM_SUCCESS)
+	if (check_connection(mysql_conn) != SLURM_SUCCESS)
 		return NULL;
 
 	memset(&user, 0, sizeof(slurmdb_user_rec_t));
@@ -792,8 +792,8 @@ extern List as_mysql_get_wckeys(mysql_conn_t *mysql_conn, uid_t uid,
 
 	private_data = slurm_get_private_data();
 	if (private_data & PRIVATE_DATA_USERS) {
-		if(!(is_admin = is_user_min_admin_level(
-			     mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
+		if (!(is_admin = is_user_min_admin_level(
+			      mysql_conn, uid, SLURMDB_ADMIN_OPERATOR))) {
 			if (!is_user_any_coord(mysql_conn, &user)) {
 				error("Only admins/coordinators can "
 				      "access wc key data");
@@ -805,7 +805,7 @@ extern List as_mysql_get_wckeys(mysql_conn_t *mysql_conn, uid_t uid,
 
 	set = _setup_wckey_cond_limits(wckey_cond, &extra);
 
-	if(wckey_cond->cluster_list && list_count(wckey_cond->cluster_list))
+	if (wckey_cond->cluster_list && list_count(wckey_cond->cluster_list))
 		use_cluster_list = wckey_cond->cluster_list;
 empty:
 	xfree(tmp);
@@ -818,19 +818,19 @@ empty:
 	 * if this flag is set.  We also include any accounts they may be
 	 * coordinator of.
 	 */
-	if(!is_admin && (private_data & PRIVATE_DATA_USERS))
+	if (!is_admin && (private_data & PRIVATE_DATA_USERS))
 		xstrfmtcat(extra, " && t1.user='%s'", user.name);
 
 	wckey_list = list_create(slurmdb_destroy_wckey_rec);
 
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_lock(&as_mysql_cluster_list_lock);
 	//START_TIMER;
 	itr = list_iterator_create(use_cluster_list);
-	while((cluster_name = list_next(itr))) {
-		if(_cluster_get_wckeys(mysql_conn, wckey_cond, tmp, extra,
-				       cluster_name, wckey_list)
-		   != SLURM_SUCCESS) {
+	while ((cluster_name = list_next(itr))) {
+		if (_cluster_get_wckeys(mysql_conn, wckey_cond, tmp, extra,
+					cluster_name, wckey_list)
+		    != SLURM_SUCCESS) {
 			list_destroy(wckey_list);
 			wckey_list = NULL;
 			break;
@@ -838,7 +838,7 @@ empty:
 	}
 	list_iterator_destroy(itr);
 
-	if(use_cluster_list == as_mysql_cluster_list)
+	if (use_cluster_list == as_mysql_cluster_list)
 		slurm_mutex_unlock(&as_mysql_cluster_list_lock);
 
 	xfree(tmp);
-- 
GitLab