Skip to content

Instantly share code, notes, and snippets.

@GlenTiki
Created February 6, 2015 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GlenTiki/3cf386e221729f3c3955 to your computer and use it in GitHub Desktop.
Save GlenTiki/3cf386e221729f3c3955 to your computer and use it in GitHub Desktop.
#define SLURP_STRING(obj, member, valp) \
if (!(obj)->IsObject()) { \
return env->ThrowError( \
"expected object for " #obj " to contain string member " #member); \
} \
node::Utf8Value _##member(env->isolate(), \
obj->Get(OneByteString(env->isolate(), #member))); \
if ((*(const char **)valp = *_##member) == nullptr) \
*(const char **)valp = "<unknown>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment