17
17
* Copyright (c) 2015 Research Organization for Information Science
18
18
* and Technology (RIST). All rights reserved.
19
19
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
20
+ * Copyright (c) 2017 Intel, Inc. All rights reserved.
20
21
* $COPYRIGHT$
21
22
*
22
23
* Additional copyrights may follow
@@ -61,16 +62,16 @@ struct opal_callback_list_item_t {
61
62
typedef struct opal_callback_list_item_t opal_callback_list_item_t ;
62
63
63
64
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 ,
67
68
infosubscriber_destruct );
68
69
69
70
OPAL_DECLSPEC OBJ_CLASS_DECLARATION (opal_callback_list_item_t );
70
71
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 ,
74
75
opal_callback_list_item_destruct );
75
76
76
77
static void infosubscriber_construct (opal_infosubscriber_t * obj ) {
@@ -113,10 +114,10 @@ static char* opal_infosubscribe_inform_subscribers(opal_infosubscriber_t *object
113
114
114
115
if (found_callback ) { * found_callback = 0 ; }
115
116
/*
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
117
118
* over-ride it with their own value (like ignore, but they specify what value they want it to have).
118
119
*
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
120
121
* returned value.
121
122
*/
122
123
if (table ) {
@@ -125,7 +126,7 @@ static char* opal_infosubscribe_inform_subscribers(opal_infosubscriber_t *object
125
126
if (list ) {
126
127
updated_value = new_value ;
127
128
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 );
129
130
if (found_callback ) { * found_callback = 1 ; }
130
131
}
131
132
}
@@ -186,10 +187,10 @@ opal_infosubscribe_testregister(opal_infosubscriber_t *object)
186
187
strlen (testing_keys [i ]), (void * * ) & list );
187
188
if (list ) {
188
189
OPAL_LIST_FOREACH (item , list , opal_callback_list_item_t ) {
189
- if (0 ==
190
+ if (0 ==
190
191
strcmp (item -> default_value , testing_initialvals [i ])
191
192
&&
192
- item -> callback == testing_callbacks [i ])
193
+ item -> callback == testing_callbacks [i ])
193
194
{
194
195
found = 1 ;
195
196
}
@@ -234,7 +235,7 @@ opal_infosubscribe_testregister(opal_infosubscriber_t *object)
234
235
"in hash table\n" );
235
236
exit (-1 );
236
237
}
237
-
238
+
238
239
err = opal_hash_table_get_next_key_ptr (table ,
239
240
(void * * ) & next_key , & key_size , (void * * ) & list , node , & node );
240
241
}
@@ -294,13 +295,13 @@ opal_infosubscribe_change_info(opal_infosubscriber_t *object, opal_info_t *new_i
294
295
if (!object -> s_info ) {
295
296
object -> s_info = OBJ_NEW (opal_info_t );
296
297
}
297
-
298
+
298
299
if (NULL != new_info ) {
299
300
OPAL_LIST_FOREACH (iterator , & new_info -> super , opal_info_entry_t ) {
300
-
301
+
301
302
updated_value = opal_infosubscribe_inform_subscribers (object , iterator -> ie_key , iterator -> ie_value , & found_callback );
302
303
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 );
304
305
} else {
305
306
// This path would happen if there was no callback for this key,
306
307
// 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
355
356
opal_hash_table_set_value_ptr (table , key , strlen (key ), list );
356
357
}
357
358
358
- callback_list_item = OBJ_NEW (opal_callback_list_item_t );
359
+ callback_list_item = OBJ_NEW (opal_callback_list_item_t );
359
360
callback_list_item -> callback = callback ;
360
- if (value ) {
361
+ if (value ) {
361
362
callback_list_item -> default_value = strdup (value );
362
363
} else {
363
364
callback_list_item -> default_value = NULL ;
364
365
}
365
366
366
- opal_list_append (list , (opal_list_item_t * ) callback_list_item );
367
+ opal_list_append (list , (opal_list_item_t * ) callback_list_item );
367
368
368
369
// Trigger callback() on either the default value or the info that's in the
369
370
// 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
412
413
} else {
413
414
/*
414
415
* TODO: This should not happen
415
- */
416
+ */
416
417
}
417
418
418
419
return OPAL_SUCCESS ;
0 commit comments