From f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 15 Jun 2018 12:46:15 +0200 Subject: =?UTF-8?q?Run=20clang-tidy=E2=80=99s=20modernize-use-nullptr=20pa?= =?UTF-8?q?ss.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This replaces all NULL or 0 with nullptr when assigned to or returned as a pointer. --- src/extension/dependency.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/extension/dependency.cpp') diff --git a/src/extension/dependency.cpp b/src/extension/dependency.cpp index 5e843ee11..07462e5e7 100644 --- a/src/extension/dependency.cpp +++ b/src/extension/dependency.cpp @@ -51,20 +51,20 @@ Dependency::Dependency (Inkscape::XML::Node * in_repr) _type = TYPE_FILE; _location = LOCATION_PATH; _repr = in_repr; - _string = NULL; - _description = NULL; + _string = nullptr; + _description = nullptr; Inkscape::GC::anchor(_repr); if (const gchar * location = _repr->attribute("location")) { - for (int i = 0; i < LOCATION_CNT && location != NULL; i++) { + for (int i = 0; i < LOCATION_CNT && location != nullptr; i++) { if (!strcmp(location, _location_str[i])) { _location = (location_t)i; break; } } } else if (const gchar * location = _repr->attribute("reldir")) { - for (int i = 0; i < LOCATION_CNT && location != NULL; i++) { + for (int i = 0; i < LOCATION_CNT && location != nullptr; i++) { if (!strcmp(location, _location_str[i])) { _location = (location_t)i; break; @@ -73,7 +73,7 @@ Dependency::Dependency (Inkscape::XML::Node * in_repr) } const gchar * type = _repr->attribute("type"); - for (int i = 0; i < TYPE_CNT && type != NULL; i++) { + for (int i = 0; i < TYPE_CNT && type != nullptr; i++) { if (!strcmp(type, _type_str[i])) { _type = (type_t)i; break; @@ -83,7 +83,7 @@ Dependency::Dependency (Inkscape::XML::Node * in_repr) _string = _repr->firstChild()->content(); _description = _repr->attribute("description"); - if (_description == NULL) + if (_description == nullptr) _description = _repr->attribute("_description"); return; @@ -133,12 +133,12 @@ bool Dependency::check (void) const { // std::cout << "Checking: " << *this << std::endl; - if (_string == NULL) return FALSE; + if (_string == nullptr) return FALSE; switch (_type) { case TYPE_EXTENSION: { Extension * myext = db.get(_string); - if (myext == NULL) return FALSE; + if (myext == nullptr) return FALSE; if (myext->deactivated()) return FALSE; break; } @@ -171,7 +171,7 @@ bool Dependency::check (void) const default: { gchar * path = g_strdup(g_getenv("PATH")); - if (path == NULL) { + if (path == nullptr) { /* There is no `PATH' in the environment. The default search path is the current directory */ path = g_strdup(G_SEARCHPATH_SEPARATOR_S); @@ -179,7 +179,7 @@ bool Dependency::check (void) const gchar * orig_path = path; - for (; path != NULL;) { + for (; path != nullptr;) { gchar * local_path; // to have the path after detection of the separator Glib::ustring final_name; @@ -188,7 +188,7 @@ bool Dependency::check (void) const /* Not sure whether this is UTF8 happy, but it would seem like it considering that I'm searching (and finding) the ':' character */ - if (path != NULL) { + if (path != nullptr) { path[0] = '\0'; path++; } @@ -255,7 +255,7 @@ operator<< (std::ostream &out_file, const Dependency & in_dep) out_file << _(" location: ") << _(in_dep._location_str[in_dep._location]) << '\n'; out_file << _(" string: ") << in_dep._string << '\n'; - if (in_dep._description != NULL) { + if (in_dep._description != nullptr) { out_file << _(" description: ") << _(in_dep._description) << '\n'; } -- cgit v1.2.3