Skip to content
Snippets Groups Projects
Commit a9a386a5 authored by Moe Jette's avatar Moe Jette
Browse files

No change in logic, just make the code more "pretty"

parent e452a43e
No related branches found
No related tags found
No related merge requests found
......@@ -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),
......
......@@ -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);
......
......@@ -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);
......
......@@ -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 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment