Avoid redundant buffer copies for get_record
[yaz4j-moved-to-github.git] / src / main / native / zoom-extra.cpp
index 0521686..2f4cb6f 100644 (file)
@@ -1,12 +1,9 @@
 #include "zoom-extra.h"
 #include <string.h>
 
-struct CharStarByteArray ZOOM_record_get_bytes(ZOOM_record rec, const char *type, int *len)
+struct CharStarByteArray ZOOM_record_get_bytes(ZOOM_record rec, const char *type)
 {
        struct CharStarByteArray node;
-       const char* pageData = ZOOM_record_get(rec, type, len);
-       node.length = strlen(pageData);
-       node.data = (char*) malloc(node.length+1);
-       strcpy(node.data, pageData);
+       node.data = ZOOM_record_get(rec, type, &node.length);
        return node;
 }