Skip to content

Commit 5ccde61

Browse files
committed
minor tweaks
1 parent cde44d1 commit 5ccde61

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

chapter08/8-1.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
* Exercise 8-1. Rewrite the program cat from Chapter 7 using read, write, open
33
* and close instead of their standard library equivalents. Perform experiments
44
* to determine the relative speeds of the two version.
5-
* Note: this version of cat is faster.
5+
*
66
* By Faisal Saadatmand
77
*/
88

9+
/* Note: this version of cat is faster */
10+
911
#include <unistd.h> /* for read and write */
1012
#include <fcntl.h> /* for open and close */
1113
#include <stdio.h> /* also needed for BUFSIZ */

chapter08/8-2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Exercise 8-2. Rewrite fopen and _fillbuf with fields instead of explicit bit
33
* operations. Compare code size and execution speed.
4+
*
45
* By Faisal Saadatmand
56
*/
67

chapter08/8-8.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ int main(void)
195195
printf("*** Add array's memory block to free list ***\n");
196196
nblocks++;
197197
for (p = &base, i = 1; i <= nblocks; p = p->s.ptr, i++)
198-
printf("block %i (address: %p size: %u ptr: %p)\n"
199-
, i, p, p->s.size, p->s.ptr);
198+
printf("block %i (address: %p size: %u ptr: %p)\n", i, (void *) p,
199+
p->s.size, (void *) p->s.ptr);
200200
printf("\n");
201201
}
202202

@@ -206,8 +206,8 @@ int main(void)
206206
else {
207207
printf("*** allocate freed memory with knr_malloc ***\n");
208208
for (p = &base, i = 1; i <= nblocks; p = p->s.ptr, i++)
209-
printf("block %i (address: %p size: %u ptr: %p)\n"
210-
, i, p, p->s.size, p->s.ptr);
209+
printf("block %i (address: %p size: %u ptr: %p)\n", i, (void *) p,
210+
p->s.size, (void *) p->s.ptr);
211211
printf("\n");
212212
}
213213

0 commit comments

Comments
 (0)