Skip to content

Commit 7b0653a

Browse files
author
Ralph Castain
authored
Merge pull request #3747 from rhc54/topic/cleanup
Purge whitespace errors and fix uninitialized vars
2 parents 3aa131a + 8263eff commit 7b0653a

File tree

5 files changed

+38
-33
lines changed

5 files changed

+38
-33
lines changed

opal/mca/pmix/pmix2x/pmix2x.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,8 +1256,10 @@ static void pmix2x_query(opal_list_t *queries,
12561256
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
12571257
if (0 >= opal_pmix_base.initialized) {
12581258
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
1259-
rc = OPAL_ERR_NOT_INITIALIZED;
1260-
goto CLEANUP;
1259+
if (NULL != cbfunc) {
1260+
cbfunc(OPAL_ERR_NOT_INITIALIZED, NULL, cbdata, NULL, NULL);
1261+
}
1262+
return;
12611263
}
12621264
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
12631265

@@ -1323,8 +1325,10 @@ static void pmix2x_log(opal_list_t *info,
13231325
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
13241326
if (0 >= opal_pmix_base.initialized) {
13251327
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
1326-
rc = OPAL_ERR_NOT_INITIALIZED;
1327-
goto CLEANUP;
1328+
if (NULL != cbfunc) {
1329+
cbfunc(OPAL_ERR_NOT_INITIALIZED, cbdata);
1330+
}
1331+
return;
13281332
}
13291333
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
13301334

opal/mca/pmix/pmix2x/pmix2x_client.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ int pmix2x_fence(opal_list_t *procs, int collect_data)
312312
pmix_status_t rc;
313313
opal_namelist_t *ptr;
314314
char *nsptr;
315-
size_t cnt, n;
315+
size_t cnt = 0, n;
316316
pmix_proc_t *parray = NULL;
317317
pmix_info_t info, *iptr;
318318

@@ -729,7 +729,7 @@ int pmix2x_lookup(opal_list_t *data, opal_list_t *info)
729729
pmix_pdata_t *pdata;
730730
pmix_info_t *pinfo = NULL;
731731
pmix_status_t rc;
732-
size_t cnt, n, sz;
732+
size_t cnt, n, sz = 0;
733733
opal_value_t *iptr;
734734
opal_pmix2x_jobid_trkr_t *jptr, *job;
735735
int ret;
@@ -1000,7 +1000,7 @@ int pmix2x_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid)
10001000
pmix_status_t rc;
10011001
pmix_info_t *info = NULL;
10021002
pmix_app_t *papps;
1003-
size_t ninfo, napps, n, m;
1003+
size_t ninfo = 0, napps, n, m;
10041004
opal_value_t *ival;
10051005
opal_pmix_app_t *app;
10061006
char nspace[PMIX_MAX_NSLEN+1];

opal/util/cmd_line.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved.
1616
* Copyright (c) 2015-2017 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
18-
* Copyright (c) 2016 Intel, Inc. All rights reserved
18+
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
1919
* $COPYRIGHT$
2020
*
2121
* Additional copyrights may follow
@@ -402,8 +402,8 @@ int opal_cmd_line_parse(opal_cmd_line_t *cmd, bool ignore_unknown, bool ignore_u
402402
which can have 0 or 1 arguments */
403403
if (i >= cmd->lcl_argc) {
404404
/* If this is a help request, can have no arguments */
405-
if((NULL != option->clo_single_dash_name &&
406-
0 == strcmp(option->clo_single_dash_name, "h")) ||
405+
if((NULL != option->clo_single_dash_name &&
406+
0 == strcmp(option->clo_single_dash_name, "h")) ||
407407
(NULL != option->clo_long_name &&
408408
0 == strcmp(option->clo_long_name, "help"))) {
409409
help_without_arg = true;
@@ -466,7 +466,7 @@ int opal_cmd_line_parse(opal_cmd_line_t *cmd, bool ignore_unknown, bool ignore_u
466466
}
467467

468468
/* If there are no options to this command or it is
469-
a help request with no argument, see if we need to
469+
a help request with no argument, see if we need to
470470
set a boolean value to "true". */
471471

472472
if (0 == option->clo_num_params || help_without_arg) {

opal/util/info.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Copyright (c) 2015 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
1919
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
20+
* Copyright (c) 2017 Intel, Inc. All rights reserved.
2021
* $COPYRIGHT$
2122
*
2223
* Additional copyrights may follow
@@ -338,7 +339,7 @@ int opal_info_get_bool(opal_info_t *info, char *key, bool *value, int *flag)
338339
str[sizeof(str) - 1] = '\0';
339340
opal_info_get(info, key, sizeof(str) - 1, str, flag);
340341
if (*flag) {
341-
*value = opal_str_to_bool(str);
342+
*value = opal_str_to_bool(str);
342343
}
343344

344345
return OPAL_SUCCESS;
@@ -373,7 +374,7 @@ opal_str_to_bool(char *str)
373374
/* RHC unrecognized value -- print a warning? */
374375
}
375376
}
376-
return result;
377+
return result;
377378
}
378379

379380
/*
@@ -587,4 +588,3 @@ opal_info_value_to_bool(char *value, bool *interp)
587588

588589
return OPAL_ERR_BAD_PARAM;
589590
}
590-

opal/util/info_subscriber.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Copyright (c) 2015 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
1919
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
20+
* Copyright (c) 2017 Intel, Inc. All rights reserved.
2021
* $COPYRIGHT$
2122
*
2223
* Additional copyrights may follow
@@ -61,16 +62,16 @@ struct opal_callback_list_item_t {
6162
typedef struct opal_callback_list_item_t opal_callback_list_item_t;
6263

6364
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_infosubscriber_t);
64-
OBJ_CLASS_INSTANCE(opal_infosubscriber_t,
65-
opal_object_t,
66-
infosubscriber_construct,
65+
OBJ_CLASS_INSTANCE(opal_infosubscriber_t,
66+
opal_object_t,
67+
infosubscriber_construct,
6768
infosubscriber_destruct);
6869

6970
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_callback_list_item_t);
7071
static void opal_callback_list_item_destruct(opal_callback_list_item_t *obj);
71-
OBJ_CLASS_INSTANCE(opal_callback_list_item_t,
72-
opal_list_item_t,
73-
NULL,
72+
OBJ_CLASS_INSTANCE(opal_callback_list_item_t,
73+
opal_list_item_t,
74+
NULL,
7475
opal_callback_list_item_destruct);
7576

7677
static void infosubscriber_construct(opal_infosubscriber_t *obj) {
@@ -113,10 +114,10 @@ static char* opal_infosubscribe_inform_subscribers(opal_infosubscriber_t *object
113114

114115
if (found_callback) { *found_callback = 0; }
115116
/*
116-
* Present the new value to each subscriber. They can decide to accept it, ignore it, or
117+
* Present the new value to each subscriber. They can decide to accept it, ignore it, or
117118
* over-ride it with their own value (like ignore, but they specify what value they want it to have).
118119
*
119-
* Since multiple subscribers could set values, only the last setting is kept as the
120+
* Since multiple subscribers could set values, only the last setting is kept as the
120121
* returned value.
121122
*/
122123
if (table) {
@@ -125,7 +126,7 @@ static char* opal_infosubscribe_inform_subscribers(opal_infosubscriber_t *object
125126
if (list) {
126127
updated_value = new_value;
127128
OPAL_LIST_FOREACH(item, list, opal_callback_list_item_t) {
128-
updated_value = item->callback(object, key, updated_value);
129+
updated_value = item->callback(object, key, updated_value);
129130
if (found_callback) { *found_callback = 1; }
130131
}
131132
}
@@ -186,10 +187,10 @@ opal_infosubscribe_testregister(opal_infosubscriber_t *object)
186187
strlen(testing_keys[i]), (void**) &list);
187188
if (list) {
188189
OPAL_LIST_FOREACH(item, list, opal_callback_list_item_t) {
189-
if (0 ==
190+
if (0 ==
190191
strcmp(item->default_value, testing_initialvals[i])
191192
&&
192-
item->callback == testing_callbacks[i])
193+
item->callback == testing_callbacks[i])
193194
{
194195
found = 1;
195196
}
@@ -234,7 +235,7 @@ opal_infosubscribe_testregister(opal_infosubscriber_t *object)
234235
"in hash table\n");
235236
exit(-1);
236237
}
237-
238+
238239
err = opal_hash_table_get_next_key_ptr(table,
239240
(void**) &next_key, &key_size, (void**) &list, node, &node);
240241
}
@@ -294,13 +295,13 @@ opal_infosubscribe_change_info(opal_infosubscriber_t *object, opal_info_t *new_i
294295
if (!object->s_info) {
295296
object->s_info = OBJ_NEW(opal_info_t);
296297
}
297-
298+
298299
if (NULL != new_info) {
299300
OPAL_LIST_FOREACH(iterator, &new_info->super, opal_info_entry_t) {
300-
301+
301302
updated_value = opal_infosubscribe_inform_subscribers(object, iterator->ie_key, iterator->ie_value, &found_callback);
302303
if (updated_value) {
303-
err = opal_info_set(object->s_info, iterator->ie_key, updated_value);
304+
err = opal_info_set(object->s_info, iterator->ie_key, updated_value);
304305
} else {
305306
// This path would happen if there was no callback for this key,
306307
// or if there was a callback and it returned null. One way the
@@ -355,15 +356,15 @@ int opal_infosubscribe_subscribe(opal_infosubscriber_t *object, char *key, char
355356
opal_hash_table_set_value_ptr(table, key, strlen(key), list);
356357
}
357358

358-
callback_list_item = OBJ_NEW(opal_callback_list_item_t);
359+
callback_list_item = OBJ_NEW(opal_callback_list_item_t);
359360
callback_list_item->callback = callback;
360-
if (value) {
361+
if (value) {
361362
callback_list_item->default_value = strdup(value);
362363
} else {
363364
callback_list_item->default_value = NULL;
364365
}
365366

366-
opal_list_append(list, (opal_list_item_t*) callback_list_item);
367+
opal_list_append(list, (opal_list_item_t*) callback_list_item);
367368

368369
// Trigger callback() on either the default value or the info that's in the
369370
// object if there is one. Unfortunately there's some code duplication as
@@ -412,7 +413,7 @@ int opal_infosubscribe_subscribe(opal_infosubscriber_t *object, char *key, char
412413
} else {
413414
/*
414415
* TODO: This should not happen
415-
*/
416+
*/
416417
}
417418

418419
return OPAL_SUCCESS;

0 commit comments

Comments
 (0)