Skip to content

Commit 26ff168

Browse files
committed
Cleanup the show_help changes a bit
It is true that pmix_status_t is an int, but we always explicitly return pmix_status_t anyway (just in case it someday changes, which would be hard to believe). Add a "norender" API that PRRTE uses in only one place, but easier than trying to figure out a way around it. Signed-off-by: Ralph Castain <[email protected]>
1 parent d490e10 commit 26ff168

File tree

2 files changed

+46
-31
lines changed

2 files changed

+46
-31
lines changed

src/util/pmix_show_help.c

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ static int output_stream = -1;
4848
/* How long to wait between displaying duplicate show_help notices */
4949
static struct timeval show_help_interval = {5, 0};
5050

51-
typedef struct pmix_log_info_t {
52-
53-
pmix_info_t *info;
54-
pmix_info_t *dirs;
55-
char *msg;
56-
57-
} pmix_log_info_t;
58-
5951
static void show_help_cbfunc(pmix_status_t status, void *cbdata)
6052
{
6153
pmix_query_caddy_t *cd = (pmix_query_caddy_t *) cbdata;
@@ -66,7 +58,9 @@ static void show_help_cbfunc(pmix_status_t status, void *cbdata)
6658
PMIX_RELEASE(cd);
6759
}
6860

69-
static void local_delivery(const char *file, const char *topic, char *msg)
61+
static void local_delivery(const char *file,
62+
const char *topic,
63+
const char *msg)
7064
{
7165
pmix_shift_caddy_t *cd;
7266

@@ -148,7 +142,7 @@ static const char *dash_line
148142
= "--------------------------------------------------------------------------\n";
149143
static char **search_dirs = NULL;
150144

151-
static int match(const char *a, const char *b)
145+
static pmix_status_t match(const char *a, const char *b)
152146
{
153147
int rc = PMIX_ERROR;
154148
char *p1, *p2, *tmp1 = NULL, *tmp2 = NULL;
@@ -194,7 +188,7 @@ static int match(const char *a, const char *b)
194188
}
195189

196190

197-
static int pmix_get_tli(const char *filename, const char *topic, tuple_list_item_t **tli_)
191+
static pmix_status_t pmix_get_tli(const char *filename, const char *topic, tuple_list_item_t **tli_)
198192
{
199193
tuple_list_item_t *tli = *tli_;
200194

@@ -261,7 +255,7 @@ static void pmix_show_accumulated_duplicates(int fd, short event, void *context)
261255
}
262256

263257

264-
int pmix_help_check_dups(const char *filename, const char *topic)
258+
pmix_status_t pmix_help_check_dups(const char *filename, const char *topic)
265259
{
266260

267261
tuple_list_item_t *tli;
@@ -324,7 +318,7 @@ int pmix_help_check_dups(const char *filename, const char *topic)
324318
/*
325319
* Local functions
326320
*/
327-
int pmix_show_help_init(char *helpdir)
321+
pmix_status_t pmix_show_help_init(char *helpdir)
328322
{
329323
pmix_output_stream_t lds;
330324

@@ -341,7 +335,7 @@ int pmix_show_help_init(char *helpdir)
341335
return PMIX_SUCCESS;
342336
}
343337

344-
int pmix_show_help_finalize(void)
338+
pmix_status_t pmix_show_help_finalize(void)
345339
{
346340
pmix_output_close(output_stream);
347341
output_stream = -1;
@@ -361,7 +355,7 @@ int pmix_show_help_finalize(void)
361355
* efficient method in the world, but we're going for clarity here --
362356
* not optimization. :-)
363357
*/
364-
static int array2string(char **outstring, int want_error_header, char **lines)
358+
static pmix_status_t array2string(char **outstring, int want_error_header, char **lines)
365359
{
366360
int i, count;
367361
size_t len;
@@ -407,7 +401,7 @@ static int array2string(char **outstring, int want_error_header, char **lines)
407401
/*
408402
* Find the right file to open
409403
*/
410-
static int open_file(const char *base, const char *topic)
404+
static pmix_status_t open_file(const char *base, const char *topic)
411405
{
412406
char *filename;
413407
char *err_msg = NULL;
@@ -483,7 +477,7 @@ static int open_file(const char *base, const char *topic)
483477
* In the file that has already been opened, find the topic that we're
484478
* supposed to output
485479
*/
486-
static int find_topic(const char *base, const char *topic)
480+
static pmix_status_t find_topic(const char *base, const char *topic)
487481
{
488482
int token, ret;
489483
char *tmp;
@@ -528,7 +522,7 @@ static int find_topic(const char *base, const char *topic)
528522
* We have an open file, and we're pointed at the right topic. So
529523
* read in all the lines in the topic and make a list of them.
530524
*/
531-
static int read_topic(char ***array)
525+
static pmix_status_t read_topic(char ***array)
532526
{
533527
int token, rc;
534528

@@ -551,7 +545,7 @@ static int read_topic(char ***array)
551545
/* Never get here */
552546
}
553547

554-
static int load_array(char ***array, const char *filename, const char *topic)
548+
static pmix_status_t load_array(char ***array, const char *filename, const char *topic)
555549
{
556550
int ret;
557551

@@ -612,7 +606,8 @@ char *pmix_show_help_string(const char *filename, const char *topic, int want_er
612606
return output;
613607
}
614608

615-
int pmix_show_vhelp(const char *filename, const char *topic, int want_error_header, va_list arglist)
609+
pmix_status_t pmix_show_vhelp(const char *filename, const char *topic,
610+
int want_error_header, va_list arglist)
616611
{
617612
char *output;
618613

@@ -627,7 +622,8 @@ int pmix_show_vhelp(const char *filename, const char *topic, int want_error_head
627622
return (NULL == output) ? PMIX_ERROR : PMIX_SUCCESS;
628623
}
629624

630-
int pmix_show_help(const char *filename, const char *topic, int want_error_header, ...)
625+
pmix_status_t pmix_show_help(const char *filename, const char *topic,
626+
int want_error_header, ...)
631627
{
632628
va_list arglist;
633629
char *output;
@@ -645,8 +641,16 @@ int pmix_show_help(const char *filename, const char *topic, int want_error_heade
645641
return PMIX_SUCCESS;
646642
}
647643

648-
int pmix_show_help_add_dir(const char *directory)
644+
pmix_status_t pmix_show_help_add_dir(const char *directory)
649645
{
650646
pmix_argv_append_nosize(&search_dirs, directory);
651647
return PMIX_SUCCESS;
652648
}
649+
650+
pmix_status_t pmix_show_help_norender(const char *filename,
651+
const char *topic,
652+
const char *output)
653+
{
654+
local_delivery(filename, topic, output);
655+
return PMIX_SUCCESS;
656+
}

src/util/pmix_show_help.h

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ BEGIN_C_DECLS
103103
*
104104
* Initialization of show_help subsystem
105105
*/
106-
PMIX_EXPORT int pmix_show_help_init(char *helpdir);
106+
PMIX_EXPORT pmix_status_t pmix_show_help_init(char *helpdir);
107107

108108
/**
109109
* \internal
110110
*
111111
* Finalization of show_help subsystem
112112
*/
113-
PMIX_EXPORT int pmix_show_help_finalize(void);
113+
PMIX_EXPORT pmix_status_t pmix_show_help_finalize(void);
114114

115115
/**
116116
* Look up a text message in a text file and display it to the
@@ -134,14 +134,18 @@ PMIX_EXPORT int pmix_show_help_finalize(void);
134134
* promotion to va_start() has undefined behavior (according to clang
135135
* warnings on MacOS High Sierra).
136136
*/
137-
PMIX_EXPORT int pmix_show_help(const char *filename, const char *topic, int want_error_header, ...);
137+
PMIX_EXPORT pmix_status_t pmix_show_help(const char *filename,
138+
const char *topic,
139+
int want_error_header, ...);
138140

139141
/**
140142
* This function does the same thing as pmix_show_help(), but accepts
141143
* a va_list form of varargs.
142144
*/
143-
PMIX_EXPORT int pmix_show_vhelp(const char *filename, const char *topic, int want_error_header,
144-
va_list ap);
145+
PMIX_EXPORT pmix_status_t pmix_show_vhelp(const char *filename,
146+
const char *topic,
147+
int want_error_header,
148+
va_list ap);
145149

146150
/**
147151
* This function does the same thing as pmix_show_help(), but returns
@@ -154,8 +158,10 @@ PMIX_EXPORT char *pmix_show_help_string(const char *filename, const char *topic,
154158
* This function does the same thing as pmix_show_help_string(), but
155159
* accepts a va_list form of varargs.
156160
*/
157-
PMIX_EXPORT char *pmix_show_help_vstring(const char *filename, const char *topic,
158-
int want_error_header, va_list ap);
161+
PMIX_EXPORT char *pmix_show_help_vstring(const char *filename,
162+
const char *topic,
163+
int want_error_header,
164+
va_list ap);
159165

160166
/**
161167
* This function adds another search location for the files that
@@ -170,9 +176,14 @@ PMIX_EXPORT char *pmix_show_help_vstring(const char *filename, const char *topic
170176
* nees to tell pmix_show_help.how to find its own show_help files - without
171177
* interfering with the linked ORTE libs when they need to do show_help.
172178
*/
173-
PMIX_EXPORT int pmix_show_help_add_dir(const char *directory);
179+
PMIX_EXPORT pmix_status_t pmix_show_help_add_dir(const char *directory);
174180

175-
PMIX_EXPORT int pmix_help_check_dups(const char *filename, const char *topic);
181+
PMIX_EXPORT pmix_status_t pmix_help_check_dups(const char *filename,
182+
const char *topic);
183+
184+
PMIX_EXPORT pmix_status_t pmix_show_help_norender(const char *filename,
185+
const char *topic,
186+
const char *output);
176187

177188
PMIX_EXPORT extern bool pmix_show_help_enabled;
178189

0 commit comments

Comments
 (0)