History

BufferedFile: buffer[] to avoid compiler warnings

Sigrid Solveig Haflínudóttir committed 8 months agosl

Commit 91a50701 parent dab704d2 files · +2 −2Browse files

Unified · Split

2 files
  1. libtcc.c +1 −1
  2. tcc.h +1 −1
libtcc.c+1−1
@@ -753,7 +753,7 @@ ST_FUNC void tcc_open_bf(TCCState *s1, const char *filename, int initlen) · 752 unmodified lines
753753 BufferedFile *bf;
754754 int buflen = initlen ? initlen : IO_BUF_SIZE;
755755
756− bf = tcc_mallocz(sizeof(BufferedFile) + buflen);
756+ bf = tcc_mallocz(sizeof(BufferedFile) + buflen + 1);
757757 bf->buf_ptr = bf->buffer;
758758 bf->buf_end = bf->buffer + initlen;
759759 bf->buf_end[0] = CH_EOB; /* put eob symbol */
tcc.h+1−1
@@ -631,7 +631,7 @@ typedef struct BufferedFile { · 630 unmodified lines
631631 char filename[1024]; /* filename */
632632 char *true_filename; /* filename not modified by # line directive */
633633 unsigned char unget[4];
634− unsigned char buffer[1]; /* extra size for CH_EOB char */
634+ unsigned char buffer[]; /* + extra byte for CH_EOB char */
635635 } BufferedFile;
636636
637637 #define CH_EOB '\\' /* end of buffer or '\0' char in file */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t