kopia lustrzana https://github.com/micropython/micropython
Merge pull request #3 from pfalcon/for-upstream
Trivial fixes for building unix versionpull/10/head
commit
319b28a355
|
@ -48,8 +48,13 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
|
||||||
uint size = lseek(fd, 0, SEEK_END);
|
uint size = lseek(fd, 0, SEEK_END);
|
||||||
lseek(fd, 0, SEEK_SET);
|
lseek(fd, 0, SEEK_SET);
|
||||||
char *data = m_new(char, size);
|
char *data = m_new(char, size);
|
||||||
read(fd, data, size);
|
int read_size = read(fd, data, size);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
if (read_size != size) {
|
||||||
|
printf("error reading file %s\n", filename);
|
||||||
|
m_free(data);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return mp_lexer_new_from_str_len(filename, data, size, true);
|
return mp_lexer_new_from_str_len(filename, data, size, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ $(PROG): $(BUILD) $(OBJ)
|
||||||
size $(PROG)
|
size $(PROG)
|
||||||
|
|
||||||
$(BUILD):
|
$(BUILD):
|
||||||
mkdir $@
|
mkdir -p $@
|
||||||
|
|
||||||
$(BUILD)/%.o: %.c
|
$(BUILD)/%.o: %.c
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
Ładowanie…
Reference in New Issue