tools: add cpplint rule for NULL usage · refack/node@12c8b4d (original) (raw)

`@@ -231,14 +231,14 @@ int dumpAllButInstalledLocales(int lev,

`

231

231

`int list(const char* toBundle) {

`

232

232

` UErrorCode status = U_ZERO_ERROR;

`

233

233

``

234

``

`-

FILE* bf = NULL;

`

``

234

`+

FILE* bf = NULL; // NOLINT (readability/null_usage)

`

235

235

``

236

``

`-

if (toBundle != NULL) {

`

``

236

`+

if (toBundle != NULL) { // NOLINT (readability/null_usage)

`

237

237

`if (VERBOSE) {

`

238

238

`printf("writing to bundle %s\n", toBundle);

`

239

239

` }

`

240

240

` bf = fopen(toBundle, "wb");

`

241

``

`-

if (bf == NULL) {

`

``

241

`+

if (bf == NULL) { // NOLINT (readability/null_usage)

`

242

242

`printf("ERROR: Could not open '%s' for writing.\n", toBundle);

`

243

243

`return 1;

`

244

244

` }

`

`@@ -258,6 +258,7 @@ int list(const char* toBundle) {

`

258

258

`ures_openDirect(packageName.data(), locale, &status));

`

259

259

`ASSERT_SUCCESS(&status, "while opening the bundle");

`

260

260

` LocalUResourceBundlePointer installedLocales(

`

``

261

`+

// NOLINTNEXTLINE (readability/null_usage)

`

261

262

`ures_getByKey(bund.getAlias(), INSTALLEDLOCALES, NULL, &status));

`

262

263

`ASSERT_SUCCESS(&status, "while fetching installed locales");

`

263

264

``

`@@ -266,7 +267,7 @@ int list(const char* toBundle) {

`

266

267

`printf("Locales: %d\n", count);

`

267

268

` }

`

268

269

``

269

``

`-

if (bf != NULL) {

`

``

270

`+

if (bf != NULL) { // NOLINT (readability/null_usage)

`

270

271

`// write the HEADER

`

271

272

`fprintf(bf,

`

272

273

`"// Warning this file is automatically generated\n"

`

`@@ -310,17 +311,17 @@ int list(const char* toBundle) {

`

310

311

``

311

312

` UBool exists;

`

312

313

`if (localeExists(key, &exists)) {

`

313

``

`-

if (bf != NULL) fclose(bf);

`

``

314

`+

if (bf != NULL) fclose(bf); // NOLINT (readability/null_usage)

`

314

315

`return 1; // get out.

`

315

316

` }

`

316

317

`if (exists) {

`

317

318

` validCount++;

`

318

319

`printf("%s\n", key);

`

319

``

`-

if (bf != NULL) {

`

``

320

`+

if (bf != NULL) { // NOLINT (readability/null_usage)

`

320

321

`fprintf(bf, " %s {""}\n", key);

`

321

322

` }

`

322

323

` } else {

`

323

``

`-

if (bf != NULL) {

`

``

324

`+

if (bf != NULL) { // NOLINT (readability/null_usage)

`

324

325

`fprintf(bf, "// %s {""}\n", key);

`

325

326

` }

`

326

327

`if (VERBOSE) {

`

`@@ -329,7 +330,7 @@ int list(const char* toBundle) {

`

329

330

` }

`

330

331

` }

`

331

332

``

332

``

`-

if (bf != NULL) {

`

``

333

`+

if (bf != NULL) { // NOLINT (readability/null_usage)

`

333

334

`fprintf(bf, " } // %d/%d valid\n", validCount, count);

`

334

335

`// write the HEADER

`

335

336

`fprintf(bf, "}\n");

`

`@@ -371,7 +372,7 @@ int main(int argc, const char* argv[]) {

`

371

372

`usage();

`

372

373

`return 0;

`

373

374

` } else if (!strcmp(arg, "-l")) {

`

374

``

`-

if (list(NULL)) {

`

``

375

`+

if (list(NULL)) { // NOLINT (readability/null_usage)

`

375

376

`return 1;

`

376

377

` }

`

377

378

` } else if (!strcmp(arg, "-b") && (argsLeft >= 1)) {

`