Use nullptr instead of NULL

This commit is contained in:
eriedaberrie 2025-02-01 03:39:10 +00:00
parent fab8f67b82
commit d7aec10317

View file

@ -63,7 +63,7 @@ int main(int argc, char *argv[]) {
char *res_loc; char *res_loc;
switch (argc - optind) { switch (argc - optind) {
case 0: { case 0: {
res_loc = NULL; res_loc = nullptr;
for (const auto& fe : std::filesystem::directory_iterator(".")) { for (const auto& fe : std::filesystem::directory_iterator(".")) {
if (!fe.is_regular_file()) if (!fe.is_regular_file())
continue; continue;
@ -72,9 +72,9 @@ int main(int argc, char *argv[]) {
if (fp.extension() != ".shp") if (fp.extension() != ".shp")
continue; continue;
if (res_loc != NULL) { if (res_loc != nullptr) {
free(res_loc); free(res_loc);
res_loc = NULL; res_loc = nullptr;
break; break;
} }
@ -83,7 +83,7 @@ int main(int argc, char *argv[]) {
fps.copy(res_loc, fps.size()); fps.copy(res_loc, fps.size());
res_loc[fps.size()] = '\0'; res_loc[fps.size()] = '\0';
} }
if (res_loc == NULL) { if (res_loc == nullptr) {
std::cerr << "Failed to automatically find residents shapefile!" << std::endl; std::cerr << "Failed to automatically find residents shapefile!" << std::endl;
return 1; return 1;
} }