Permalink
Browse files

Use free instead of XXH32_result.

  • Loading branch information...
1 parent 54a51f9 commit da8bef963d5dcd349cf80dca390f596b96806150 @jpountz committed Dec 17, 2012
@@ -1,4 +1,3 @@
-#Tue Jul 17 16:36:09 CEST 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
@@ -80,7 +79,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=8
+org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
View
@@ -44,10 +44,7 @@ http://code.google.com/p/xxhash/.
Similarly to LZ4, 3 implementations are available: JNI bindings, pure Java port
and pure Java port that uses sun.misc.Unsafe.
-Please note that the 3 implementations will return the same result for the same
-input on the same machine but the hash will differ on a machine of the opposite
-endianess.
-
+All implementations return the same result for the same input bytes.
Build
-----
@@ -36,7 +36,7 @@ private void checkState() {
@Override
public void reset() {
checkState();
- XXHashJNI.XXH32_result(state);
+ XXHashJNI.XXH32_free(state);
state = XXHashJNI.XXH32_init(seed);
}
@@ -56,10 +56,8 @@ public void update(byte[] bytes, int off, int len) {
protected void finalize() throws Throwable {
super.finalize();
// free memory
- if (state != 0) {
- XXHashJNI.XXH32_result(state);
- state = 0;
- }
+ XXHashJNI.XXH32_free(state);
+ state = 0;
}
}
@@ -33,5 +33,6 @@
static native void XXH32_feed(long state, byte[] input, int offset, int len);
static native int XXH32_getIntermediateResult(long state);
static native int XXH32_result(long state);
+ static native void XXH32_free(long state);
}
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+#include <stdlib.h>
#include "xxhash.h"
#include "net_jpountz_xxhash_XXHashJNI.h"
@@ -111,3 +112,15 @@ JNIEXPORT jint JNICALL Java_net_jpountz_xxhash_XXHashJNI_XXH32_1result
}
+/*
+ * Class: net_jpountz_xxhash_XXHashJNI
+ * Method: XXH32_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_net_jpountz_xxhash_XXHashJNI_XXH32_1free
+ (JNIEnv *env, jclass cls, jlong state) {
+
+ free((void*) state);
+
+}
+

0 comments on commit da8bef9

Please sign in to comment.