couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [25/50] [abbrv] git commit: Fix code reloading for Jiffy
Date Fri, 17 Jan 2014 22:11:56 GMT
Fix code reloading for Jiffy

As it turns out I did not understand the documenation for
load/upgrade/unload correctly. load/upgrade are called conditionally if
there's code in the VM for the NIF. Ie, no code means load is called,
where as if code exists, upgrade is called.

unload is called regardless once per load/unload. This means that
load/upgrade in Jiffy's case will each create a state object and unload
will free it each time. I was missing the fact that unload is called
every time and hence I don't need to clear the state in upgrade.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/f7161619
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/f7161619
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/f7161619

Branch: refs/heads/import
Commit: f71616198f008c13a1f8571bb2f7d726ba84764d
Parents: 1772539
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Thu Jun 7 13:15:38 2012 -0500
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
Committed: Thu Jun 7 13:15:38 2012 -0500

----------------------------------------------------------------------
 c_src/jiffy.c | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/f7161619/c_src/jiffy.c
----------------------------------------------------------------------
diff --git a/c_src/jiffy.c b/c_src/jiffy.c
index 5d34a9c..964222c 100644
--- a/c_src/jiffy.c
+++ b/c_src/jiffy.c
@@ -42,8 +42,6 @@ reload(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
 static int
 upgrade(ErlNifEnv* env, void** priv, void** old_priv, ERL_NIF_TERM info)
 {
-    if(*old_priv != NULL)
-        enif_free(*old_priv);
     return load(env, priv, info);
 }
 


Mime
View raw message