Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge segmentation fault fixes

Closes GH-25
  • Loading branch information...
commit d66d4e3252e505f44ada6804c8cab39915ce8afd 2 parents 425d7cd + bdf8821
@piscisaureus piscisaureus authored
View
26 include/cSys_posix.h
@@ -568,7 +568,6 @@ o3_cls(cSys);
struct cSys : cSysBase {
int fd;
- size_t m_overall;
#if !defined(__FreeBSD__)
struct sockaddr_in addr;
#endif
@@ -578,7 +577,6 @@ struct cSys : cSysBase {
{
o3_trace_no_trace;
file = 0;
- m_overall = 0;
#ifdef O3_LOGFILE
removeLogFile();
file = fopen("/usr/tmp/o3log.txt", "w");
@@ -614,29 +612,15 @@ struct cSys : cSysBase {
void* alloc(size_t size)
{
- o3_trace_sys("alloc");
- #ifdef O3_NODE
- size += sizeof (size_t);
- void *ptr = ::malloc(size);
- *(size_t *) ptr = size;
- m_overall+=size;
- v8::V8::AdjustAmountOfExternalAllocatedMemory(size);
- return ((size_t *) ptr) + 1;
- #else
- return ::malloc(size);
- #endif
+ o3_trace_sys("alloc");
+ return ::malloc(size);
}
void free(void* ptr)
{
- o3_trace_sys("free");
- #ifdef O3_NODE
- v8::V8::AdjustAmountOfExternalAllocatedMemory(- * (((size_t *) ptr) - 1));
- m_overall-= *(((size_t *) ptr)-1);
- ptr = (void *) (((size_t *) ptr) - 1);
- #endif
- ::free(ptr);
- }
+ o3_trace_sys("free");
+ ::free(ptr);
+ }
void o3assert(const char* pred, const char* file, int line)
{
View
3  include/tStr.h
@@ -403,8 +403,7 @@ class tStr {
o3_trace_containers("resize");
buf().resize((new_size + 1) * sizeof(C));
- if (((const tStr*) this)->ptr()[size()])
- ptr()[size()] = 0;
+ ptr()[size()] = 0;
}
C* ptr()
View
10 modules/js/cJs_posix.h
@@ -452,7 +452,7 @@ struct cJs : cJsBase {
return;
cJs* pthis = (cJs*) parameter;
- Handle<Object> object = value->ToObject();
+ Local<Object> object = value->ToObject();
#ifdef O3_V8_GLUE
iScr* scr = (iScr*) cast(object->GetInternalField(1));
#else
@@ -488,7 +488,6 @@ struct cJs : cJsBase {
{
o3_trace_hostglue("createObject");
HandleScope handle_scope;
- Persistent<Object> object;
tMap<iScr*, Handle<Object> >::Iter it =
m_wrappers.find(scr);
@@ -497,8 +496,9 @@ struct cJs : cJsBase {
return it->val;
}
scr->addRef();
- object = Persistent<Object>::New(m_template->NewInstance());
- object.MakeWeak(this, finalize);
+ Local<Object> object = m_template->NewInstance();
+ Persistent<Object> handle = Persistent<Object>::New(object);
+ handle.MakeWeak(this, finalize);
#ifdef O3_V8_GLUE
object->SetInternalField(0, External::New(siCtx(this).ptr()));
object->SetInternalField(1, External::New(scr));
@@ -506,7 +506,7 @@ struct cJs : cJsBase {
#else
object->SetInternalField(0, External::New(scr));
#endif
- m_wrappers[scr] = object;
+ m_wrappers[scr] = handle;
return handle_scope.Close(object);
}
View
4 wscript
@@ -9,8 +9,8 @@ def configure(conf):
conf.check_tool('compiler_cxx')
conf.check_tool('node_addon')
conf.add_os_flags('LDFLAGS','LINKFLAGS')
- conf.env.append_value('CCFLAGS', ['-O3', '-msse2', '-ffast-math'])
- conf.env.append_value('CXXFLAGS', ['-O3', '-msse2', '-ffast-math'])
+ conf.env.append_value('CCFLAGS', ['-O3', '-msse2', '-ffast-math', '-fno-strict-aliasing'])
+ conf.env.append_value('CXXFLAGS', ['-O3', '-msse2', '-ffast-math', '-fno-strict-aliasing'])
def build(bld):
obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
Please sign in to comment.
Something went wrong with that request. Please try again.