Sannis / node-mysql-libmysqlclient

Asynchronous MySQL binding for Node.js
http://sannis.github.com/node-mysql-libmysqlclient
Other
229 stars 47 forks source link

Add missing return statements #194

Closed anders-advisa closed 7 years ago

anders-advisa commented 7 years ago

The nan update branch seems a bit messy, but from what I can gather some tool was used to replace all occurances of NanReturnValue() with info.GetReturnValue().Set(). The problem with this is that the NanReturnValue() macro in nan 1 actually returned from the c function, while the replacement doesn't.

In a lot of cases this library did something like this:

if (condition) {
   NanReturnValue(something);
}
NanReturnValue(something_else);

Which was replaced by this:

if (condition) {
  info.GetReturnValue().Set(something);
}
info.GetReturnValue().Set(something_else);

So the JS return value is always set to something_else before returning from the c function.

The solution in this branch is not ideal, but seems to work.

Sannis commented 7 years ago

@anders-advisa good catch, thanks!