summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-03-11 22:07:21 +0000
committerJim Meyering <jim@meyering.net>1996-03-11 22:07:21 +0000
commit6526b374602c1bcc5bd818e3069227c32c7642c1 (patch)
treecac10f13290a00482ee666f8eb979c7b4952b1dd /src
parent9379b5aed530ca91cc2ba3d366156751983b48e8 (diff)
downloadcoreutils-6526b374602c1bcc5bd818e3069227c32c7642c1.tar.xz
(write_bytes): Renamed from xfwrite.
Remove SIZE parameter. It was always 1. Update all callers. Rename NELEM parameter to N_BYTES and change its type to size_t.
Diffstat (limited to 'src')
-rw-r--r--src/sort.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/sort.c b/src/sort.c
index 53737a9ee..8e2723298 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -374,9 +374,9 @@ xfclose (FILE *fp)
}
static void
-xfwrite (const char *buf, int size, int nelem, FILE *fp)
+write_bytes (const char *buf, size_t n_bytes, FILE *fp)
{
- if (fwrite (buf, size, nelem, fp) != nelem)
+ if (fwrite (buf, 1, n_bytes, fp) != n_bytes)
{
error (0, errno, _("write error"));
cleanup ();
@@ -1307,7 +1307,7 @@ mergefps (FILE **fps, register int nfps, FILE *ofp)
{
if (savedflag && compare (&saved, &lines[ord[0]].lines[cur[ord[0]]]))
{
- xfwrite (saved.text, 1, saved.length, ofp);
+ write_bytes (saved.text, saved.length, ofp);
putc (eolchar, ofp);
savedflag = 0;
}
@@ -1339,8 +1339,8 @@ mergefps (FILE **fps, register int nfps, FILE *ofp)
}
else
{
- xfwrite (lines[ord[0]].lines[cur[ord[0]]].text, 1,
- lines[ord[0]].lines[cur[ord[0]]].length, ofp);
+ write_bytes (lines[ord[0]].lines[cur[ord[0]]].text,
+ lines[ord[0]].lines[cur[ord[0]]].length, ofp);
putc (eolchar, ofp);
}
@@ -1393,7 +1393,7 @@ mergefps (FILE **fps, register int nfps, FILE *ofp)
if (unique && savedflag)
{
- xfwrite (saved.text, 1, saved.length, ofp);
+ write_bytes (saved.text, saved.length, ofp);
putc (eolchar, ofp);
free (saved.text);
}
@@ -1546,7 +1546,7 @@ sort (char **files, int nfiles, FILE *ofp)
if (!unique || i == 0
|| compare (&lines.lines[i], &lines.lines[i - 1]))
{
- xfwrite (lines.lines[i].text, 1, lines.lines[i].length, tfp);
+ write_bytes (lines.lines[i].text, lines.lines[i].length, tfp);
putc (eolchar, tfp);
}
if (tfp != ofp)
@@ -2048,7 +2048,7 @@ but lacks following character offset"));
tmp = tempname ();
ofp = xtmpfopen (tmp);
while ((cc = fread (buf, 1, sizeof buf, fp)) > 0)
- xfwrite (buf, 1, cc, ofp);
+ write_bytes (buf, cc, ofp);
if (ferror (fp))
{
error (0, errno, "%s", files[i]);