Skip to content

Commit

Permalink
Fixed build for node 0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
samkrew committed Feb 16, 2015
1 parent 1510033 commit 7913efd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#include <cstring>

char *get(v8::Handle<v8::Value> value, const char *fallback) {
NanScope();
char *str;
if (value->IsString()) {
v8::String::AsciiValue string(value);
char *str = (char *) malloc(string.length() + 1);
strcpy(str, *string);
return str;
}
char *str = (char *) malloc(strlen(fallback) + 1);
strcpy(str, fallback);
NanUtf8String string(value);
str = strdup(*string);
} else {
str = strdup(fallback);
}
return str;
}
1 change: 1 addition & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <node.h>
#include <v8.h>
#include <nan.h>

char *get(v8::Handle<v8::Value> value, const char *fallback = "");

Expand Down

0 comments on commit 7913efd

Please sign in to comment.