From a9a386a5159a3b520f8213d6a25ce1c63964b83e Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Tue, 6 Oct 2009 20:23:15 +0000 Subject: [PATCH] No change in logic, just make the code more "pretty" --- src/plugins/sched/wiki/get_jobs.c | 4 ++-- src/plugins/sched/wiki/get_nodes.c | 8 +++----- src/plugins/sched/wiki2/get_jobs.c | 16 ++++++++-------- src/plugins/sched/wiki2/get_nodes.c | 3 +-- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/plugins/sched/wiki/get_jobs.c b/src/plugins/sched/wiki/get_jobs.c index 1347a8c8121..c9b1edb983b 100644 --- a/src/plugins/sched/wiki/get_jobs.c +++ b/src/plugins/sched/wiki/get_jobs.c @@ -222,8 +222,8 @@ static char * _dump_job(struct job_record *job_ptr, time_t update_time) return buf; if (IS_JOB_PENDING(job_ptr) && (job_ptr->details)) { - if ((job_ptr->details->req_nodes) - && (job_ptr->details->req_nodes[0])) { + if ((job_ptr->details->req_nodes) && + (job_ptr->details->req_nodes[0])) { char *hosts = bitmap2wiki_node_name( job_ptr->details->req_node_bitmap); snprintf(tmp, sizeof(tmp), diff --git a/src/plugins/sched/wiki/get_nodes.c b/src/plugins/sched/wiki/get_nodes.c index af872d18544..38f44ef1b48 100644 --- a/src/plugins/sched/wiki/get_nodes.c +++ b/src/plugins/sched/wiki/get_nodes.c @@ -152,7 +152,7 @@ static char * _dump_all_nodes(int *node_cnt, time_t update_time) static char * _dump_node(struct node_record *node_ptr, time_t update_time) { - char tmp[512], *buf = NULL; + char tmp[1024], *buf = NULL; int i; if (!node_ptr) @@ -173,14 +173,12 @@ static char * _dump_node(struct node_record *node_ptr, time_t update_time) xstrcat(buf, tmp); } - if (node_ptr->config_ptr - && node_ptr->config_ptr->feature) { + if (node_ptr->config_ptr && node_ptr->config_ptr->feature) { snprintf(tmp, sizeof(tmp), "FEATURES=%s;", node_ptr->config_ptr->feature); /* comma separated to colon */ for (i=0; (tmp[i] != '\0'); i++) { - if ((tmp[i] == ',') - || (tmp[i] == '|')) + if ((tmp[i] == ',') || (tmp[i] == '|')) tmp[i] = ':'; } xstrcat(buf, tmp); diff --git a/src/plugins/sched/wiki2/get_jobs.c b/src/plugins/sched/wiki2/get_jobs.c index cc7d4a3e575..e7f2f830683 100644 --- a/src/plugins/sched/wiki2/get_jobs.c +++ b/src/plugins/sched/wiki2/get_jobs.c @@ -2,6 +2,7 @@ * get_jobs.c - Process Wiki get job info request ***************************************************************************** * Copyright (C) 2006-2007 The Regents of the University of California. + * Copyright (C) 2008-2009 Lawrence Livermore National Security. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Morris Jette <jette1@llnl.gov> * CODE-OCEC-09-009. All rights reserved. @@ -256,9 +257,9 @@ static char * _dump_job(struct job_record *job_ptr, time_t update_time) xstrcat(buf, tmp); xfree(req_features); } - if ((job_ptr->details) - && (job_ptr->details->req_nodes) - && (job_ptr->details->req_nodes[0])) { + if ((job_ptr->details) && + (job_ptr->details->req_nodes) && + (job_ptr->details->req_nodes[0])) { char *hosts = bitmap2wiki_node_name( job_ptr->details->req_node_bitmap); snprintf(tmp, sizeof(tmp), @@ -266,8 +267,7 @@ static char * _dump_job(struct job_record *job_ptr, time_t update_time) xstrcat(buf, tmp); xfree(hosts); } - if ((job_ptr->details) - && (job_ptr->details->begin_time)) { + if ((job_ptr->details) && (job_ptr->details->begin_time)) { snprintf(tmp, sizeof(tmp), "STARTDATE=%u;", (uint32_t) job_ptr->details->begin_time); @@ -616,9 +616,9 @@ static char * _get_job_features(struct job_record *job_ptr) int i; char *rfeatures; - if ((job_ptr->details == NULL) - || (job_ptr->details->features == NULL) - || (job_ptr->details->features[0] == '\0')) + if ((job_ptr->details == NULL) || + (job_ptr->details->features == NULL) || + (job_ptr->details->features[0] == '\0')) return NULL; rfeatures = xstrdup(job_ptr->details->features); diff --git a/src/plugins/sched/wiki2/get_nodes.c b/src/plugins/sched/wiki2/get_nodes.c index 9cededcc055..6589d1aae2b 100644 --- a/src/plugins/sched/wiki2/get_nodes.c +++ b/src/plugins/sched/wiki2/get_nodes.c @@ -333,8 +333,7 @@ static char * _dump_node(struct node_record *node_ptr, hostlist_t hl, xstrcat(buf, tmp); } - if (node_ptr->config_ptr - && node_ptr->config_ptr->feature) { + if (node_ptr->config_ptr && node_ptr->config_ptr->feature) { snprintf(tmp, sizeof(tmp), "FEATURE=%s;", node_ptr->config_ptr->feature); /* comma separator to colon */ -- GitLab