From 71399c28f5fbb06852c52e84363aa32b2f2eef5d Mon Sep 17 00:00:00 2001
From: jce <jce@unknown>
Date: Mon, 5 Aug 2002 18:36:44 +0000
Subject: [PATCH] slight change to make enum methods a little more correct.

---
 src/common/slurm_protocol_defs.c | 35 ++++++++++++++++++++++++++++++--
 src/common/slurm_protocol_defs.h |  6 ++++--
 2 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c
index 9ded40b7984..09a48ea35a0 100644
--- a/src/common/slurm_protocol_defs.c
+++ b/src/common/slurm_protocol_defs.c
@@ -498,7 +498,7 @@ void slurm_init_part_desc_msg ( update_part_msg_t * update_part_msg )
 }
 
 char *
-job_state_string(uint16_t inx) 
+job_state_string( enum job_states inx) 
 {
 	static char *job_state_string[] = {
 		"PENDING", 
@@ -514,7 +514,23 @@ job_state_string(uint16_t inx)
 }
 
 char *
-node_state_string(uint16_t inx) 
+job_state_string_compact( enum job_states inx) 
+{
+	static char *job_state_string[] = {
+		"PD", 
+		"SI", 
+		"R", 
+		"SO", 
+		"C", 
+		"F", 
+		"TO", 
+		"END" 
+	};
+	return job_state_string[inx];
+}
+
+char *
+node_state_string( enum node_states inx) 
 {
 	static char *node_state_string[] = {
 		"DOWN", 
@@ -527,3 +543,18 @@ node_state_string(uint16_t inx)
 	};
 	return node_state_string[inx];
 }
+	
+char *
+node_state_string_compact( enum node_states inx) 
+{
+	static char *node_state_string[] = {
+		"DN", 
+		"UN", 
+		"I", 
+		"AL", 
+		"DD", 
+		"DG", 
+		"END" 
+	};
+	return node_state_string[inx];
+}
diff --git a/src/common/slurm_protocol_defs.h b/src/common/slurm_protocol_defs.h
index caa88356922..ecf7f9748c8 100644
--- a/src/common/slurm_protocol_defs.h
+++ b/src/common/slurm_protocol_defs.h
@@ -576,8 +576,10 @@ void inline slurm_free_reattach_tasks_streams_msg ( reattach_tasks_streams_msg_t
 void inline slurm_free_revoke_credential_msg ( revoke_credential_msg_t * msg ) ;
 
 extern char *job_dist_string(uint16_t inx);
-extern char *job_state_string(uint16_t inx);
-extern char *node_state_string(uint16_t inx);
+extern char *job_state_string(enum job_states inx);
+extern char *job_state_string_compact(enum job_states inx);
+extern char *node_state_string(enum node_states inx);
+extern char *node_state_string_compact(enum node_states inx);
 
 #define SLURM_JOB_DESC_DEFAULT_CONTIGUOUS	NO_VAL
 #define SLURM_JOB_DESC_DEFAULT_ENVIRONMENT	((char **) NULL)
-- 
GitLab