- yaz_log(YLOG_LOG, "Building record from memcached!! syntax=%s",
- syntax);
- Z_NamePlusRecord *npr = (Z_NamePlusRecord *)
- odr_malloc(r->odr, sizeof(Z_NamePlusRecord));
- npr->databaseName = 0;
- npr->which = Z_NamePlusRecord_databaseRecord;
- npr->u.databaseRecord = (Z_External *)
- odr_malloc(r->odr, sizeof(Z_External));
- npr->u.databaseRecord->descriptor = 0;
- npr->u.databaseRecord->direct_reference =
- syntax ?
- yaz_string_to_oid_odr(yaz_oid_std(), CLASS_RECSYN,
- syntax, r->odr) : 0;
- npr->u.databaseRecord->indirect_reference = 0;
- npr->u.databaseRecord->which = Z_External_octet;
- npr->u.databaseRecord->u.octet_aligned =
- odr_create_Odr_oct(r->odr, v, v_len);
- free(v);
-
- if (v)
+ Z_NamePlusRecord *npr = 0;
+
+ odr_setbuf(r->odr, v_buf, v_len, 0);
+
+ z_NamePlusRecord(r->odr, &npr, 0, 0);
+ free(v_buf);
+ if (npr)
+ {
+ yaz_log(YLOG_LOG, "returned memcached copy");