tweaks: replace sizeof(char) with 1, as that is assumed anyway
Since commit c848ec3d from three years ago, nano has assumed that 'char' is always a single byte. So... elide the last occurrences of sizeof(char), as they give a false impression of generality.
This commit is contained in:
parent
ceb305a780
commit
119ec47072
10
src/files.c
10
src/files.c
@ -218,7 +218,7 @@ bool write_lockfile(const char *lockfilename, const char *filename, bool modifie
|
||||
strncpy(&lockdata[108], filename, 768);
|
||||
lockdata[1007] = (modified) ? 0x55 : 0x00;
|
||||
|
||||
wroteamt = fwrite(lockdata, sizeof(char), LOCKSIZE, filestream);
|
||||
wroteamt = fwrite(lockdata, 1, LOCKSIZE, filestream);
|
||||
|
||||
free(lockdata);
|
||||
|
||||
@ -990,7 +990,7 @@ void send_data(const linestruct *line, int fd)
|
||||
while (line != NULL && (line->next != NULL || line->data[0] != '\0')) {
|
||||
size_t length = recode_LF_to_NUL(line->data);
|
||||
|
||||
if (fwrite(line->data, sizeof(char), length, tube) < length)
|
||||
if (fwrite(line->data, 1, length, tube) < length)
|
||||
exit(5);
|
||||
|
||||
if (line->next && putc('\n', tube) == EOF)
|
||||
@ -1536,12 +1536,12 @@ int copy_file(FILE *inn, FILE *out, bool close_out)
|
||||
int (*flush_out_fnc)(FILE *) = (close_out) ? fclose : fflush;
|
||||
|
||||
do {
|
||||
charsread = fread(buf, sizeof(char), BUFSIZ, inn);
|
||||
charsread = fread(buf, 1, BUFSIZ, inn);
|
||||
if (charsread == 0 && ferror(inn)) {
|
||||
retval = -1;
|
||||
break;
|
||||
}
|
||||
if (fwrite(buf, sizeof(char), charsread, out) < charsread) {
|
||||
if (fwrite(buf, 1, charsread, out) < charsread) {
|
||||
retval = 2;
|
||||
break;
|
||||
}
|
||||
@ -1868,7 +1868,7 @@ bool write_file(const char *name, FILE *thefile, bool normal,
|
||||
/* Decode LFs as the NULs that they are, before writing to disk. */
|
||||
data_len = recode_LF_to_NUL(line->data);
|
||||
|
||||
wrote = fwrite(line->data, sizeof(char), data_len, thefile);
|
||||
wrote = fwrite(line->data, 1, data_len, thefile);
|
||||
|
||||
/* Re-encode any embedded NULs as LFs. */
|
||||
recode_NUL_to_LF(line->data, data_len);
|
||||
|
||||
@ -307,7 +307,7 @@ bool write_list(const linestruct *head, FILE *histfile)
|
||||
/* Decode 0x0A bytes as embedded NULs. */
|
||||
size_t length = recode_LF_to_NUL(item->data);
|
||||
|
||||
if (fwrite(item->data, sizeof(char), length, histfile) < length)
|
||||
if (fwrite(item->data, 1, length, histfile) < length)
|
||||
return FALSE;
|
||||
if (putc('\n', histfile) == EOF)
|
||||
return FALSE;
|
||||
@ -455,7 +455,7 @@ void save_poshistory(void)
|
||||
/* Restore the terminating newline. */
|
||||
path_and_place[length - 1] = '\n';
|
||||
|
||||
if (fwrite(path_and_place, sizeof(char), length, histfile) < length)
|
||||
if (fwrite(path_and_place, 1, length, histfile) < length)
|
||||
jot_error(N_("Error writing %s: %s"), poshistname, strerror(errno));
|
||||
|
||||
free(path_and_place);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user