Closed Bug 1372853 Opened 7 years ago Closed 7 years ago

Use nullptr in /netwerk (clang-tidy: modernize-use-nullptr)

Categories

(Core :: Networking, enhancement)

47 Branch
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: janx, Assigned: janx)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-active])

Attachments

(1 file, 1 obsolete file)

In /netwerk/ there are several opportunities to use `nullptr` instead of `0` or `NULL`.

These can be automatically identified and acted on by the clang-tidy static analyzer (rule "modernize-use-nullptr").
This patch was generated with the following command:

run-clang-tidy-4.0.py -p obj-x86_64-pc-linux-gnu/ -fix -checks=-*,modernize-use-nullptr netwerk/
Summary: Use nullptr in netwerk (clang-tidy: modernize-use-nullptr) → Use nullptr in /netwerk (clang-tidy: modernize-use-nullptr)
If you're looking for a reviewer I volunteer as tribute :)
Whiteboard: [necko-active]
Comment on attachment 8877524 [details] [diff] [review]
Use nullptr in /netwerk (clang-tidy: modernize-use-nullptr). r=

(In reply to Valentin Gosu [:valentin] from comment #3)
> If you're looking for a reviewer I volunteer as tribute :)

Yes please! Thank you for volunteering :)
Attachment #8877524 - Flags: review?(valentin.gosu)
Comment on attachment 8877524 [details] [diff] [review]
Use nullptr in /netwerk (clang-tidy: modernize-use-nullptr). r=

Review of attachment 8877524 [details] [diff] [review]:
-----------------------------------------------------------------

::: netwerk/protocol/http/nsHttpHandler.cpp
@@ +1898,5 @@
>      dec = q / (double) n;
>      count_n = 0;
>      p2 = q_Accept;
>      for (token = nsCRT::strtok(o_Accept, ",", &p);
> +         token != (char *) nullptr;

nit: I think the cast isn't necessary here.

@@ +1904,5 @@
>      {
>          token = net_FindCharNotInSet(token, HTTP_LWS);
>          char* trim;
>          trim = net_FindCharInSet(token, ";" HTTP_LWS);
> +        if (trim != (char*)nullptr)  // remove "; q=..." if present

nit: cast isn't necessary
Attachment #8877524 - Flags: review?(valentin.gosu) → review+
Thanks a lot Valentin! Nits addressed, still compiles without the unnecessary casts, r+ carried over.
Attachment #8878386 - Flags: review+
Comment on attachment 8877524 [details] [diff] [review]
Use nullptr in /netwerk (clang-tidy: modernize-use-nullptr). r=

(I forgot to mark the old patch as obsolete)
Attachment #8877524 - Attachment is obsolete: true
Previous try run still applies and is fully green, please land this patch.
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/561c612879c4
Use nullptr in /netwerk (clang-tidy: modernize-use-nullptr). r=valentin
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/561c612879c4
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: