1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2009 Index Data
3 * See the file LICENSE for details.
7 \brief Copies various Z39.50 types
10 #include <yaz/copy_types.h>
12 Z_RPNQuery *yaz_copy_z_RPNQuery(Z_RPNQuery *q, ODR out)
15 ODR enc = odr_createmem(ODR_ENCODE);
16 ODR dec = odr_createmem(ODR_DECODE);
17 if (!z_RPNQuery(enc, &q, 0, 0))
22 char *buf = odr_getbuf(enc, &len, 0);
25 odr_setbuf(dec, buf, len, 0);
26 z_RPNQuery(dec, &q1, 0, 0);
27 nmem_transfer(out->mem, dec->mem);
35 Z_Query *yaz_copy_Z_Query(Z_Query *q, ODR out)
38 ODR enc = odr_createmem(ODR_ENCODE);
39 ODR dec = odr_createmem(ODR_DECODE);
40 if (!z_Query(enc, &q, 0, 0))
45 char *buf = odr_getbuf(enc, &len, 0);
48 odr_setbuf(dec, buf, len, 0);
49 z_Query(dec, &q1, 0, 0);
50 nmem_transfer(out->mem, dec->mem);
62 * c-file-style: "Stroustrup"
63 * indent-tabs-mode: nil
65 * vim: shiftwidth=4 tabstop=8 expandtab