@@ -157,10 +157,10 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
157
157
PMIX_INFO_XFER (& chain -> info [n ], & info [n ]);
158
158
}
159
159
}
160
- /* put the evhandler name tag in the next-to-last element - we
160
+ /* add the evhandler name tag - we
161
161
* will fill it in as each handler is called */
162
162
PMIX_INFO_LOAD (& chain -> info [chain -> ninfo - 2 ], PMIX_EVENT_HDLR_NAME , NULL , PMIX_STRING );
163
- /* now put the callback object tag in the last element */
163
+ /* now add the callback object tag */
164
164
PMIX_INFO_LOAD (& chain -> info [chain -> ninfo - 1 ], PMIX_EVENT_RETURN_OBJECT , NULL , PMIX_POINTER );
165
165
166
166
/* we need to cache this event so we can pass it into
@@ -324,15 +324,27 @@ static void progress_local_event_hdlr(pmix_status_t status,
324
324
if (nxt -> codes [0 ] == chain -> status &&
325
325
check_range (& nxt -> rng , & chain -> source )) {
326
326
chain -> evhdlr = nxt ;
327
- /* add the handler name in case they want to reference it */
328
- if (NULL != chain -> info [chain -> ninfo - 2 ].value .data .string ) {
329
- free (chain -> info [chain -> ninfo - 2 ].value .data .string );
327
+ /* update the handler name in case they want to reference it */
328
+ for (n = 0 ; n < chain -> ninfo ; n ++ ) {
329
+ if (0 == strncmp (chain -> info [n ].key , PMIX_EVENT_HDLR_NAME , PMIX_MAX_KEYLEN )) {
330
+ if (NULL != chain -> info [n ].value .data .string ) {
331
+ free (chain -> info [n ].value .data .string );
332
+ }
333
+ if (NULL != chain -> evhdlr -> name ) {
334
+ chain -> info [n ].value .data .string = strdup (chain -> evhdlr -> name );
335
+ }
336
+ break ;
337
+ }
330
338
}
331
- if (NULL != chain -> evhdlr -> name ) {
332
- chain -> info [chain -> ninfo - 2 ].value .data .string = strdup (chain -> evhdlr -> name );
339
+ /* update the evhdlr cbobject */
340
+ for (n = 0 ; n < chain -> ninfo ; n ++ ) {
341
+ if (0 == strncmp (chain -> info [n ].key , PMIX_EVENT_RETURN_OBJECT , PMIX_MAX_KEYLEN )) {
342
+ if (NULL != chain -> evhdlr -> name ) {
343
+ chain -> info [n ].value .data .ptr = chain -> evhdlr -> cbobject ;
344
+ }
345
+ break ;
346
+ }
333
347
}
334
- /* add any cbobject - the info struct for it is at the end */
335
- chain -> info [chain -> ninfo - 1 ].value .data .ptr = nxt -> cbobject ;
336
348
nxt -> evhdlr (nxt -> index ,
337
349
chain -> status , & chain -> source ,
338
350
chain -> info , chain -> ninfo ,
@@ -364,15 +376,27 @@ static void progress_local_event_hdlr(pmix_status_t status,
364
376
* the source fits within it */
365
377
if (nxt -> codes [n ] == chain -> status ) {
366
378
chain -> evhdlr = nxt ;
367
- /* add the handler name in case they want to reference it */
368
- if (NULL != chain -> info [chain -> ninfo - 2 ].value .data .string ) {
369
- free (chain -> info [chain -> ninfo - 2 ].value .data .string );
379
+ /* update the handler name in case they want to reference it */
380
+ for (n = 0 ; n < chain -> ninfo ; n ++ ) {
381
+ if (0 == strncmp (chain -> info [n ].key , PMIX_EVENT_HDLR_NAME , PMIX_MAX_KEYLEN )) {
382
+ if (NULL != chain -> info [n ].value .data .string ) {
383
+ free (chain -> info [n ].value .data .string );
384
+ }
385
+ if (NULL != chain -> evhdlr -> name ) {
386
+ chain -> info [n ].value .data .string = strdup (chain -> evhdlr -> name );
387
+ }
388
+ break ;
389
+ }
370
390
}
371
- if (NULL != chain -> evhdlr -> name ) {
372
- chain -> info [chain -> ninfo - 2 ].value .data .string = strdup (chain -> evhdlr -> name );
391
+ /* update the evhdlr cbobject */
392
+ for (n = 0 ; n < chain -> ninfo ; n ++ ) {
393
+ if (0 == strncmp (chain -> info [n ].key , PMIX_EVENT_RETURN_OBJECT , PMIX_MAX_KEYLEN )) {
394
+ if (NULL != chain -> evhdlr -> name ) {
395
+ chain -> info [n ].value .data .ptr = chain -> evhdlr -> cbobject ;
396
+ }
397
+ break ;
398
+ }
373
399
}
374
- /* add any cbobject - the info struct for it is at the end */
375
- chain -> info [chain -> ninfo - 1 ].value .data .ptr = nxt -> cbobject ;
376
400
nxt -> evhdlr (nxt -> index ,
377
401
chain -> status , & chain -> source ,
378
402
chain -> info , chain -> ninfo ,
@@ -398,15 +422,27 @@ static void progress_local_event_hdlr(pmix_status_t status,
398
422
* the source fits within it */
399
423
if (check_range (& nxt -> rng , & chain -> source )) {
400
424
chain -> evhdlr = nxt ;
401
- /* add the handler name in case they want to reference it */
402
- if (NULL != chain -> info [chain -> ninfo - 2 ].value .data .string ) {
403
- free (chain -> info [chain -> ninfo - 2 ].value .data .string );
425
+ /* update the handler name in case they want to reference it */
426
+ for (n = 0 ; n < chain -> ninfo ; n ++ ) {
427
+ if (0 == strncmp (chain -> info [n ].key , PMIX_EVENT_HDLR_NAME , PMIX_MAX_KEYLEN )) {
428
+ if (NULL != chain -> info [n ].value .data .string ) {
429
+ free (chain -> info [n ].value .data .string );
430
+ }
431
+ if (NULL != chain -> evhdlr -> name ) {
432
+ chain -> info [n ].value .data .string = strdup (chain -> evhdlr -> name );
433
+ }
434
+ break ;
435
+ }
404
436
}
405
- if (NULL != chain -> evhdlr -> name ) {
406
- chain -> info [chain -> ninfo - 2 ].value .data .string = strdup (chain -> evhdlr -> name );
437
+ /* update the evhdlr cbobject */
438
+ for (n = 0 ; n < chain -> ninfo ; n ++ ) {
439
+ if (0 == strncmp (chain -> info [n ].key , PMIX_EVENT_RETURN_OBJECT , PMIX_MAX_KEYLEN )) {
440
+ if (NULL != chain -> evhdlr -> name ) {
441
+ chain -> info [n ].value .data .ptr = chain -> evhdlr -> cbobject ;
442
+ }
443
+ break ;
444
+ }
407
445
}
408
- /* add any cbobject - the info struct for it is at the end */
409
- chain -> info [chain -> ninfo - 1 ].value .data .ptr = nxt -> cbobject ;
410
446
nxt -> evhdlr (nxt -> index ,
411
447
chain -> status , & chain -> source ,
412
448
chain -> info , chain -> ninfo ,
@@ -425,15 +461,27 @@ static void progress_local_event_hdlr(pmix_status_t status,
425
461
if (1 == pmix_globals .events .last -> ncodes &&
426
462
pmix_globals .events .last -> codes [0 ] == chain -> status ) {
427
463
chain -> evhdlr = pmix_globals .events .last ;
428
- /* add the handler name in case they want to reference it */
429
- if (NULL != chain -> info [chain -> ninfo - 2 ].value .data .string ) {
430
- free (chain -> info [chain -> ninfo - 2 ].value .data .string );
464
+ /* update the handler name in case they want to reference it */
465
+ for (n = 0 ; n < chain -> ninfo ; n ++ ) {
466
+ if (0 == strncmp (chain -> info [n ].key , PMIX_EVENT_HDLR_NAME , PMIX_MAX_KEYLEN )) {
467
+ if (NULL != chain -> info [n ].value .data .string ) {
468
+ free (chain -> info [n ].value .data .string );
469
+ }
470
+ if (NULL != chain -> evhdlr -> name ) {
471
+ chain -> info [n ].value .data .string = strdup (chain -> evhdlr -> name );
472
+ }
473
+ break ;
474
+ }
431
475
}
432
- if (NULL != chain -> evhdlr -> name ) {
433
- chain -> info [chain -> ninfo - 2 ].value .data .string = strdup (chain -> evhdlr -> name );
476
+ /* update the evhdlr cbobject */
477
+ for (n = 0 ; n < chain -> ninfo ; n ++ ) {
478
+ if (0 == strncmp (chain -> info [n ].key , PMIX_EVENT_RETURN_OBJECT , PMIX_MAX_KEYLEN )) {
479
+ if (NULL != chain -> evhdlr -> name ) {
480
+ chain -> info [n ].value .data .ptr = chain -> evhdlr -> cbobject ;
481
+ }
482
+ break ;
483
+ }
434
484
}
435
- /* add any cbobject - the info struct for it is at the end */
436
- chain -> info [chain -> ninfo - 1 ].value .data .ptr = pmix_globals .events .last -> cbobject ;
437
485
chain -> evhdlr -> evhdlr (chain -> evhdlr -> index ,
438
486
chain -> status , & chain -> source ,
439
487
chain -> info , chain -> ninfo ,
@@ -445,15 +493,27 @@ static void progress_local_event_hdlr(pmix_status_t status,
445
493
for (n = 0 ; n < pmix_globals .events .last -> ncodes ; n ++ ) {
446
494
if (pmix_globals .events .last -> codes [n ] == chain -> status ) {
447
495
chain -> evhdlr = pmix_globals .events .last ;
448
- /* add the handler name in case they want to reference it */
449
- if (NULL != chain -> info [chain -> ninfo - 2 ].value .data .string ) {
450
- free (chain -> info [chain -> ninfo - 2 ].value .data .string );
496
+ /* update the handler name in case they want to reference it */
497
+ for (n = 0 ; n < chain -> ninfo ; n ++ ) {
498
+ if (0 == strncmp (chain -> info [n ].key , PMIX_EVENT_HDLR_NAME , PMIX_MAX_KEYLEN )) {
499
+ if (NULL != chain -> info [n ].value .data .string ) {
500
+ free (chain -> info [n ].value .data .string );
501
+ }
502
+ if (NULL != chain -> evhdlr -> name ) {
503
+ chain -> info [n ].value .data .string = strdup (chain -> evhdlr -> name );
504
+ }
505
+ break ;
506
+ }
451
507
}
452
- if (NULL != chain -> evhdlr -> name ) {
453
- chain -> info [chain -> ninfo - 2 ].value .data .string = strdup (chain -> evhdlr -> name );
508
+ /* update the evhdlr cbobject */
509
+ for (n = 0 ; n < chain -> ninfo ; n ++ ) {
510
+ if (0 == strncmp (chain -> info [n ].key , PMIX_EVENT_RETURN_OBJECT , PMIX_MAX_KEYLEN )) {
511
+ if (NULL != chain -> evhdlr -> name ) {
512
+ chain -> info [n ].value .data .ptr = chain -> evhdlr -> cbobject ;
513
+ }
514
+ break ;
515
+ }
454
516
}
455
- /* add any cbobject - the info struct for it is at the end */
456
- chain -> info [chain -> ninfo - 1 ].value .data .ptr = pmix_globals .events .last -> cbobject ;
457
517
chain -> evhdlr -> evhdlr (chain -> evhdlr -> index ,
458
518
chain -> status , & chain -> source ,
459
519
chain -> info , chain -> ninfo ,
@@ -465,15 +525,27 @@ static void progress_local_event_hdlr(pmix_status_t status,
465
525
} else {
466
526
/* gets run for all codes */
467
527
chain -> evhdlr = pmix_globals .events .last ;
468
- /* add the handler name in case they want to reference it */
469
- if (NULL != chain -> info [chain -> ninfo - 2 ].value .data .string ) {
470
- free (chain -> info [chain -> ninfo - 2 ].value .data .string );
528
+ /* update the handler name in case they want to reference it */
529
+ for (n = 0 ; n < chain -> ninfo ; n ++ ) {
530
+ if (0 == strncmp (chain -> info [n ].key , PMIX_EVENT_HDLR_NAME , PMIX_MAX_KEYLEN )) {
531
+ if (NULL != chain -> info [n ].value .data .string ) {
532
+ free (chain -> info [n ].value .data .string );
533
+ }
534
+ if (NULL != chain -> evhdlr -> name ) {
535
+ chain -> info [n ].value .data .string = strdup (chain -> evhdlr -> name );
536
+ }
537
+ break ;
538
+ }
471
539
}
472
- if (NULL != chain -> evhdlr -> name ) {
473
- chain -> info [chain -> ninfo - 2 ].value .data .string = strdup (chain -> evhdlr -> name );
540
+ /* update the evhdlr cbobject */
541
+ for (n = 0 ; n < chain -> ninfo ; n ++ ) {
542
+ if (0 == strncmp (chain -> info [n ].key , PMIX_EVENT_RETURN_OBJECT , PMIX_MAX_KEYLEN )) {
543
+ if (NULL != chain -> evhdlr -> name ) {
544
+ chain -> info [n ].value .data .ptr = chain -> evhdlr -> cbobject ;
545
+ }
546
+ break ;
547
+ }
474
548
}
475
- /* add any cbobject - the info struct for it is at the end */
476
- chain -> info [chain -> ninfo - 1 ].value .data .ptr = pmix_globals .events .last -> cbobject ;
477
549
chain -> evhdlr -> evhdlr (chain -> evhdlr -> index ,
478
550
chain -> status , & chain -> source ,
479
551
chain -> info , chain -> ninfo ,
@@ -642,15 +714,28 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain)
642
714
643
715
644
716
invk :
645
- /* invoke the handler */
646
- /* add the handler name in case they want to reference it */
647
- if (NULL != chain -> info [chain -> ninfo - 2 ].value .data .string ) {
648
- free (chain -> info [chain -> ninfo - 2 ].value .data .string );
717
+ /* update the handler name in case they want to reference it */
718
+ for (i = 0 ; i < chain -> ninfo ; i ++ ) {
719
+ if (0 == strncmp (chain -> info [i ].key , PMIX_EVENT_HDLR_NAME , PMIX_MAX_KEYLEN )) {
720
+ if (NULL != chain -> info [i ].value .data .string ) {
721
+ free (chain -> info [i ].value .data .string );
722
+ }
723
+ if (NULL != chain -> evhdlr -> name ) {
724
+ chain -> info [i ].value .data .string = strdup (chain -> evhdlr -> name );
725
+ }
726
+ break ;
727
+ }
649
728
}
650
- if (NULL != chain -> evhdlr -> name ) {
651
- chain -> info [chain -> ninfo - 2 ].value .data .string = strdup (chain -> evhdlr -> name );
729
+ /* update the evhdlr cbobject */
730
+ for (i = 0 ; i < chain -> ninfo ; i ++ ) {
731
+ if (0 == strncmp (chain -> info [i ].key , PMIX_EVENT_RETURN_OBJECT , PMIX_MAX_KEYLEN )) {
732
+ if (NULL != chain -> evhdlr -> name ) {
733
+ chain -> info [i ].value .data .ptr = chain -> evhdlr -> cbobject ;
734
+ }
735
+ break ;
736
+ }
652
737
}
653
- chain -> info [ chain -> ninfo - 1 ]. value . data . ptr = chain -> evhdlr -> cbobject ;
738
+ /* invoke the handler */
654
739
pmix_output_verbose (2 , pmix_globals .debug_output ,
655
740
"[%s:%d] INVOKING EVHDLR %s" , __FILE__ , __LINE__ ,
656
741
(NULL == chain -> evhdlr -> name ) ?
0 commit comments