summaryrefslogtreecommitdiff
path: root/system/hfsprogs/patches/0010-Rename-custom-macro-nil-with-NULL.patch
blob: 354b4ffc042e0178dad1b675c7008209d1258454 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br>
Date: Thu, 24 Oct 2013 01:11:21 -0200
Subject: Rename custom macro nil with NULL

---
 fsck_hfs.tproj/dfalib/BTree.c         | 142 +++++++++++++++++-----------------
 fsck_hfs.tproj/dfalib/BTreeAllocate.c |  14 ++--
 fsck_hfs.tproj/dfalib/BTreeMiscOps.c  |  26 +++----
 fsck_hfs.tproj/dfalib/BTreeNodeOps.c  |  30 +++----
 fsck_hfs.tproj/dfalib/BTreeTreeOps.c  |  38 ++++-----
 fsck_hfs.tproj/dfalib/SControl.c      |  56 +++++++-------
 fsck_hfs.tproj/dfalib/SRepair.c       |   6 +-
 fsck_hfs.tproj/dfalib/SUtils.c        |   6 +-
 fsck_hfs.tproj/dfalib/SVerify1.c      |  32 ++++----
 fsck_hfs.tproj/dfalib/SVerify2.c      |   4 +-
 10 files changed, 177 insertions(+), 177 deletions(-)

