diff options
author | soumith <soumith@gmail.com> | 2015-11-12 05:30:40 +0300 |
---|---|---|
committer | soumith <soumith@gmail.com> | 2015-11-12 05:30:40 +0300 |
commit | 0d85da7a95fcc9385e30e989d89b996f4416137a (patch) | |
tree | b0b8898947af9fb74d9cd9192747c4441878eeff | |
parent | 5b2c0abed27c1edd5ed5a01dde9a47a0cfbeb2af (diff) |
jit fix
-rw-r--r-- | graphviz.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/graphviz.lua b/graphviz.lua index 80cce0b..5c1b3d4 100644 --- a/graphviz.lua +++ b/graphviz.lua @@ -51,6 +51,7 @@ else end local unpack = unpack or table.unpack -- Lua52 compatibility +local NULL = (not jit) and ffi.C.NULL or nil -- LuaJIT compatibility -- Retrieve attribute data from a graphviz object. local function getAttribute(obj, name) @@ -64,8 +65,8 @@ local function nodeIterator(graph) local node = cgraph.agfstnode(graph) local nextNode return function() - if node == ffi.C.NULL then return end - if node == cgraph.aglstnode(graph) then nextNode = ffi.C.NULL end + if node == NULL then return end + if node == cgraph.aglstnode(graph) then nextNode = NULL end nextNode = cgraph.agnxtnode(graph, node) local result = node node = nextNode @@ -123,7 +124,7 @@ function graph.graphvizLayout(g, algorithm) local algorithm = algorithm or "dot" assert(0 == graphviz.gvLayout(context, graphvizGraph, algorithm), "graphviz layout failed") - assert(0 == graphviz.gvRender(context, graphvizGraph, algorithm, ffi.C.NULL), + assert(0 == graphviz.gvRender(context, graphvizGraph, algorithm, NULL), "graphviz render failed") -- Extract bounding box. |