Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Issue 1123923002: Update our SK_ARRAY_COUNT macro to account for when pointers are passed. (Closed)

Created:
5 years, 7 months ago by tfarina
Modified:
5 years, 7 months ago
Reviewers:
mtklein, brucedawson
CC:
reviews_skia.org, brucedawson
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Update our SK_ARRAY_COUNT macro to account for when pointers are passed. In SkTypes.h SK_ARRAY_COUNT is defined as: #define SK_ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0])) This definition will compile if passed a pointer, even though this is meaningless. The arraysize macro in Chromium's base\macros.h uses template magic to avoid this problem. Fixing SK_ARRAY_COUNT will prevent checking in errors like the SkOpEdgeBuilder.cpp(211) bug in CL https://codereview.chromium.org/1002693002. Making this fix may find some other latent bugs, and it will allow readers to have more confidence in the results of SK_ARRAY_COUNT. We updated our macro to use this template magic from Chromium. BUG=skia:3593 R=mtklein@google.com

Patch Set 1 #

Patch Set 2 : cq-dry-run #

Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -1 line) Patch
M include/core/SkTypes.h View 1 chunk +20 lines, -1 line 0 comments Download

Messages

Total messages: 7 (3 generated)
tfarina
Mike, is this OK?
5 years, 7 months ago (2015-05-05 20:45:55 UTC) #1
brucedawson
Looks good to me. This sort of code will either compile cleanly or fail catastrophically, ...
5 years, 7 months ago (2015-05-05 20:55:44 UTC) #3
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1123923002/20001
5 years, 7 months ago (2015-05-05 20:57:26 UTC) #5
commit-bot: I haz the power
5 years, 7 months ago (2015-05-05 21:03:40 UTC) #7
Dry run: This issue passed the CQ dry run.

Powered by Google App Engine
This is Rietveld 408576698