Skip to content

Commit 40ac165

Browse files
committed
Fix const-correctness in info subscriber mechanism
Signed-off-by: Joseph Schuchart <[email protected]>
1 parent dc42985 commit 40ac165

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

ompi/communicator/comm_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static void ompi_comm_destruct(ompi_communicator_t* comm)
492492
}
493493

494494
#define OMPI_COMM_SET_INFO_FN(name, flag) \
495-
static char *ompi_comm_set_ ## name (opal_infosubscriber_t *obj, char *key, char *value) \
495+
static const char *ompi_comm_set_ ## name (opal_infosubscriber_t *obj, const char *key, const char *value) \
496496
{ \
497497
ompi_communicator_t *comm = (ompi_communicator_t *) obj; \
498498
\

ompi/mca/osc/rdma/osc_rdma_component.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static int ompi_osc_rdma_query_btls (ompi_communicator_t *comm, ompi_osc_rdma_mo
8181
static int ompi_osc_rdma_query_alternate_btls (ompi_communicator_t *comm, ompi_osc_rdma_module_t *module);
8282
static int ompi_osc_rdma_query_mtls (void);
8383

84-
static char* ompi_osc_rdma_set_no_lock_info(opal_infosubscriber_t *obj, char *key, char *value);
84+
static const char* ompi_osc_rdma_set_no_lock_info(opal_infosubscriber_t *obj, const char *key, const char *value);
8585

8686
static char *ompi_osc_rdma_btl_names;
8787
static char *ompi_osc_rdma_mtl_names;
@@ -1509,7 +1509,8 @@ static int ompi_osc_rdma_component_select (struct ompi_win_t *win, void **base,
15091509
}
15101510

15111511

1512-
static char* ompi_osc_rdma_set_no_lock_info(opal_infosubscriber_t *obj, char *key, char *value)
1512+
static const char*
1513+
ompi_osc_rdma_set_no_lock_info(opal_infosubscriber_t *obj, const char *key, const char *value)
15131514
{
15141515

15151516
struct ompi_win_t *win = (struct ompi_win_t*) obj;

ompi/mca/osc/sm/osc_sm_component.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ static int component_register (void);
4343
static int component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit,
4444
struct ompi_communicator_t *comm, struct opal_info_t *info,
4545
int flavor, int *model);
46-
static char* component_set_blocking_fence_info(opal_infosubscriber_t *obj, char *key, char *val);
47-
static char* component_set_alloc_shared_noncontig_info(opal_infosubscriber_t *obj, char *key, char *val);
46+
static const char* component_set_blocking_fence_info(opal_infosubscriber_t *obj, const char *key, const char *val);
47+
static const char* component_set_alloc_shared_noncontig_info(opal_infosubscriber_t *obj, const char *key, const char *val);
4848

4949

5050
ompi_osc_sm_component_t mca_osc_sm_component = {
@@ -561,8 +561,8 @@ ompi_osc_sm_set_info(struct ompi_win_t *win, struct opal_info_t *info)
561561
}
562562

563563

564-
static char*
565-
component_set_blocking_fence_info(opal_infosubscriber_t *obj, char *key, char *val)
564+
static const char*
565+
component_set_blocking_fence_info(opal_infosubscriber_t *obj, const char *key, const char *val)
566566
{
567567
ompi_osc_sm_module_t *module = (ompi_osc_sm_module_t*) ((struct ompi_win_t*) obj)->w_osc_module;
568568
/*
@@ -572,8 +572,8 @@ component_set_blocking_fence_info(opal_infosubscriber_t *obj, char *key, char *v
572572
}
573573

574574

575-
static char*
576-
component_set_alloc_shared_noncontig_info(opal_infosubscriber_t *obj, char *key, char *val)
575+
static const char*
576+
component_set_alloc_shared_noncontig_info(opal_infosubscriber_t *obj, const char *key, const char *val)
577577
{
578578

579579
ompi_osc_sm_module_t *module = (ompi_osc_sm_module_t*) ((struct ompi_win_t*) obj)->w_osc_module;

ompi/mca/osc/ucx/osc_ucx_component.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static void ompi_osc_ucx_unregister_progress()
264264
_osc_ucx_init_unlock();
265265
}
266266

267-
static char* ompi_osc_ucx_set_no_lock_info(opal_infosubscriber_t *obj, char *key, char *value)
267+
static const char* ompi_osc_ucx_set_no_lock_info(opal_infosubscriber_t *obj, const char *key, const char *value)
268268
{
269269

270270
struct ompi_win_t *win = (struct ompi_win_t*) obj;

opal/util/info_subscriber.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ typedef struct opal_infosubscriber_t opal_infosubscriber_t;
4747

4848
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_infosubscriber_t);
4949

50-
typedef char*(opal_key_interest_callback_t)(opal_infosubscriber_t*, char*, char*);
50+
typedef const char*(opal_key_interest_callback_t)(opal_infosubscriber_t*, const char*, const char*);
5151

5252
/**
5353
* opal_infosubscribe_change_info - Make changes to a Comm/Win/File Info
@@ -79,6 +79,6 @@ int opal_infosubscribe_change_info(opal_infosubscriber_t*, opal_info_t *);
7979
* Does not try to optimize settings that are the same between old and new
8080
* info's.
8181
*/
82-
int opal_infosubscribe_subscribe(opal_infosubscriber_t*, char *, char *, opal_key_interest_callback_t);
82+
int opal_infosubscribe_subscribe(opal_infosubscriber_t*, const char *, const char *, opal_key_interest_callback_t);
8383

8484
#endif /* OMPI_INFO_H */

0 commit comments

Comments
 (0)