mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
fix: apply modernize-use-nullptr (#8134)
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
This commit is contained in:
committed by
greg landrum
parent
7eb5b422f9
commit
977cc9ac11
@@ -532,7 +532,7 @@ const FilterData_t *GetFilterData(FilterCatalogParams::FilterCatalogs catalog) {
|
||||
case FilterCatalogParams::CHEMBL_LINT:
|
||||
return CHEMBL_LINT;
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,7 +599,7 @@ const FilterProperty_t *GetFilterProperties(
|
||||
case FilterCatalogParams::CHEMBL_LINT:
|
||||
return CHEMBL_LINT_PROPS;
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
} // namespace RDKit
|
||||
|
||||
@@ -443,7 +443,7 @@ Bond *getTrigonalBipyramidalAxialBond(const Atom *cen, int axial) {
|
||||
|
||||
unsigned int perm = 0;
|
||||
cen->getPropIfPresent(RDKit::common_properties::_chiralPermutation, perm);
|
||||
if (perm == 0 || perm > 20) return 0;
|
||||
if (perm == 0 || perm > 20) return nullptr;
|
||||
|
||||
unsigned int idx = (axial != -1) ? trigonalbipyramidal_axial[perm][0]
|
||||
: trigonalbipyramidal_axial[perm][1];
|
||||
|
||||
@@ -2152,7 +2152,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
}
|
||||
else
|
||||
/* Can't grow it, we don't own it. */
|
||||
b->yy_ch_buf = NULL;
|
||||
b->yy_ch_buf = nullptr;
|
||||
|
||||
if ( ! b->yy_ch_buf )
|
||||
YY_FATAL_ERROR(
|
||||
@@ -2497,7 +2497,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
|
||||
return;
|
||||
|
||||
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
|
||||
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
|
||||
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) nullptr;
|
||||
|
||||
if ( b->yy_is_our_buffer )
|
||||
yyfree( (void *) b->yy_ch_buf , yyscanner );
|
||||
@@ -2571,7 +2571,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
|
||||
void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
if (new_buffer == NULL)
|
||||
if (new_buffer == nullptr)
|
||||
return;
|
||||
|
||||
yyensure_buffer_stack(yyscanner);
|
||||
@@ -2606,7 +2606,7 @@ void yypop_buffer_state (yyscan_t yyscanner)
|
||||
return;
|
||||
|
||||
yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
|
||||
YY_CURRENT_BUFFER_LVALUE = NULL;
|
||||
YY_CURRENT_BUFFER_LVALUE = nullptr;
|
||||
if (yyg->yy_buffer_stack_top > 0)
|
||||
--yyg->yy_buffer_stack_top;
|
||||
|
||||
@@ -2677,7 +2677,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann
|
||||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
|
||||
base[size-1] != YY_END_OF_BUFFER_CHAR )
|
||||
/* They forgot to leave room for the EOB's. */
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
|
||||
if ( ! b )
|
||||
@@ -2686,7 +2686,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann
|
||||
b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
|
||||
b->yy_buf_pos = b->yy_ch_buf = base;
|
||||
b->yy_is_our_buffer = 0;
|
||||
b->yy_input_file = NULL;
|
||||
b->yy_input_file = nullptr;
|
||||
b->yy_n_chars = b->yy_buf_size;
|
||||
b->yy_is_interactive = 0;
|
||||
b->yy_at_bol = 1;
|
||||
@@ -2985,14 +2985,14 @@ void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
|
||||
*/
|
||||
int yylex_init(yyscan_t* ptr_yy_globals)
|
||||
{
|
||||
if (ptr_yy_globals == NULL){
|
||||
if (ptr_yy_globals == nullptr){
|
||||
errno = EINVAL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
*ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
|
||||
*ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), nullptr );
|
||||
|
||||
if (*ptr_yy_globals == NULL){
|
||||
if (*ptr_yy_globals == nullptr){
|
||||
errno = ENOMEM;
|
||||
return 1;
|
||||
}
|
||||
@@ -3016,14 +3016,14 @@ int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
|
||||
|
||||
yyset_extra (yy_user_defined, &dummy_yyguts);
|
||||
|
||||
if (ptr_yy_globals == NULL){
|
||||
if (ptr_yy_globals == nullptr){
|
||||
errno = EINVAL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
*ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
|
||||
|
||||
if (*ptr_yy_globals == NULL){
|
||||
if (*ptr_yy_globals == nullptr){
|
||||
errno = ENOMEM;
|
||||
return 1;
|
||||
}
|
||||
@@ -3044,24 +3044,24 @@ static int yy_init_globals (yyscan_t yyscanner)
|
||||
* This function is called from yylex_destroy(), so don't allocate here.
|
||||
*/
|
||||
|
||||
yyg->yy_buffer_stack = NULL;
|
||||
yyg->yy_buffer_stack = nullptr;
|
||||
yyg->yy_buffer_stack_top = 0;
|
||||
yyg->yy_buffer_stack_max = 0;
|
||||
yyg->yy_c_buf_p = NULL;
|
||||
yyg->yy_c_buf_p = nullptr;
|
||||
yyg->yy_init = 0;
|
||||
yyg->yy_start = 0;
|
||||
|
||||
yyg->yy_start_stack_ptr = 0;
|
||||
yyg->yy_start_stack_depth = 0;
|
||||
yyg->yy_start_stack = NULL;
|
||||
yyg->yy_start_stack = nullptr;
|
||||
|
||||
/* Defined in main.c */
|
||||
#ifdef YY_STDINIT
|
||||
yyin = stdin;
|
||||
yyout = stdout;
|
||||
#else
|
||||
yyin = NULL;
|
||||
yyout = NULL;
|
||||
yyin = nullptr;
|
||||
yyout = nullptr;
|
||||
#endif
|
||||
|
||||
/* For future reference: Set errno on error, since we are called by
|
||||
@@ -3078,17 +3078,17 @@ int yylex_destroy (yyscan_t yyscanner)
|
||||
/* Pop the buffer stack, destroying each element. */
|
||||
while(YY_CURRENT_BUFFER){
|
||||
yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
|
||||
YY_CURRENT_BUFFER_LVALUE = NULL;
|
||||
YY_CURRENT_BUFFER_LVALUE = nullptr;
|
||||
yypop_buffer_state(yyscanner);
|
||||
}
|
||||
|
||||
/* Destroy the stack itself. */
|
||||
yyfree(yyg->yy_buffer_stack , yyscanner);
|
||||
yyg->yy_buffer_stack = NULL;
|
||||
yyg->yy_buffer_stack = nullptr;
|
||||
|
||||
/* Destroy the start condition stack. */
|
||||
yyfree( yyg->yy_start_stack , yyscanner );
|
||||
yyg->yy_start_stack = NULL;
|
||||
yyg->yy_start_stack = nullptr;
|
||||
|
||||
/* Reset the globals. This is important in a non-reentrant scanner so the next time
|
||||
* yylex() is called, initialization will occur. */
|
||||
@@ -3096,7 +3096,7 @@ int yylex_destroy (yyscan_t yyscanner)
|
||||
|
||||
/* Destroy the main struct (reentrant only). */
|
||||
yyfree ( yyscanner , yyscanner );
|
||||
yyscanner = NULL;
|
||||
yyscanner = nullptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2215,7 +2215,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
}
|
||||
else
|
||||
/* Can't grow it, we don't own it. */
|
||||
b->yy_ch_buf = NULL;
|
||||
b->yy_ch_buf = nullptr;
|
||||
|
||||
if ( ! b->yy_ch_buf )
|
||||
YY_FATAL_ERROR(
|
||||
@@ -2560,7 +2560,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
|
||||
return;
|
||||
|
||||
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
|
||||
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
|
||||
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) nullptr;
|
||||
|
||||
if ( b->yy_is_our_buffer )
|
||||
yyfree( (void *) b->yy_ch_buf , yyscanner );
|
||||
@@ -2634,7 +2634,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
|
||||
void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
if (new_buffer == NULL)
|
||||
if (new_buffer == nullptr)
|
||||
return;
|
||||
|
||||
yyensure_buffer_stack(yyscanner);
|
||||
@@ -2669,7 +2669,7 @@ void yypop_buffer_state (yyscan_t yyscanner)
|
||||
return;
|
||||
|
||||
yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
|
||||
YY_CURRENT_BUFFER_LVALUE = NULL;
|
||||
YY_CURRENT_BUFFER_LVALUE = nullptr;
|
||||
if (yyg->yy_buffer_stack_top > 0)
|
||||
--yyg->yy_buffer_stack_top;
|
||||
|
||||
@@ -2740,7 +2740,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann
|
||||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
|
||||
base[size-1] != YY_END_OF_BUFFER_CHAR )
|
||||
/* They forgot to leave room for the EOB's. */
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
|
||||
if ( ! b )
|
||||
@@ -2749,7 +2749,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann
|
||||
b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
|
||||
b->yy_buf_pos = b->yy_ch_buf = base;
|
||||
b->yy_is_our_buffer = 0;
|
||||
b->yy_input_file = NULL;
|
||||
b->yy_input_file = nullptr;
|
||||
b->yy_n_chars = b->yy_buf_size;
|
||||
b->yy_is_interactive = 0;
|
||||
b->yy_at_bol = 1;
|
||||
@@ -3007,14 +3007,14 @@ void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
|
||||
*/
|
||||
int yylex_init(yyscan_t* ptr_yy_globals)
|
||||
{
|
||||
if (ptr_yy_globals == NULL){
|
||||
if (ptr_yy_globals == nullptr){
|
||||
errno = EINVAL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
*ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
|
||||
*ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), nullptr );
|
||||
|
||||
if (*ptr_yy_globals == NULL){
|
||||
if (*ptr_yy_globals == nullptr){
|
||||
errno = ENOMEM;
|
||||
return 1;
|
||||
}
|
||||
@@ -3038,14 +3038,14 @@ int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
|
||||
|
||||
yyset_extra (yy_user_defined, &dummy_yyguts);
|
||||
|
||||
if (ptr_yy_globals == NULL){
|
||||
if (ptr_yy_globals == nullptr){
|
||||
errno = EINVAL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
*ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
|
||||
|
||||
if (*ptr_yy_globals == NULL){
|
||||
if (*ptr_yy_globals == nullptr){
|
||||
errno = ENOMEM;
|
||||
return 1;
|
||||
}
|
||||
@@ -3066,24 +3066,24 @@ static int yy_init_globals (yyscan_t yyscanner)
|
||||
* This function is called from yylex_destroy(), so don't allocate here.
|
||||
*/
|
||||
|
||||
yyg->yy_buffer_stack = NULL;
|
||||
yyg->yy_buffer_stack = nullptr;
|
||||
yyg->yy_buffer_stack_top = 0;
|
||||
yyg->yy_buffer_stack_max = 0;
|
||||
yyg->yy_c_buf_p = NULL;
|
||||
yyg->yy_c_buf_p = nullptr;
|
||||
yyg->yy_init = 0;
|
||||
yyg->yy_start = 0;
|
||||
|
||||
yyg->yy_start_stack_ptr = 0;
|
||||
yyg->yy_start_stack_depth = 0;
|
||||
yyg->yy_start_stack = NULL;
|
||||
yyg->yy_start_stack = nullptr;
|
||||
|
||||
/* Defined in main.c */
|
||||
#ifdef YY_STDINIT
|
||||
yyin = stdin;
|
||||
yyout = stdout;
|
||||
#else
|
||||
yyin = NULL;
|
||||
yyout = NULL;
|
||||
yyin = nullptr;
|
||||
yyout = nullptr;
|
||||
#endif
|
||||
|
||||
/* For future reference: Set errno on error, since we are called by
|
||||
@@ -3100,17 +3100,17 @@ int yylex_destroy (yyscan_t yyscanner)
|
||||
/* Pop the buffer stack, destroying each element. */
|
||||
while(YY_CURRENT_BUFFER){
|
||||
yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
|
||||
YY_CURRENT_BUFFER_LVALUE = NULL;
|
||||
YY_CURRENT_BUFFER_LVALUE = nullptr;
|
||||
yypop_buffer_state(yyscanner);
|
||||
}
|
||||
|
||||
/* Destroy the stack itself. */
|
||||
yyfree(yyg->yy_buffer_stack , yyscanner);
|
||||
yyg->yy_buffer_stack = NULL;
|
||||
yyg->yy_buffer_stack = nullptr;
|
||||
|
||||
/* Destroy the start condition stack. */
|
||||
yyfree( yyg->yy_start_stack , yyscanner );
|
||||
yyg->yy_start_stack = NULL;
|
||||
yyg->yy_start_stack = nullptr;
|
||||
|
||||
/* Reset the globals. This is important in a non-reentrant scanner so the next time
|
||||
* yylex() is called, initialization will occur. */
|
||||
@@ -3118,7 +3118,7 @@ int yylex_destroy (yyscan_t yyscanner)
|
||||
|
||||
/* Destroy the main struct (reentrant only). */
|
||||
yyfree ( yyscanner , yyscanner );
|
||||
yyscanner = NULL;
|
||||
yyscanner = nullptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ RDKit::SparseIntVect<std::uint32_t> *getFeatureFingerprint(
|
||||
RDKit::MorganFingerprints::getFeatureInvariants(mol, *invars);
|
||||
RDKit::SparseIntVect<std::uint32_t> *res =
|
||||
RDKit::MorganFingerprints::getFingerprint(
|
||||
mol, static_cast<unsigned int>(radius), invars, 0, useChirality,
|
||||
useBondTypes, useCounts, false, 0);
|
||||
mol, static_cast<unsigned int>(radius), invars, nullptr, useChirality,
|
||||
useBondTypes, useCounts, false, nullptr);
|
||||
delete invars;
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ class LocaleSwitcherImpl {
|
||||
// set locale for this thread
|
||||
|
||||
if (!recurseLocale(CurrentState)) {
|
||||
auto loc = newlocale(LC_ALL_MASK, "C", (locale_t)0);
|
||||
auto loc = newlocale(LC_ALL_MASK, "C", (locale_t) nullptr);
|
||||
old_loc = uselocale(loc);
|
||||
recurseLocale(SwitchLocale);
|
||||
switched = true;
|
||||
|
||||
@@ -216,14 +216,14 @@ struct LeaderPickerState {
|
||||
// InitializeThreads
|
||||
if (nt > 1) {
|
||||
nthreads = nt;
|
||||
pthread_barrier_init(&wait, NULL, nthreads + 1);
|
||||
pthread_barrier_init(&done, NULL, nthreads + 1);
|
||||
pthread_barrier_init(&wait, nullptr, nthreads + 1);
|
||||
pthread_barrier_init(&done, nullptr, nthreads + 1);
|
||||
|
||||
threads.resize(nt);
|
||||
for (unsigned int i = 0; i < nthreads; i++) {
|
||||
threads[i].id = i;
|
||||
threads[i].stat = this;
|
||||
pthread_create(&threads[i].tid, NULL, LeaderPickerWork<T>,
|
||||
pthread_create(&threads[i].tid, nullptr, LeaderPickerWork<T>,
|
||||
(void *)&threads[i]);
|
||||
}
|
||||
} else {
|
||||
@@ -236,7 +236,7 @@ struct LeaderPickerState {
|
||||
thread_op = 1;
|
||||
pthread_barrier_wait(&wait);
|
||||
for (unsigned int i = 0; i < nthreads; i++) {
|
||||
pthread_join(threads[i].tid, 0);
|
||||
pthread_join(threads[i].tid, nullptr);
|
||||
}
|
||||
pthread_barrier_destroy(&wait);
|
||||
pthread_barrier_destroy(&done);
|
||||
@@ -339,7 +339,7 @@ void *LeaderPickerWork(void *arg) {
|
||||
for (;;) {
|
||||
pthread_barrier_wait(&stat->wait);
|
||||
if (stat->thread_op) {
|
||||
return (void *)0;
|
||||
return (void *)nullptr;
|
||||
}
|
||||
stat->compact_job(thread->id);
|
||||
pthread_barrier_wait(&stat->done);
|
||||
|
||||
Reference in New Issue
Block a user