diff --git a/src/rinterface.c b/src/rinterface.c index d6c93c93b63..f74588cd392 100644 --- a/src/rinterface.c +++ b/src/rinterface.c @@ -5323,7 +5323,7 @@ SEXP R_igraph_pagerank(SEXP graph, SEXP algo, SEXP vids, SEXP directed, SEXP dam igraph_real_t c_damping; igraph_vector_t c_weights; igraph_arpack_options_t c_options1; - void* c_options; + void* c_options = NULL; SEXP vector; SEXP value; @@ -5346,8 +5346,6 @@ SEXP R_igraph_pagerank(SEXP graph, SEXP algo, SEXP vids, SEXP directed, SEXP dam if (c_algo == IGRAPH_PAGERANK_ALGO_ARPACK) { Rz_SEXP_to_igraph_arpack_options(options, &c_options1); c_options = &c_options1; - } else { - c_options = NULL; } } /* Call igraph */ @@ -5396,7 +5394,7 @@ SEXP R_igraph_personalized_pagerank(SEXP graph, SEXP algo, SEXP vids, SEXP direc igraph_vector_t c_personalized; igraph_vector_t c_weights; igraph_arpack_options_t c_options1; - void* c_options; + void* c_options = NULL; SEXP vector; SEXP value; @@ -5422,8 +5420,6 @@ SEXP R_igraph_personalized_pagerank(SEXP graph, SEXP algo, SEXP vids, SEXP direc if (c_algo == IGRAPH_PAGERANK_ALGO_ARPACK) { Rz_SEXP_to_igraph_arpack_options(options, &c_options1); c_options = &c_options1; - } else { - c_options = NULL; } } /* Call igraph */ @@ -5472,7 +5468,7 @@ SEXP R_igraph_personalized_pagerank_vs(SEXP graph, SEXP algo, SEXP vids, SEXP di igraph_vs_t c_reset_vids; igraph_vector_t c_weights; igraph_arpack_options_t c_options1; - void* c_options; + void* c_options = NULL; SEXP vector; SEXP value; @@ -5497,8 +5493,6 @@ SEXP R_igraph_personalized_pagerank_vs(SEXP graph, SEXP algo, SEXP vids, SEXP di if (c_algo == IGRAPH_PAGERANK_ALGO_ARPACK) { Rz_SEXP_to_igraph_arpack_options(options, &c_options1); c_options = &c_options1; - } else { - c_options = NULL; } } /* Call igraph */ diff --git a/tools/stimulus/types-RC.yaml b/tools/stimulus/types-RC.yaml index 7c362dba585..3d1ada36ec9 100644 --- a/tools/stimulus/types-RC.yaml +++ b/tools/stimulus/types-RC.yaml @@ -995,16 +995,20 @@ SIR_LIST: IGRAPH_FINALLY_CLEAN(1); PAGERANKOPT: - CTYPE: |- + CTYPE: void* + # The argument is optional, + # so the code generator wraps the input conversion into `if (!Rf_isNull(...))`. + # The pointer is passed on to igraph unconditionally, + # therefore it must be initialized here + # to stay well-defined on the path where the conversion is skipped. + CDECL: |- igraph_arpack_options_t %C%1; - void* + void* %C% = NULL; INCONV: INOUT: |- if (%C1% == IGRAPH_PAGERANK_ALGO_ARPACK) { Rz_SEXP_to_igraph_arpack_options(%I%, &%C%1); %C% = &%C%1; - } else { - %C% = NULL; } OUTCONV: INOUT: |-