diff --git a/fsck_hfs.tproj/dfalib/BTree.c b/fsck_hfs.tproj/dfalib/BTree.c
index 7ad9fe0..c0c8744 100644
--- a/fsck_hfs.tproj/dfalib/BTree.c
+++ b/fsck_hfs.tproj/dfalib/BTree.c
@@ -163,21 +163,21 @@ OSStatus	BTInitialize		(FCB					*filePtr,
 
 	////////////////////// Preliminary Error Checking ///////////////////////////
 
-	headerNode.buffer	= nil;
+	headerNode.buffer	= NULL;
 
-	if (pathPtr										== nil)	return  paramErr;
+	if (pathPtr == NULL)	return  paramErr;
 
 	setEndOfForkProc	= pathPtr->agentPtr->agent.setEndOfForkProc;
 	setBlockSizeProc	= pathPtr->agentPtr->agent.setBlockSizeProc;
 
-	if (pathPtr->agentPtr->agent.getBlockProc		== nil)	return  E_NoGetBlockProc;
-	if (pathPtr->agentPtr->agent.releaseBlockProc	== nil)	return  E_NoReleaseBlockProc;
-	if (setEndOfForkProc							== nil)	return  E_NoSetEndOfForkProc;
-	if (setBlockSizeProc							== nil)	return  E_NoSetBlockSizeProc;
+	if (pathPtr->agentPtr->agent.getBlockProc == NULL)	return  E_NoGetBlockProc;
+	if (pathPtr->agentPtr->agent.releaseBlockProc == NULL)	return  E_NoReleaseBlockProc;
+	if (setEndOfForkProc == NULL)	return  E_NoSetEndOfForkProc;
+	if (setBlockSizeProc == NULL)	return  E_NoSetBlockSizeProc;
 
 	forkPtr = pathPtr->path.forkPtr;
 
-	if (forkPtr->fork.btreePtr != nil)						return	fsBTrFileAlreadyOpenErr;
+	if (forkPtr->fork.btreePtr != NULL) return	fsBTrFileAlreadyOpenErr;
 
 	if ((maxKeyLength == 0) ||
 		(maxKeyLength >  kMaxKeyLength))					return	fsBTInvalidKeyLengthErr;
@@ -209,7 +209,7 @@ OSStatus	BTInitialize		(FCB					*filePtr,
 	//////////////////////// Allocate Control Block /////////////////////////////
 
 	M_RESIDENT_ALLOCATE_FIXED_CLEAR( &btreePtr, sizeof( BTreeControlBlock ), kFSBTreeControlBlockType );
-	if (btreePtr == nil)
+	if (btreePtr == NULL)
 	{
 		err = memFullErr;
 		goto ErrorExit;
@@ -220,7 +220,7 @@ OSStatus	BTInitialize		(FCB					*filePtr,
 	btreePtr->flags				= 0;
 	btreePtr->attributes		= 0;
 	btreePtr->forkPtr			= forkPtr;
-	btreePtr->keyCompareProc	= nil;
+	btreePtr->keyCompareProc	= NULL;
 	btreePtr->keyDescPtr		= keyDescPtr;
 	btreePtr->btreeType			= btreeType;
 	btreePtr->treeDepth			= 0;
@@ -282,7 +282,7 @@ OSStatus	BTInitialize		(FCB					*filePtr,
 
 	///////////////////// Copy Key Descriptor To Header /////////////////////////
 #if SupportsKeyDescriptors
-	if (keyDescPtr != nil)
+	if (keyDescPtr != NULL)
 	{
 		err = CheckKeyDescriptor (keyDescPtr, maxKeyLength);
 		M_ExitOnError (err);
@@ -309,7 +309,7 @@ OSStatus	BTInitialize		(FCB					*filePtr,
 	err = UpdateHeader (btreePtr);
 	M_ExitOnError (err);
 
-	pathPtr->path.forkPtr->fork.btreePtr = nil;
+	pathPtr->path.forkPtr->fork.btreePtr = NULL;
 	M_RESIDENT_DEALLOCATE_FIXED( btreePtr, sizeof( BTreeControlBlock ), kFSBTreeControlBlockType );
 
 	return	noErr;
@@ -320,7 +320,7 @@ OSStatus	BTInitialize		(FCB					*filePtr,
 ErrorExit:
 
 	(void) ReleaseNode (btreePtr, &headerNode);
-	if (btreePtr != nil)
+	if (btreePtr != NULL)
 		M_RESIDENT_DEALLOCATE_FIXED( btreePtr, sizeof( BTreeControlBlock ), kFSBTreeControlBlockType );
 
 	return	err;
@@ -342,7 +342,7 @@ Input:		filePtr				- pointer to file to open as a B-tree
 			setEndOfForkProc	- pointer to client's SetEOF function
 
 Result:		noErr				- success
-			paramErr			- required ptr was nil
+			paramErr			- required ptr was NULL
 			fsBTInvalidFileErr				-
 			memFullErr			-
 			!= noErr			- failure
@@ -364,16 +364,16 @@ OSStatus	BTOpenPath			(SFCB					*filePtr,
 
 	////////////////////// Preliminary Error Checking ///////////////////////////
 
-	if ( filePtr == nil				||
-		 getBlockProc == nil		||
-		 releaseBlockProc == nil	||
-		 setEndOfForkProc == nil	||
-		 setBlockSizeProc == nil )
+	if (filePtr == NULL ||
+		 getBlockProc == NULL ||
+		 releaseBlockProc == NULL ||
+		 setEndOfForkProc == NULL ||
+		 setBlockSizeProc == NULL)
 	{
 		return  paramErr;
 	}
 
-	if ( filePtr->fcbBtree != nil )			// already has a BTreeCB
+	if (filePtr->fcbBtree != NULL)			// already has a BTreeCB
 		return noErr;
 
 												// is file large enough to contain header node?
@@ -384,7 +384,7 @@ OSStatus	BTOpenPath			(SFCB					*filePtr,
 	//////////////////////// Allocate Control Block /////////////////////////////
 
 	btreePtr = (BTreeControlBlock*) AllocateClearMemory( sizeof( BTreeControlBlock ) );
-	if (btreePtr == nil)
+	if (btreePtr == NULL)
 	{
 		Panic ("\pBTOpen: no memory for btreePtr.");
 		return	memFullErr;
@@ -397,7 +397,7 @@ OSStatus	BTOpenPath			(SFCB					*filePtr,
 
 	/////////////////////////// Read Header Node ////////////////////////////////
 
-	nodeRec.buffer				= nil;				// so we can call ReleaseNode
+	nodeRec.buffer				= NULL;				// so we can call ReleaseNode
 	
 	btreePtr->fcbPtr			= filePtr;
 	filePtr->fcbBtree			= (void *) btreePtr;	// attach btree cb to file
@@ -487,7 +487,7 @@ OSStatus	BTOpenPath			(SFCB					*filePtr,
 
 	////////////////////////// Get Key Descriptor ///////////////////////////////
 #if SupportsKeyDescriptors
-	if ( keyCompareProc == nil )		// 	if no key compare proc then get key descriptor
+	if (keyCompareProc == NULL)		// 	if no key compare proc then get key descriptor
 	{
 		err = GetKeyDescriptor (btreePtr, nodeRec.buffer);	//¥¥ it should check amount of memory allocated...
 		M_ExitOnError (err);
@@ -499,7 +499,7 @@ OSStatus	BTOpenPath			(SFCB					*filePtr,
 	else
 #endif
 	{
-		btreePtr->keyDescPtr = nil;			// clear it so we don't dispose garbage later
+		btreePtr->keyDescPtr = NULL;			// clear it so we don't dispose garbage later
 	}
 
 	err = ReleaseNode (btreePtr, &nodeRec);
@@ -528,7 +528,7 @@ OSStatus	BTOpenPath			(SFCB					*filePtr,
 
 ErrorExit:
 
-	filePtr->fcbBtree = nil;
+	filePtr->fcbBtree = NULL;
 	(void) ReleaseNode (btreePtr, &nodeRec);
 	DisposeMemory( btreePtr );
 
@@ -567,7 +567,7 @@ OSStatus	BTClosePath			(SFCB					*filePtr)
 
 	btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
 
-	if (btreePtr == nil)
+	if (btreePtr == NULL)
 		return fsBTInvalidFileErr;
 
 	////////////////////// Check for other BTree Paths //////////////////////////
@@ -603,14 +603,14 @@ OSStatus	BTClosePath			(SFCB					*filePtr)
 	M_ExitOnError (err);
 
 #if SupportsKeyDescriptors
-	if (btreePtr->keyDescPtr != nil)			// deallocate keyDescriptor, if any
+	if (btreePtr->keyDescPtr != NULL)			// deallocate keyDescriptor, if any
 	{
 		DisposeMemory( btreePtr->keyDescPtr );
 	}
 #endif
 
 	DisposeMemory( btreePtr );
-	filePtr->fcbBtree = nil;
+	filePtr->fcbBtree = NULL;
 
 //	LogEndTime(kTraceCloseBTree, noErr);
 
@@ -643,7 +643,7 @@ Function:	Search for position in B*Tree indicated by searchKey. If a valid node
 
 Input:		pathPtr			- pointer to path for BTree file.
 			searchKey		- pointer to search key to match.
-			hintPtr			- pointer to hint (may be nil)
+			hintPtr			- pointer to hint (may be NULL)
 
 Output:		record			- pointer to BufferDescriptor containing record
 			recordLen		- length of data at recordPtr
@@ -678,14 +678,14 @@ OSStatus	BTSearchRecord		(SFCB						*filePtr,
 
 //	LogStartTime(kTraceSearchBTree);
 
-	if (filePtr == nil)									return	paramErr;
-	if (searchIterator == nil)							return	paramErr;
+	if (filePtr == NULL)		return	paramErr;
+	if (searchIterator == NULL)	return	paramErr;
 
 	btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
-	if (btreePtr == nil)								return	fsBTInvalidFileErr;
+	if (btreePtr == NULL)		return	fsBTInvalidFileErr;
 
 #if SupportsKeyDescriptors
-	if (btreePtr->keyCompareProc == nil)		// CheckKey if we using Key Descriptor
+	if (btreePtr->keyCompareProc == NULL)		// CheckKey if we using Key Descriptor
 	{
 		err = CheckKey (&searchIterator->key, btreePtr->keyDescPtr, btreePtr->maxKeyLength);
 		M_ExitOnError (err);
@@ -775,9 +775,9 @@ OSStatus	BTSearchRecord		(SFCB						*filePtr,
 		//¥¥ Should check for errors! Or BlockMove could choke on recordPtr!!!
 		GetRecordByIndex (btreePtr, node.buffer, index, &keyPtr, &recordPtr, &len);
 
-		if (recordLen != nil)			*recordLen = len;
+		if (recordLen != NULL)	*recordLen = len;
 
-		if (record != nil)
+		if (record != NULL)
 		{
 			ByteCount recordSize;
 
@@ -794,7 +794,7 @@ OSStatus	BTSearchRecord		(SFCB						*filePtr,
 
 	/////////////////////// Success - Update Iterator ///////////////////////////
 
-	if (resultIterator != nil)
+	if (resultIterator != NULL)
 	{
 		resultIterator->hint.writeCount	= btreePtr->writeCount;
 		resultIterator->hint.nodeNum	= nodeNum;
@@ -825,10 +825,10 @@ OSStatus	BTSearchRecord		(SFCB						*filePtr,
 
 ErrorExit:
 
-	if (recordLen != nil)
+	if (recordLen != NULL)
 		*recordLen = 0;
 
-	if (resultIterator != nil)
+	if (resultIterator != NULL)
 	{
 		resultIterator->hint.writeCount	= 0;
 		resultIterator->hint.nodeNum	= 0;
@@ -892,18 +892,18 @@ OSStatus	BTIterateRecord		(SFCB						*filePtr,
 
 	////////////////////////// Priliminary Checks ///////////////////////////////
 
-	left.buffer		= nil;
-	right.buffer	= nil;
-	node.buffer		= nil;
+	left.buffer		= NULL;
+	right.buffer	= NULL;
+	node.buffer		= NULL;
 
 
-	if (filePtr == nil)
+	if (filePtr == NULL)
 	{
 		return	paramErr;
 	}
 
 	btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
-	if (btreePtr == nil)
+	if (btreePtr == NULL)
 	{
 		return	fsBTInvalidFileErr;			//¥¥ handle properly
 	}
@@ -968,7 +968,7 @@ OSStatus	BTIterateRecord		(SFCB						*filePtr,
 		}
 		else
 		{
-			if (left.buffer == nil)
+			if (left.buffer == NULL)
 			{
 				nodeNum = ((NodeDescPtr) node.buffer)->bLink;
 				if ( nodeNum > 0)
@@ -981,13 +981,13 @@ OSStatus	BTIterateRecord		(SFCB						*filePtr,
 				}
 			}
 			//	Before we stomp on "right", we'd better release it if needed
-			if (right.buffer != nil) {
+			if (right.buffer != NULL) {
 				err = ReleaseNode(btreePtr, &right);
 				M_ExitOnError(err);
 			}
 			right		= node;
 			node		= left;
-			left.buffer	= nil;
+			left.buffer	= NULL;
 			index 		= ((NodeDescPtr) node.buffer)->numRecords -1;
 		}
 	}
@@ -1012,7 +1012,7 @@ OSStatus	BTIterateRecord		(SFCB						*filePtr,
 		}
 		else
 		{
-			if (right.buffer == nil)
+			if (right.buffer == NULL)
 			{
 				nodeNum = ((NodeDescPtr) node.buffer)->fLink;
 				if ( nodeNum > 0)
@@ -1025,13 +1025,13 @@ OSStatus	BTIterateRecord		(SFCB						*filePtr,
 				}
 			}
 			//	Before we stomp on "left", we'd better release it if needed
-			if (left.buffer != nil) {
+			if (left.buffer != NULL) {
 				err = ReleaseNode(btreePtr, &left);
 				M_ExitOnError(err);
 			}
 			left		 = node;
 			node		 = right;
-			right.buffer = nil;
+			right.buffer = NULL;
 			index		 = 0;
 		}
 	}
@@ -1054,9 +1054,9 @@ CopyData:
 	err = GetRecordByIndex (btreePtr, node.buffer, index, &keyPtr, &recordPtr, &len);
 	M_ExitOnError (err);
 
-	if (recordLen != nil)			*recordLen = len;
+	if (recordLen != NULL)			*recordLen = len;
 
-	if (record != nil)
+	if (record != NULL)
 	{
 		ByteCount recordSize;
 
@@ -1069,7 +1069,7 @@ CopyData:
 		CopyMemory (recordPtr, record->bufferAddress, len);
 	}
 
-	if (iterator != nil)						// first & last do not require iterator
+	if (iterator != NULL)						// first & last do not require iterator
 	{
 		iterator->hint.writeCount	= btreePtr->writeCount;
 		iterator->hint.nodeNum		= nodeNum;
@@ -1089,13 +1089,13 @@ CopyData:
 	err = ReleaseNode (btreePtr, &node);
 	M_ExitOnError (err);
 
-	if (left.buffer != nil)
+	if (left.buffer != NULL)
 	{
 		err = ReleaseNode (btreePtr, &left);
 		M_ExitOnError (err);
 	}
 
-	if (right.buffer != nil)
+	if (right.buffer != NULL)
 	{
 		err = ReleaseNode (btreePtr, &right);
 		M_ExitOnError (err);
@@ -1113,10 +1113,10 @@ ErrorExit:
 	(void)	ReleaseNode (btreePtr, &node);
 	(void)	ReleaseNode (btreePtr, &right);
 
-	if (recordLen != nil)
+	if (recordLen != NULL)
 		*recordLen = 0;
 
-	if (iterator != nil)
+	if (iterator != NULL)
 	{
 		iterator->hint.writeCount	= 0;
 		iterator->hint.nodeNum		= 0;
@@ -1157,7 +1157,7 @@ OSStatus	BTInsertRecord		(SFCB						*filePtr,
 
 	////////////////////////// Priliminary Checks ///////////////////////////////
 
-	nodeRec.buffer = nil;					// so we can call ReleaseNode
+	nodeRec.buffer = NULL;					// so we can call ReleaseNode
 
 	err = CheckInsertParams (filePtr, iterator, record, recordLen);
 	if (err != noErr)
@@ -1317,7 +1317,7 @@ OSStatus	BTSetRecord			(SFCB						*filePtr,
 
 	////////////////////////// Priliminary Checks ///////////////////////////////
 
-	nodeRec.buffer = nil;					// so we can call ReleaseNode
+	nodeRec.buffer = NULL;					// so we can call ReleaseNode
 
 	err = CheckInsertParams (filePtr, iterator, record, recordLen);
 	if (err != noErr)
@@ -1506,7 +1506,7 @@ OSStatus	BTReplaceRecord		(SFCB						*filePtr,
 
 	////////////////////////// Priliminary Checks ///////////////////////////////
 
-	nodeRec.buffer = nil;					// so we can call ReleaseNode
+	nodeRec.buffer = NULL;					// so we can call ReleaseNode
 
 	err = CheckInsertParams (filePtr, iterator, record, recordLen);
 	if (err != noErr)
@@ -1645,20 +1645,20 @@ OSStatus	BTDeleteRecord		(SFCB						*filePtr,
 
 	////////////////////////// Priliminary Checks ///////////////////////////////
 
-	nodeRec.buffer = nil;					// so we can call ReleaseNode
+	nodeRec.buffer = NULL;					// so we can call ReleaseNode
 
-	M_ReturnErrorIf (filePtr == nil, 	paramErr);
-	M_ReturnErrorIf (iterator == nil,	paramErr);
+	M_ReturnErrorIf (filePtr == NULL, 	paramErr);
+	M_ReturnErrorIf (iterator == NULL,	paramErr);
 
 	btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
-	if (btreePtr == nil)
+	if (btreePtr == NULL)
 	{
 		err = fsBTInvalidFileErr;
 		goto ErrorExit;
 	}
 
 #if SupportsKeyDescriptors
-	if (btreePtr->keyDescPtr != nil)
+	if (btreePtr->keyDescPtr != NULL)
 	{
 		err = CheckKey (&iterator->key, btreePtr->keyDescPtr, btreePtr->maxKeyLength);
 		M_ExitOnError (err);
@@ -1712,12 +1712,12 @@ OSStatus	BTGetInformation	(SFCB					*filePtr,
 	BTreeControlBlockPtr	btreePtr;
 
 
-	M_ReturnErrorIf (filePtr == nil, 	paramErr);
+	M_ReturnErrorIf (filePtr == NULL, 	paramErr);
 
 	btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
 
-	M_ReturnErrorIf (btreePtr == nil,	fsBTInvalidFileErr);
-	M_ReturnErrorIf (info == nil,		paramErr);
+	M_ReturnErrorIf (btreePtr == NULL,	fsBTInvalidFileErr);
+	M_ReturnErrorIf (info == NULL,		paramErr);
 
 	//¥¥ check version?
 
@@ -1730,7 +1730,7 @@ OSStatus	BTGetInformation	(SFCB					*filePtr,
 	info->keyDescriptor	= btreePtr->keyDescPtr;	//¥¥ this won't do at all...
 	info->reserved		= 0;
 
-	if (btreePtr->keyDescPtr == nil)
+	if (btreePtr->keyDescPtr == NULL)
 		info->keyDescLength	= 0;
 	else
 		info->keyDescLength	= (UInt32) btreePtr->keyDescPtr->length;
@@ -1762,11 +1762,11 @@ OSStatus	BTFlushPath				(SFCB					*filePtr)
 
 //	LogStartTime(kTraceFlushBTree);
 
-	M_ReturnErrorIf (filePtr == nil, 	paramErr);
+	M_ReturnErrorIf (filePtr == NULL, 	paramErr);
 
 	btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
 
-	M_ReturnErrorIf (btreePtr == nil,	fsBTInvalidFileErr);
+	M_ReturnErrorIf (btreePtr == NULL,	fsBTInvalidFileErr);
 
 	err = UpdateHeader (btreePtr);
 
@@ -1788,13 +1788,13 @@ Input:		iterator	- pointer to BTreeIterator
 Output:		iterator	- iterator with the hint.nodeNum cleared
 
 Result:		noErr			- success
-			paramErr	- iterator == nil
+			paramErr	- iterator == NULL
 -------------------------------------------------------------------------------*/
 
 
 OSStatus	BTInvalidateHint	(BTreeIterator				*iterator )
 {
-	if (iterator == nil)
+	if (iterator == NULL)
 		return	paramErr;
 
 	iterator->hint.nodeNum = 0;
diff --git a/fsck_hfs.tproj/dfalib/BTreeAllocate.c b/fsck_hfs.tproj/dfalib/BTreeAllocate.c
index 485d867..02bdd8d 100644
--- a/fsck_hfs.tproj/dfalib/BTreeAllocate.c
+++ b/fsck_hfs.tproj/dfalib/BTreeAllocate.c
@@ -83,7 +83,7 @@ OSStatus	AllocateNode (BTreeControlBlockPtr		btreePtr, UInt32	*nodeNum)
 	
 	
 	nodeNumber		= 0;				// first node number of header map record
-	node.buffer		= nil;				// clear node.buffer to get header node
+	node.buffer		= NULL;				// clear node.buffer to get header node
 										//	- and for ErrorExit
 	
 	while (true)
@@ -192,7 +192,7 @@ OSStatus	FreeNode (BTreeControlBlockPtr		btreePtr, UInt32	nodeNum)
 
 	//////////////////////////// Find Map Record ////////////////////////////////
 	nodeIndex			= 0;				// first node number of header map record
-	node.buffer			= nil;				// invalidate node.buffer to get header node
+	node.buffer			= NULL;				// invalidate node.buffer to get header node
 	
 	while (nodeNum >= nodeIndex)
 	{
@@ -278,8 +278,8 @@ OSStatus	ExtendBTree	(BTreeControlBlockPtr	btreePtr,
 	nodeSize			= btreePtr->nodeSize;
 	filePtr				= btreePtr->fcbPtr;
 	
-	mapNode.buffer		= nil;
-	newNode.buffer		= nil;
+	mapNode.buffer		= NULL;
+	newNode.buffer		= NULL;
 
 	mapNodeRecSize	= nodeSize - sizeof(BTNodeDescriptor) - 6;	// 2 bytes of free space (see note)
 
@@ -448,7 +448,7 @@ ErrorExit:
 Routine:	GetMapNode	-	Get the next map node and pointer to the map record.
 
 Function:	Given a BlockDescriptor to a map node in nodePtr, GetMapNode releases
-			it and gets the next node. If nodePtr->buffer is nil, then the header
+			it and gets the next node. If nodePtr->buffer is NULL, then the header
 			node is retrieved.
 
 
@@ -474,7 +474,7 @@ OSStatus	GetMapNode (BTreeControlBlockPtr	  btreePtr,
 	UInt16		mapIndex;
 	UInt32		nextNodeNum;
 	
-	if (nodePtr->buffer != nil)		// if iterator is valid...
+	if (nodePtr->buffer != NULL)		// if iterator is valid...
 	{
 		nextNodeNum = ((NodeDescPtr)nodePtr->buffer)->fLink;
 		if (nextNodeNum == 0)
@@ -521,7 +521,7 @@ ErrorExit:
 	
 	(void) ReleaseNode (btreePtr, nodePtr);
 	
-	*mapPtr		= nil;
+	*mapPtr		= NULL;
 	*mapSize	= 0;
 	
 	return	err;
diff --git a/fsck_hfs.tproj/dfalib/BTreeMiscOps.c b/fsck_hfs.tproj/dfalib/BTreeMiscOps.c
index 7c9edca..997f34b 100644
--- a/fsck_hfs.tproj/dfalib/BTreeMiscOps.c
+++ b/fsck_hfs.tproj/dfalib/BTreeMiscOps.c
@@ -236,13 +236,13 @@ OSStatus	FindIteratorPosition	(BTreeControlBlockPtr	 btreePtr,
 	// assume index points to UInt16
 	// assume foundRecord points to Boolean
 	
-	left->buffer		= nil;
-	middle->buffer		= nil;
-	right->buffer		= nil;
+	left->buffer		= NULL;
+	middle->buffer		= NULL;
+	right->buffer		= NULL;
 	
 	foundIt				= false;
 	
-	if (iterator == nil)						// do we have an iterator?
+	if (iterator == NULL)						// do we have an iterator?
 	{
 		err = fsBTInvalidIteratorErr;
 		goto ErrorExit;
@@ -250,7 +250,7 @@ OSStatus	FindIteratorPosition	(BTreeControlBlockPtr	 btreePtr,
 
 #if SupportsKeyDescriptors
 	//¥¥ verify iterator key (change CheckKey to take btreePtr instead of keyDescPtr?)
-	if (btreePtr->keyDescPtr != nil)
+	if (btreePtr->keyDescPtr != NULL)
 	{
 		err = CheckKey (&iterator->key, btreePtr->keyDescPtr, btreePtr->maxKeyLength );
 		M_ExitOnError (err);
@@ -309,7 +309,7 @@ OSStatus	FindIteratorPosition	(BTreeControlBlockPtr	 btreePtr,
 		{
 			*right			= *middle;
 			*middle			= *left;
-			left->buffer	= nil;
+			left->buffer	= NULL;
 			index			= leftIndex;
 			
 			goto SuccessfulExit;
@@ -330,7 +330,7 @@ OSStatus	FindIteratorPosition	(BTreeControlBlockPtr	 btreePtr,
 		{
 			*right			= *middle;
 			*middle			= *left;
-			left->buffer	= nil;
+			left->buffer	= NULL;
 			index			= leftIndex;
 			
 			goto SuccessfulExit;
@@ -363,7 +363,7 @@ OSStatus	FindIteratorPosition	(BTreeControlBlockPtr	 btreePtr,
 		{
 			*left			= *middle;
 			*middle			= *right;
-			right->buffer	= nil;
+			right->buffer	= NULL;
 			index			= rightIndex;
 			
 			goto SuccessfulExit;
@@ -427,15 +427,15 @@ OSStatus	CheckInsertParams		(SFCB						*filePtr,
 {
 	BTreeControlBlockPtr	btreePtr;
 	
-	if (filePtr == nil)									return	paramErr;
+	if (filePtr == NULL)									return	paramErr;
 
 	btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
-	if (btreePtr == nil)								return	fsBTInvalidFileErr;
-	if (iterator == nil)								return	paramErr;
-	if (record	 == nil)								return	paramErr;
+	if (btreePtr == NULL)								return	fsBTInvalidFileErr;
+	if (iterator == NULL)								return	paramErr;
+	if (record	 == NULL)								return	paramErr;
 	
 #if SupportsKeyDescriptors
-	if (btreePtr->keyDescPtr != nil)
+	if (btreePtr->keyDescPtr != NULL)
 	{
 		OSStatus	err;
 
diff --git a/fsck_hfs.tproj/dfalib/BTreeNodeOps.c b/fsck_hfs.tproj/dfalib/BTreeNodeOps.c
index da07cc7..ef2bd7b 100644
--- a/fsck_hfs.tproj/dfalib/BTreeNodeOps.c
+++ b/fsck_hfs.tproj/dfalib/BTreeNodeOps.c
@@ -105,7 +105,7 @@ Function:	Gets an existing BTree node from FS Agent and verifies it.
 Input:		btreePtr	- pointer to BTree control block
 			nodeNum		- number of node to request
 			
-Output:		nodePtr		- pointer to beginning of node (nil if error)
+Output:		nodePtr		- pointer to beginning of node (NULL if error)
 			
 Result:
 			noErr		- success
@@ -139,7 +139,7 @@ OSStatus	GetNode		(BTreeControlBlockPtr	 btreePtr,
 	if (err != noErr)
 	{
 		Panic ("\pGetNode: getNodeProc returned error.");
-		nodePtr->buffer = nil;
+		nodePtr->buffer = NULL;
 		goto ErrorExit;
 	}
 	++btreePtr->numGetNodes;
@@ -156,8 +156,8 @@ OSStatus	GetNode		(BTreeControlBlockPtr	 btreePtr,
 	return noErr;
 
 ErrorExit:
-	nodePtr->buffer			= nil;
-	nodePtr->blockHeader	= nil;
+	nodePtr->buffer		= NULL;
+	nodePtr->blockHeader	= NULL;
 	
 //	LogEndTime(kTraceGetNode, err);
 
@@ -176,7 +176,7 @@ Function:	Gets a new BTree node from FS Agent and initializes it to an empty
 Input:		btreePtr		- pointer to BTree control block
 			nodeNum			- number of node to request
 			
-Output:		returnNodePtr	- pointer to beginning of node (nil if error)
+Output:		returnNodePtr	- pointer to beginning of node (NULL if error)
 			
 Result:		noErr		- success
 			!= noErr	- failure
@@ -203,7 +203,7 @@ OSStatus	GetNewNode	(BTreeControlBlockPtr	 btreePtr,
 	if (err != noErr)
 	{
 		Panic ("\pGetNewNode: getNodeProc returned error.");
-		returnNodePtr->buffer = nil;
+		returnNodePtr->buffer = NULL;
 		return err;
 	}
 	++btreePtr->numGetNewNodes;
@@ -248,7 +248,7 @@ OSStatus	ReleaseNode	(BTreeControlBlockPtr	 btreePtr,
 
 	err = noErr;
 	
-	if (nodePtr->buffer != nil)
+	if (nodePtr->buffer != NULL)
 	{
 		/*
 		 * The nodes must remain in the cache as big endian!
@@ -267,8 +267,8 @@ OSStatus	ReleaseNode	(BTreeControlBlockPtr	 btreePtr,
 		++btreePtr->numReleaseNodes;
 	}
 	
-	nodePtr->buffer = nil;
-	nodePtr->blockHeader = nil;
+	nodePtr->buffer = NULL;
+	nodePtr->blockHeader = NULL;
 	
 //	LogEndTime(kTraceReleaseNode, err);
 
@@ -299,7 +299,7 @@ OSStatus	TrashNode	(BTreeControlBlockPtr	 btreePtr,
 
 	err = noErr;
 	
-	if (nodePtr->buffer != nil)
+	if (nodePtr->buffer != NULL)
 	{
 		releaseNodeProc = btreePtr->releaseBlockProc;
 		err = releaseNodeProc (btreePtr->fcbPtr,
@@ -309,8 +309,8 @@ OSStatus	TrashNode	(BTreeControlBlockPtr	 btreePtr,
 		++btreePtr->numReleaseNodes;
 	}
 
-	nodePtr->buffer			= nil;
-	nodePtr->blockHeader	= nil;
+	nodePtr->buffer		= NULL;
+	nodePtr->blockHeader	= NULL;
 	
 	return err;
 }
@@ -338,7 +338,7 @@ OSStatus	UpdateNode	(BTreeControlBlockPtr	 btreePtr,
 	
 	err = noErr;
 		
-	if (nodePtr->buffer != nil)			//¥¥ why call UpdateNode if nil ?!?
+	if (nodePtr->buffer != NULL)			//¥¥ why call UpdateNode if NULL ?!?
 	{
 	//	LogStartTime(kTraceReleaseNode);
 		err = hfs_swap_BTNode(nodePtr, btreePtr->fcbPtr, kSwapBTNodeHostToBig);
@@ -358,8 +358,8 @@ OSStatus	UpdateNode	(BTreeControlBlockPtr	 btreePtr,
 		++btreePtr->numUpdateNodes;
 	}
 	
-	nodePtr->buffer			= nil;
-	nodePtr->blockHeader	= nil;
+	nodePtr->buffer		= NULL;
+	nodePtr->blockHeader	= NULL;
 
 	return	noErr;
 
diff --git a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c
index 37fb170..73e1fda 100644
--- a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c
+++ b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c
@@ -177,7 +177,7 @@ Output:		nodeNum			- number of the node containing the key position
 			
 Result:		noErr			- key found, index is record index
 			fsBTRecordNotFoundErr	- key not found, index is insert index
-			fsBTEmptyErr		- key not found, return params are nil
+			fsBTEmptyErr		- key not found, return params are NULL
 			otherwise			- catastrophic failure (GetNode/ReleaseNode failed)
 -------------------------------------------------------------------------------*/
 
@@ -321,8 +321,8 @@ ReleaseAndExit:
 ErrorExit:
 	
 	*nodeNum					= 0;
-	nodePtr->buffer				= nil;
-	nodePtr->blockHeader		= nil;
+	nodePtr->buffer				= NULL;
+	nodePtr->blockHeader		= NULL;
 	*returnIndex				= 0;
 
 	return	err;
@@ -354,7 +354,7 @@ OSStatus	InsertTree ( BTreeControlBlockPtr		 btreePtr,
 	primaryKey.replacingKey	= replacingKey;
 	primaryKey.skipRotate	= false;
 
-	err	= InsertLevel (btreePtr, treePathTable, &primaryKey, nil,
+	err	= InsertLevel (btreePtr, treePathTable, &primaryKey, NULL,
 					   targetNode, index, level, insertNode );
 						
 	return err;
@@ -385,7 +385,7 @@ OSStatus	InsertLevel (BTreeControlBlockPtr		 btreePtr,
 #if defined(applec) && !defined(__SC__)
 	PanicIf ((level == 1) && (((NodeDescPtr)targetNode->buffer)->kind != kBTLeafNode), "\P InsertLevel: non-leaf at level 1! ");
 #endif
-	siblingNode.buffer = nil;
+	siblingNode.buffer = NULL;
 	targetNodeNum = treePathTable [level].node;
 
 	insertParent = false;
@@ -420,7 +420,7 @@ OSStatus	InsertLevel (BTreeControlBlockPtr		 btreePtr,
 	
 	////// process second insert (if any) //////
 
-	if  ( secondaryKey != nil )
+	if (secondaryKey != NULL)
 	{
 		Boolean				temp;
 
@@ -446,7 +446,7 @@ OSStatus	InsertLevel (BTreeControlBlockPtr		 btreePtr,
 		UInt8 *				recPtr;
 		UInt16				recSize;
 		
-		secondaryKey = nil;
+		secondaryKey = NULL;
 		
 		PanicIf ( (level == btreePtr->treeDepth), "InsertLevel: unfinished insert!?");
 
@@ -606,9 +606,9 @@ static OSErr	InsertNode	(BTreeControlBlockPtr	 btreePtr,
 	
 	if ( leftNodeNum > 0 )
 	{
-		PanicIf ( siblingNode->buffer != nil, "InsertNode: siblingNode already aquired!");
+		PanicIf(siblingNode->buffer != NULL, "InsertNode: siblingNode already aquired!");
 
-		if ( siblingNode->buffer == nil )
+		if (siblingNode->buffer == NULL)
 		{
 			err = GetNode (btreePtr, leftNodeNum, siblingNode);	// will be released by caller or a split below
 			M_ExitOnError (err);
@@ -703,7 +703,7 @@ OSStatus	DeleteTree			(BTreeControlBlockPtr		 btreePtr,
 
 	targetNodeNum = treePathTable[level].node;
 	targetNodePtr = targetNode->buffer;
-	PanicIf (targetNodePtr == nil, "DeleteTree: targetNode has nil buffer!");
+	PanicIf (targetNodePtr == NULL, "DeleteTree: targetNode has NULL buffer!");
 
 	DeleteRecord (btreePtr, targetNodePtr, index);
 		
@@ -766,7 +766,7 @@ OSStatus	DeleteTree			(BTreeControlBlockPtr		 btreePtr,
 		deleteRequired = false;
 		updateRequired = false;
 		
-		if ( targetNode->buffer == nil )	// then root was freed and the btree is empty
+		if (targetNode->buffer == NULL)	// then root was freed and the btree is empty
 		{
 			btreePtr->rootNode  = 0;
 			btreePtr->treeDepth = 0;
@@ -1124,7 +1124,7 @@ static OSStatus	SplitLeft		(BTreeControlBlockPtr		 btreePtr,
 	if ( (right->height == 1) && (right->kind != kBTLeafNode) )
 		return	fsBTInvalidNodeErr;
 	
-	if ( left != nil )
+	if (left != NULL)
 	{
 		if ( left->fLink != rightNodeNum )
 			return fsBTInvalidNodeErr;										//¥¥ E_BadSibling ?
@@ -1145,7 +1145,7 @@ static OSStatus	SplitLeft		(BTreeControlBlockPtr		 btreePtr,
 
 	/////////////// Update Forward Link In Original Left Node ///////////////////
 
-	if ( left != nil )
+	if (left != NULL)
 	{
 		left->fLink	= newNodeNum;
 		err = UpdateNode (btreePtr, leftNode);
@@ -1240,8 +1240,8 @@ static OSStatus	AddNewRootNode	(BTreeControlBlockPtr	 btreePtr,
 	Boolean				didItFit;
 	UInt16				keyLength;	
 	
-	PanicIf (leftNode == nil, "AddNewRootNode: leftNode == nil");
-	PanicIf (rightNode == nil, "AddNewRootNode: rightNode == nil");
+	PanicIf (leftNode == NULL, "AddNewRootNode: leftNode == NULL");
+	PanicIf (rightNode == NULL, "AddNewRootNode: rightNode == NULL");
 	
 	
 	/////////////////////// Initialize New Root Node ////////////////////////////
@@ -1362,7 +1362,7 @@ static OSStatus	SplitRight		(BTreeControlBlockPtr		 btreePtr,
 	if ( (leftPtr->height == 1) && (leftPtr->kind != kBTLeafNode) )
 		return	fsBTInvalidNodeErr;
 	
-	if ( rightPtr != nil )
+	if (rightPtr != NULL)
 	{
 		if ( rightPtr->bLink != nodeNum )
 			return fsBTInvalidNodeErr;										//¥¥ E_BadSibling ?
@@ -1382,7 +1382,7 @@ static OSStatus	SplitRight		(BTreeControlBlockPtr		 btreePtr,
 
 	/////////////// Update backward Link In Original Right Node ///////////////////
 
-	if ( rightPtr != nil )
+	if (rightPtr != NULL)
 	{
 		rightPtr->bLink	= newNodeNum;
 		err = UpdateNode (btreePtr, rightNodePtr);
@@ -1739,7 +1739,7 @@ static int DoKeyCheck( NodeDescPtr nodeP, BTreeControlBlock *btcb )
 	UInt16				keyLength;
 	KeyPtr 				keyPtr;
 	UInt8				*dataPtr;
-	KeyPtr				prevkeyP	= nil;
+	KeyPtr				prevkeyP	= NULL;
 
 
 	if ( nodeP->numRecords == 0 )
@@ -1766,7 +1766,7 @@ static int DoKeyCheck( NodeDescPtr nodeP, BTreeControlBlock *btcb )
 				return( -1 );
 			}
 	
-			if ( prevkeyP != nil )
+			if (prevkeyP != NULL)
 			{
 				if ( CompareKeys( (BTreeControlBlockPtr)btcb, prevkeyP, keyPtr ) >= 0 )
 				{
diff --git a/fsck_hfs.tproj/dfalib/SControl.c b/fsck_hfs.tproj/dfalib/SControl.c
index 8b03ece..d3145e0 100644
--- a/fsck_hfs.tproj/dfalib/SControl.c
+++ b/fsck_hfs.tproj/dfalib/SControl.c
@@ -82,7 +82,7 @@ CheckHFS( 	int fsReadRef, int fsWriteRef, int checkLevel, int repairLevel,
 {
 	SGlob				dataArea;	// Allocate the scav globals
 	short				temp; 	
-	FileIdentifierTable	*fileIdentifierTable	= nil;
+	FileIdentifierTable	*fileIdentifierTable	= NULL;
 	OSErr				err = noErr;
 	OSErr				scavError = 0;
 	int					scanCount = 0;
@@ -228,7 +228,7 @@ DoAgain:
 	}
 
 	//	Set up structures for post processing
-	if ( (autoRepair == true) && (dataArea.fileIdentifierTable != nil) )
+	if ((autoRepair == true) && (dataArea.fileIdentifierTable != NULL))
 	{
 	//	*repairInfo = *repairInfo | kVolumeHadOverlappingExtents;	//	Report back that volume has overlapping extents
 		fileIdentifierTable	= (FileIdentifierTable *) AllocateMemory( GetHandleSize( (Handle) dataArea.fileIdentifierTable ) );
@@ -239,7 +239,7 @@ DoAgain:
 	//
 	//	Post processing
 	//
-	if ( fileIdentifierTable != nil )
+	if (fileIdentifierTable != NULL)
 	{
 		DisposeMemory( fileIdentifierTable );
 	}
@@ -682,7 +682,7 @@ short CheckForStop( SGlob *GPtr )
 
 	//if ( ((ticks - 10) > GPtr->lastTickCount) || (dfaStage == kAboutToRepairStage) )			//	To reduce cursor flicker on fast machines, call through on a timed interval
 	//{
-		if ( GPtr->userCancelProc != nil )
+		if (GPtr->userCancelProc != NULL)
 		{
 			UInt64	progress = 0;
 			Boolean	progressChanged;
@@ -761,7 +761,7 @@ static int ScavSetUp( SGlob *GPtr)
 	short	ioRefNum;
 #endif
 
-	GPtr->MinorRepairsP = nil;
+	GPtr->MinorRepairsP = NULL;
 	
 	GPtr->itemsProcessed = 0;
 	GPtr->lastProgress = 0;
@@ -774,7 +774,7 @@ static int ScavSetUp( SGlob *GPtr)
 		ScavStaticStructures	*pointer;
 		
 		pointer = (ScavStaticStructures *) AllocateClearMemory( sizeof(ScavStaticStructures) );
-		if ( pointer == nil ) {
+		if (pointer == NULL) {
 			if ( GPtr->logLevel >= kDebugLog ) {
 				printf( "\t error %d - could not allocate %i bytes of memory \n",
 					R_NoMem, sizeof(ScavStaticStructures) );
@@ -831,7 +831,7 @@ static int ScavSetUp( SGlob *GPtr)
 	//	Save current value of vcbWrCnt, to detect modifications to volume by other apps etc
 	if ( GPtr->volumeFeatures & volumeIsMountedMask )
 	{
-		FlushVol( nil, GPtr->realVCB->vcbVRefNum );	//	Ask HFS to update all changes to disk
+		FlushVol(NULL, GPtr->realVCB->vcbVRefNum);	//	Ask HFS to update all changes to disk
 		GPtr->wrCnt = GPtr->realVCB->vcbWrCnt;		//	Remember write count after writing changes
 	}
 #endif
@@ -949,7 +949,7 @@ static int ScavSetUp( SGlob *GPtr)
  	
 	// Keep a valid file id list for HFS volumes
 	GPtr->validFilesList = (UInt32**)NewHandle( 0 );
-	if ( GPtr->validFilesList == nil ) {
+	if (GPtr->validFilesList == NULL) {
 		if ( GPtr->logLevel >= kDebugLog ) {
 			printf( "\t error %d - could not allocate file ID list \n", R_NoMem );
 		}
@@ -995,17 +995,17 @@ static int ScavTerm( SGlobPtr GPtr )
 
 	(void) BitMapCheckEnd();
 
-	while( (rP = GPtr->MinorRepairsP) != nil )		//	loop freeing leftover (undone) repair orders
+	while((rP = GPtr->MinorRepairsP) != NULL)		//	loop freeing leftover (undone) repair orders
 	{
 		GPtr->MinorRepairsP = rP->link;				//	(in case repairs were not made)
 		DisposeMemory(rP);
 		err = MemError();
 	}
 	
-	if( GPtr->validFilesList != nil )
+	if (GPtr->validFilesList != NULL)
 		DisposeHandle( (Handle) GPtr->validFilesList );
 	
-	if( GPtr->overlappedExtents != nil ) {
+	if (GPtr->overlappedExtents != NULL) {
  		extentsTableH = GPtr->overlappedExtents;
  	
 		/* Overlapped extents list also allocated memory for attribute name */
@@ -1021,44 +1021,44 @@ static int ScavTerm( SGlobPtr GPtr )
 		DisposeHandle( (Handle) GPtr->overlappedExtents );
 	}
 	
-	if( GPtr->fileIdentifierTable != nil )
+	if (GPtr->fileIdentifierTable != NULL)
 		DisposeHandle( (Handle) GPtr->fileIdentifierTable );
 	
-	if( GPtr->calculatedVCB == nil )								//	already freed?
+	if (GPtr->calculatedVCB == NULL)								//	already freed?
 		return( noErr );
 
 	//	If the FCB's and BTCB's have been set up, dispose of them
 	fcbP = GPtr->calculatedExtentsFCB;	// release extent file BTree bit map
-	if ( fcbP != nil )
+	if (fcbP != NULL)
 	{
 		btcbP = (BTreeControlBlock*)fcbP->fcbBtree;
-		if ( btcbP != nil)
+		if (btcbP != NULL)
 		{
-			if( btcbP->refCon != nil )
+			if (btcbP->refCon != NULL)
 			{
-				if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil)
+				if (((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != NULL)
 				{
 					DisposeMemory(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr);
 					err = MemError();
 				}
 				DisposeMemory( (Ptr)btcbP->refCon );
 				err = MemError();
-				btcbP->refCon = nil;
+				btcbP->refCon = NULL;
 			}
 				
 			fcbP = GPtr->calculatedCatalogFCB;	//	release catalog BTree bit map
 			btcbP = (BTreeControlBlock*)fcbP->fcbBtree;
 				
-			if( btcbP->refCon != nil )
+			if (btcbP->refCon != NULL)
 			{
-				if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil)
+				if (((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != NULL)
 				{
 					DisposeMemory(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr);
 					err = MemError();
 				}
 				DisposeMemory( (Ptr)btcbP->refCon );
 				err = MemError();
-				btcbP->refCon = nil;
+				btcbP->refCon = NULL;
 			}
 		}
 	}
@@ -1066,7 +1066,7 @@ static int ScavTerm( SGlobPtr GPtr )
 	DisposeMemory( GPtr->calculatedVCB );						//	Release our block of data structures	
 	err = MemError();
 
-	GPtr->calculatedVCB = nil;
+	GPtr->calculatedVCB = NULL;
 
 	return( noErr );
 }
@@ -1113,7 +1113,7 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr dqPtr )
 	// Now look at the name of the Driver name. If it is .BlueBoxShared keep it out of the list of available disks.
 	driverDCtlHandle = GetDCtlEntry(dqPtr->dQRefNum);
 	driverDCtlPtr = *driverDCtlHandle;
-	if((((driverDCtlPtr->dCtlFlags) & Is_Native_Mask) == 0) && (driverDCtlPtr->dCtlDriver != nil))
+	if((((driverDCtlPtr->dCtlFlags) & Is_Native_Mask) == 0) && (driverDCtlPtr->dCtlDriver != NULL))
 	{
 		if (((driverDCtlPtr->dCtlFlags) & Is_Ram_Based_Mask) == 0)
 		{
@@ -1127,19 +1127,19 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr dqPtr )
 			
 		}
 		driverName = (StringPtr)&(drvrHeaderPtr->drvrName);
-		if (!(IdenticalString(driverName,blueBoxSharedDriverName,nil)))
+		if (!(IdenticalString(driverName,blueBoxSharedDriverName,NULL)))
 		{
 			return( true );
 		}
 
 		// Special case for the ".Sony" floppy driver which might be accessed in Shared mode inside the Blue Box
 		// Test its "where" string instead of the driver name.
-		if (!(IdenticalString(driverName,sonyDriverName,nil)))
+		if (!(IdenticalString(driverName,sonyDriverName,NULL)))
 		{
 			CntrlParam			paramBlock;
 		
-			paramBlock.ioCompletion	= nil;
-			paramBlock.ioNamePtr	= nil;
+			paramBlock.ioCompletion	= NULL;
+			paramBlock.ioNamePtr	= NULL;
 			paramBlock.ioVRefNum	= dqPtr->dQDrive;
 			paramBlock.ioCRefNum	= dqPtr->dQRefNum;
 			paramBlock.csCode		= kDriveIcon;						// return physical icon
@@ -1152,7 +1152,7 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr dqPtr )
 				
 				iconAndStringRecPtr = * (IconAndStringRecPtr*) & paramBlock.csParam;
 				whereStringPtr = (StringPtr) & iconAndStringRecPtr->string;
-				if (!(IdenticalString(whereStringPtr,blueBoxFloppyWhereString,nil)))
+				if (!(IdenticalString(whereStringPtr,blueBoxFloppyWhereString,NULL)))
 				{
 					return( true );
 				}
diff --git a/fsck_hfs.tproj/dfalib/SRepair.c b/fsck_hfs.tproj/dfalib/SRepair.c
index 89c12d6..b261c37 100644
--- a/fsck_hfs.tproj/dfalib/SRepair.c
+++ b/fsck_hfs.tproj/dfalib/SRepair.c
@@ -844,7 +844,7 @@ static	int	DelFThd( SGlobPtr GPtr, UInt32 fid )				//	the file ID
 
 	isHFSPlus = VolumeObjectIsHFSPlus( );
 	
-	BuildCatalogKey( fid, (const CatalogName*) nil, isHFSPlus, &key );
+	BuildCatalogKey(fid, NULL, isHFSPlus, &key);
 	result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &record, &recSize, &hint );
 	
 	if ( result )	return ( IntError( GPtr, result ) );
@@ -910,7 +910,7 @@ static	OSErr	FixDirThread( SGlobPtr GPtr, UInt32 did )	//	the dir ID
 
 	isHFSPlus = VolumeObjectIsHFSPlus( );
 
-	BuildCatalogKey( did, (const CatalogName*) nil, isHFSPlus, &key );
+	BuildCatalogKey(did, NULL, isHFSPlus, &key);
 	result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &record, &recSize, &hint );
 	
 	if ( result )
@@ -2171,7 +2171,7 @@ static	OSErr	FixOrphanedFiles ( SGlobPtr GPtr )
 				}
 
 				//-- Build the key for the file thread
-				BuildCatalogKey( cNodeID, nil, isHFSPlus, &key );
+				BuildCatalogKey(cNodeID, NULL, isHFSPlus, &key);
 
 				err = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, 
 										 &tempKey, &threadRecord, &recordSize, &hint2 );
diff --git a/fsck_hfs.tproj/dfalib/SUtils.c b/fsck_hfs.tproj/dfalib/SUtils.c
index 6e9253e..491afbf 100644
--- a/fsck_hfs.tproj/dfalib/SUtils.c
+++ b/fsck_hfs.tproj/dfalib/SUtils.c
@@ -395,11 +395,11 @@ OSErr GetVolumeFeatures( SGlobPtr GPtr )
 	err = GetVCBDriveNum( &GPtr->realVCB, GPtr->DrvNum );
 	ReturnIfError( err );
 
-	if ( GPtr->realVCB != nil )
+	if (GPtr->realVCB != NULL)
 	{
 		GPtr->volumeFeatures	|= volumeIsMountedMask;
 
-		pb.ioParam.ioNamePtr	= nil;
+		pb.ioParam.ioNamePtr	= NULL;
 		pb.ioParam.ioVRefNum	= GPtr->realVCB->vcbVRefNum;
 		pb.ioParam.ioBuffer		= (Ptr) &buffer;
 		pb.ioParam.ioReqCount	= sizeof( buffer );
@@ -2282,7 +2282,7 @@ void print_prime_buckets(PrimeBuckets *cur);
  *     	   	4. btreetye - can be kHFSPlusCatalogRecord or kHFSPlusAttributeRecord
  *                            indicates which btree prime number bucket should be incremented
  *
- * Output:	nil
+ * Output:	NULL
  */
 void RecordXAttrBits(SGlobPtr GPtr, UInt16 flags, HFSCatalogNodeID fileid, UInt16 btreetype) 
 {
diff --git a/fsck_hfs.tproj/dfalib/SVerify1.c b/fsck_hfs.tproj/dfalib/SVerify1.c
index 39bda5c..c33155f 100644
--- a/fsck_hfs.tproj/dfalib/SVerify1.c
+++ b/fsck_hfs.tproj/dfalib/SVerify1.c
@@ -790,13 +790,13 @@ OSErr	CreateExtentsBTreeControlBlock( SGlobPtr GPtr )
 	//	set up our DFA extended BTCB area.  Will we have enough memory on all HFS+ volumes.
 	//
 	btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) );			// allocate space for our BTCB extensions
-	if ( btcb->refCon == nil ) {
+	if (btcb->refCon == NULL) {
 		err = R_NoMem;
 		goto exit;
 	}
 	size = (btcb->totalNodes + 7) / 8;											//	size of BTree bit map
 	((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = AllocateClearMemory(size);			//	get precleared bitmap
-	if ( ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == nil )
+	if (((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == NULL)
 	{
 		err = R_NoMem;
 		goto exit;
@@ -1145,13 +1145,13 @@ OSErr	CreateCatalogBTreeControlBlock( SGlobPtr GPtr )
 	//
 
 	btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) );			// allocate space for our BTCB extensions
-	if ( btcb->refCon == nil ) {
+	if (btcb->refCon == NULL) {
 		err = R_NoMem;
 		goto exit;
 	}
 	size = (btcb->totalNodes + 7) / 8;											//	size of BTree bit map
 	((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = AllocateClearMemory(size);			//	get precleared bitmap
-	if ( ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == nil )
+	if (((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == NULL)
 	{
 		err = R_NoMem;
 		goto exit;
@@ -1339,7 +1339,7 @@ OSErr CatHChk( SGlobPtr GPtr )
 	
 	//¥¥ Can we ignore this part by just taking advantage of setting the selCode = 0x8001;
 	{ 
-		BuildCatalogKey( 1, (const CatalogName *)nil, isHFSPlus, &key );
+		BuildCatalogKey(1, NULL, isHFSPlus, &key);
 		result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &threadRecord, &recSize, &hint );
 	
 		GPtr->TarBlock = hint;									/* set target block */
@@ -1443,7 +1443,7 @@ OSErr CatHChk( SGlobPtr GPtr )
 				/* 
 				 * Find thread record
 				 */
-				BuildCatalogKey( dprP->directoryID, (const CatalogName *) nil, isHFSPlus, &key );
+				BuildCatalogKey(dprP->directoryID, NULL, isHFSPlus, &key);
 				result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &threadRecord, &recSize, &hint );
 				if ( result != noErr ) {
 					char idStr[16];
@@ -1780,26 +1780,26 @@ OSErr	CreateAttributesBTreeControlBlock( SGlobPtr GPtr )
 	//	set up our DFA extended BTCB area.  Will we have enough memory on all HFS+ volumes.
 	//
 	btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) );			// allocate space for our BTCB extensions
-	if ( btcb->refCon == nil ) {
+	if (btcb->refCon == NULL) {
 		err = R_NoMem;
 		goto exit;
 	}
 
 	if (btcb->totalNodes == 0)
 	{
-		((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr			= nil;
+		((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr			= NULL;
 		((BTreeExtensionsRec*)btcb->refCon)->BTCBMSize			= 0;
 		((BTreeExtensionsRec*)btcb->refCon)->realFreeNodeCount	= 0;
 	}
 	else
 	{
-		if ( btcb->refCon == nil ) {
+		if (btcb->refCon == NULL) {
 			err = R_NoMem;
 			goto exit;
 		}
 		size = (btcb->totalNodes + 7) / 8;											//	size of BTree bit map
 		((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = AllocateClearMemory(size);			//	get precleared bitmap
-		if ( ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == nil )
+		if (((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == NULL)
 		{
 			err = R_NoMem;
 			goto exit;
@@ -2358,7 +2358,7 @@ static	OSErr	RcdMDBEmbededVolDescriptionErr( SGlobPtr GPtr, OSErr type, HFSMaste
 	RcdError( GPtr, type );												//	first, record the error
 	
 	p = AllocMinorRepairOrder( GPtr, sizeof(EmbededVolDescription) );	//	get the node
-	if ( p == nil )	return( R_NoMem );
+	if (p == NULL)	return( R_NoMem );
 	
 	p->type							=  type;							//	save error info
 	desc							=  (EmbededVolDescription *) &(p->name);
@@ -2397,7 +2397,7 @@ static	OSErr	RcdInvalidWrapperExtents( SGlobPtr GPtr, OSErr type )
 	RcdError( GPtr, type );												//	first, record the error
 	
 	p = AllocMinorRepairOrder( GPtr, 0 );	//	get the node
-	if ( p == nil )	return( R_NoMem );
+	if (p == NULL)	return( R_NoMem );
 	
 	p->type							=  type;							//	save error info
 	
@@ -3029,7 +3029,7 @@ OSErr	CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType,
 	foundBadExtent = false;
 	lastExtentIndex = GPtr->numExtents;
 	
-	while ( (extents != nil) && (err == noErr) )
+	while ((extents != NULL) && (err == noErr))
 	{	
 		//	checkout the extent record first
 		err = ChkExtRec( GPtr, extents, &lastExtentIndex );
@@ -3105,7 +3105,7 @@ OSErr	CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType,
 			if ( err == btNotFound )
 			{
 				err = noErr;								//	 no more extent records
-				extents = nil;
+				extents = NULL;
 				break;
 			}
 			else if ( err != noErr )
@@ -3121,7 +3121,7 @@ OSErr	CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType,
 			if ( err == btNotFound )
 			{
 				err = noErr;								//	 no more extent records
-				extents = nil;
+				extents = NULL;
 				break;
 			}
 			else if ( err != noErr )
@@ -3205,7 +3205,7 @@ static OSErr	AddExtentToOverlapList( SGlobPtr GPtr, HFSCatalogNodeID fileNumber,
 	}
 	
 	//	If it's uninitialized
-	if ( GPtr->overlappedExtents == nil )
+	if (GPtr->overlappedExtents == NULL)
 	{
 		GPtr->overlappedExtents	= (ExtentsTable **) NewHandleClear( sizeof(ExtentsTable) );
 		extentsTableH	= GPtr->overlappedExtents;
diff --git a/fsck_hfs.tproj/dfalib/SVerify2.c b/fsck_hfs.tproj/dfalib/SVerify2.c
index c68f3d8..da1a982 100644
--- a/fsck_hfs.tproj/dfalib/SVerify2.c
+++ b/fsck_hfs.tproj/dfalib/SVerify2.c
@@ -1013,7 +1013,7 @@ static int BTKeyChk( SGlobPtr GPtr, NodeDescPtr nodeP, BTreeControlBlock *btcb )
 	UInt16				keyLength;
 	KeyPtr 				keyPtr;
 	UInt8				*dataPtr;
-	KeyPtr				prevkeyP	= nil;
+	KeyPtr				prevkeyP	= NULL;
 
 
 	if ( nodeP->numRecords == 0 )
@@ -1044,7 +1044,7 @@ static int BTKeyChk( SGlobPtr GPtr, NodeDescPtr nodeP, BTreeControlBlock *btcb )
 				return( E_KeyLen );
 			}
 	
-			if ( prevkeyP != nil )
+			if (prevkeyP != NULL)
 			{
 				if ( CompareKeys( (BTreeControlBlockPtr)btcb, prevkeyP, keyPtr ) >= 0 )
 				{