aboutsummaryrefslogtreecommitdiff
path: root/tccpp.c
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2013-01-14 17:34:07 +0100
committerThomas Preud'homme <robotux@celest.fr>2013-01-14 17:34:07 +0100
commit8c56b0cf900cf244029df148f18fda5c11e27344 (patch)
tree3b6e5f6e450ce88afe2c06c3bb7cd1ee076d2194 /tccpp.c
parent60a3ff5f2cdc1248cce683ba11db420bc2cb2311 (diff)
downloadtinycc-8c56b0cf900cf244029df148f18fda5c11e27344.tar.gz
tinycc-8c56b0cf900cf244029df148f18fda5c11e27344.tar.bz2
Revert "Added what I call virtual io to tinycc this way we can make a monolitic executable or library that contains all needed to compile programs, truly tinycc portable."
This reverts commit 59e18aee0e509a3ca75dbe6f909e18c1d17893d1. tcc is being stabilized now in order to do a new release soon. Therefore, such a change is not appropriate now.
Diffstat (limited to 'tccpp.c')
-rw-r--r--tccpp.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/tccpp.c b/tccpp.c
index cc54dee..c0c7aec 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -360,13 +360,13 @@ static int tcc_peekc_slow(BufferedFile *bf)
int len;
/* only tries to read if really end of buffer */
if (bf->buf_ptr >= bf->buf_end) {
- if (bf->fd.fd != -1) {
+ if (bf->fd != -1) {
#if defined(PARSE_DEBUG)
len = 8;
#else
len = IO_BUF_SIZE;
#endif
- len = vio_read(bf->fd, bf->buffer, len);
+ len = read(bf->fd, bf->buffer, len);
if (len < 0)
len = 0;
} else {
@@ -1438,8 +1438,6 @@ ST_FUNC void preprocess(int is_bof)
CachedInclude *e;
BufferedFile **f;
const char *path;
- int size;
- vio_fd fd;
if (i == -2) {
/* check absolute include path */
@@ -1452,9 +1450,8 @@ ST_FUNC void preprocess(int is_bof)
/* search in current dir if "header.h" */
if (c != '\"')
continue;
- size = tcc_basename(file->filename) - file->filename;
- memcpy(buf1, file->filename, size);
- buf1[size] = '\0';
+ path = file->filename;
+ pstrncpy(buf1, path, tcc_basename(path) - path);
} else {
/* search in all the include paths */
@@ -1484,13 +1481,10 @@ ST_FUNC void preprocess(int is_bof)
#ifdef INC_DEBUG
printf("%s: skipping cached %s\n", file->filename, buf1);
#endif
- vio_initialize(&fd);
- fd.fd = 0;
goto include_done;
}
- fd = tcc_open(s1, buf1);
- if (fd.fd < 0)
+ if (tcc_open(s1, buf1) < 0)
include_trynext:
continue;