Skip to content

Commit

Permalink
Use v8 to get context for even more speed
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandromrc committed Mar 26, 2024
1 parent 9bfa18c commit 54aa0d6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/line.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,8 @@ NAN_METHOD(Line::getValue) {

NAN_METHOD(Line::setValue) {
Line *obj = Nan::ObjectWrap::Unwrap<Line>(info.This());
if (!obj->line) {
return Nan::ThrowError("setValue() called for null line.");
}

uint32_t value = Nan::To<uint32_t>(info[0]).FromJust();
v8::Local<v8::Context> context = Nan::GetCurrentContext();
uint32_t value = info[0]->Uint32Value(context).FromJust();
if (gpiod_line_set_value(obj->line, value) == -1) {
return Nan::ThrowError("setValue() failed.");
}
Expand Down

0 comments on commit 54aa0d6

Please sign in to comment.