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

Side by Side Diff: src/core/SkRefDict.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkRefDict.h ('k') | src/core/SkRegion.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkRefDict.h" 10 #include "SkRefDict.h"
11 #include "SkString.h" 11 #include "SkString.h"
12 12
13 struct SkRefDict::Impl { 13 struct SkRefDict::Impl {
14 Impl* fNext; 14 Impl* fNext;
15 SkString fName; 15 SkString fName;
16 SkRefCnt* fData; 16 SkRefCnt* fData;
17 }; 17 };
18 18
19 SkRefDict::SkRefDict() : fImpl(NULL) {} 19 SkRefDict::SkRefDict() : fImpl(nullptr) {}
20 20
21 SkRefDict::~SkRefDict() { 21 SkRefDict::~SkRefDict() {
22 this->removeAll(); 22 this->removeAll();
23 } 23 }
24 24
25 SkRefCnt* SkRefDict::find(const char name[]) const { 25 SkRefCnt* SkRefDict::find(const char name[]) const {
26 if (NULL == name) { 26 if (nullptr == name) {
27 return NULL; 27 return nullptr;
28 } 28 }
29 29
30 Impl* rec = fImpl; 30 Impl* rec = fImpl;
31 while (rec) { 31 while (rec) {
32 if (rec->fName.equals(name)) { 32 if (rec->fName.equals(name)) {
33 return rec->fData; 33 return rec->fData;
34 } 34 }
35 rec = rec->fNext; 35 rec = rec->fNext;
36 } 36 }
37 return NULL; 37 return nullptr;
38 } 38 }
39 39
40 void SkRefDict::set(const char name[], SkRefCnt* data) { 40 void SkRefDict::set(const char name[], SkRefCnt* data) {
41 if (NULL == name) { 41 if (nullptr == name) {
42 return; 42 return;
43 } 43 }
44 44
45 Impl* rec = fImpl; 45 Impl* rec = fImpl;
46 Impl* prev = NULL; 46 Impl* prev = nullptr;
47 while (rec) { 47 while (rec) {
48 if (rec->fName.equals(name)) { 48 if (rec->fName.equals(name)) {
49 if (data) { 49 if (data) {
50 // replace 50 // replace
51 data->ref(); 51 data->ref();
52 rec->fData->unref(); 52 rec->fData->unref();
53 rec->fData = data; 53 rec->fData = data;
54 } else { 54 } else {
55 // remove 55 // remove
56 rec->fData->unref(); 56 rec->fData->unref();
(...skipping 21 matching lines...) Expand all
78 } 78 }
79 79
80 void SkRefDict::removeAll() { 80 void SkRefDict::removeAll() {
81 Impl* rec = fImpl; 81 Impl* rec = fImpl;
82 while (rec) { 82 while (rec) {
83 Impl* next = rec->fNext; 83 Impl* next = rec->fNext;
84 rec->fData->unref(); 84 rec->fData->unref();
85 delete rec; 85 delete rec;
86 rec = next; 86 rec = next;
87 } 87 }
88 fImpl = NULL; 88 fImpl = nullptr;
89 } 89 }
OLDNEW
« no previous file with comments | « src/core/SkRefDict.h ('k') | src/core/SkRegion.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698