@@ -610,7 +610,7 @@ int CeedSetData(Ceed ceed, void *data) {
610610// LCOV_EXCL_START
611611int CeedRegistryGetList (size_t * n , char * * * const resources ,
612612 CeedInt * * priorities ) {
613- * n = num_backends ;
613+ * n = 0 ;
614614 * resources = malloc (num_backends * sizeof (* * resources ));
615615 if (!resources )
616616 return CeedError (NULL , CEED_ERROR_MAJOR , "malloc() failure" );
@@ -620,8 +620,20 @@ int CeedRegistryGetList(size_t *n, char ***const resources,
620620 return CeedError (NULL , CEED_ERROR_MAJOR , "malloc() failure" );
621621 }
622622 for (size_t i = 0 ; i < num_backends ; i ++ ) {
623- * resources [i ] = backends [i ].prefix ;
624- if (priorities ) * priorities [i ] = backends [i ].priority ;
623+ // Only report compiled backends
624+ if (backends [i ].priority < CEED_MAX_BACKEND_PRIORITY ) {
625+ * resources [i ] = backends [i ].prefix ;
626+ if (priorities ) * priorities [i ] = backends [i ].priority ;
627+ * n += 1 ;
628+ }
629+ }
630+ * resources = realloc (* resources , * n * sizeof (* * resources ));
631+ if (!resources )
632+ return CeedError (NULL , CEED_ERROR_MAJOR , "realloc() failure" );
633+ if (priorities ) {
634+ * priorities = realloc (* priorities , * n * sizeof (* * priorities ));
635+ if (!priorities )
636+ return CeedError (NULL , CEED_ERROR_MAJOR , "realloc() failure" );
625637 }
626638 return CEED_ERROR_SUCCESS ;
627639};
@@ -643,7 +655,8 @@ int CeedRegistryGetList(size_t *n, char ***const resources,
643655**/
644656int CeedInit (const char * resource , Ceed * ceed ) {
645657 int ierr ;
646- size_t match_len = 0 , match_idx = UINT_MAX , match_priority = UINT_MAX , priority ;
658+ size_t match_len = 0 , match_idx = UINT_MAX ,
659+ match_priority = CEED_MAX_BACKEND_PRIORITY , priority ;
647660
648661 // Find matching backend
649662 if (!resource )
@@ -663,7 +676,9 @@ int CeedInit(const char *resource, Ceed *ceed) {
663676 CEED_VERSION_RELEASE ? "" : "+development" );
664677 fprintf (stderr , "Available backend resources:\n" );
665678 for (size_t i = 0 ; i < num_backends ; i ++ ) {
666- fprintf (stderr , " %s\n" , backends [i ].prefix );
679+ // Only report compiled backends
680+ if (backends [i ].priority < CEED_MAX_BACKEND_PRIORITY )
681+ fprintf (stderr , " %s\n" , backends [i ].prefix );
667682 }
668683 fflush (stderr );
669684 match_help = 5 ; // Delineating character expected
0 commit comments