If a file does not use MMAPed data, allow it.

This commit is contained in:
Juan Jose Garcia Ripoll 2011-11-14 23:35:45 +01:00
parent 9f683792a1
commit 704964093f
3 changed files with 10 additions and 13 deletions

View file

@ -14,6 +14,7 @@
*/
#include <ecl/ecl.h>
#include <ecl/ecl-inl.h>
#define HEADER_PREFIX "eClDaTa20110719"
#define HEADER_PREFIX_LENGTH 15
@ -23,6 +24,8 @@ typedef struct {
cl_index offset, size;
} cdata_header;
ecl_def_ct_base_string(str_no_data,"",0,static,const);
cl_object
si_get_cdata(cl_object filename)
{
@ -38,9 +41,7 @@ si_get_cdata(cl_object filename)
}
if (memcmp(header->code, HEADER_PREFIX, HEADER_PREFIX_LENGTH)) {
si_munmap(map);
map = Cnil;
displaced = Cnil;
displaced = str_no_data;
} else {
displaced = cl_funcall(8, @'make-array',
MAKE_FIXNUM(header->size),

View file

@ -67,15 +67,11 @@ si_load_binary(cl_object filename, cl_object verbose,
goto OUTPUT;
}
GO_ON:
GO_ON:
/* Try to load the compiled data */
map = si_get_cdata(filename);
array = VALUES(1);
if (Null(map)) {
output = make_base_string_copy("Unable to load compiled data.");
ecl_library_close(block);
goto OUTPUT;
}
block->cblock.data_text = array->base_string.self;
block->cblock.data_text_size = array->base_string.dim;

View file

@ -95,10 +95,10 @@
(princ "#define compiler_data_text NULL
#define compiler_data_text_size 0" stream)))))
(defun data-binary-dump (filename &optional (string (if *compile-in-constants*
""
(data-dump-array))))
(si::add-cdata filename string))
(defun data-binary-dump (filename &optional (string (unless *compile-in-constants*
(data-dump-array))))
(unless *compile-in-constants*
(si::add-cdata filename string)))
(defun wt-data-begin (stream)
nil)