-/* $Id: d1_handle.c,v 1.14 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_handle.c,v 1.15 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
*/
data1_absyn_destroy(dh);
- wrbuf_free (dh->wrbuf, 1);
+ wrbuf_destroy(dh->wrbuf);
if (dh->tab_path)
xfree (dh->tab_path);
if (dh->tab_root)
-/* $Id: d1_read.c,v 1.22 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_read.c,v 1.23 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
for (;;)
{
data1_xattr *p;
- int len;
while (*amp || (c && d1_isspace(c)))
c = ampr (get_byte, fh, amp);
if (*amp == 0 && (c == 0 || c == '>' || c == '/'))
wrbuf_putc (wrbuf, c);
c = ampr (get_byte, fh, amp);
}
- wrbuf_putc (wrbuf, '\0');
- len = wrbuf_len(wrbuf);
- p->name = (char*) nmem_malloc (m, len);
- strcpy (p->name, wrbuf_buf(wrbuf));
+ p->name = nmem_strdup (m, wrbuf_cstr(wrbuf));
if (c == '=')
{
c = ampr (get_byte, fh, amp);
c = ampr (get_byte, fh, amp);
}
}
- wrbuf_putc (wrbuf, '\0');
- len = wrbuf_len(wrbuf);
- p->value = (char*) nmem_malloc (m, len);
- strcpy (p->value, wrbuf_buf(wrbuf));
+ p->value = nmem_strdup(m, wrbuf_cstr(wrbuf));
}
}
*ch = c;
data1_node *node;
node = data1_read_nodex(dh, m, getc_mem, (void *) (buf), wrbuf);
- wrbuf_free (wrbuf, 1);
+ wrbuf_destroy(wrbuf);
return node;
}
conv_item(m, t, wrbuf, p->value, strlen(p->value))
== 0)
{
- wrbuf_puts (wrbuf, "");
- p->value = nmem_strdup (m, wrbuf->buf);
+ p->value = nmem_strdup(m, wrbuf_cstr(wrbuf));
}
}
}
yaz_iconv_t t = yaz_iconv_open(tocode, fromcode);
if (!t)
{
- wrbuf_free(wrbuf, 1);
+ wrbuf_destroy(wrbuf);
return -1;
}
data1_iconv_s(dh, m, n, t, wrbuf, tocode);
yaz_iconv_close(t);
- wrbuf_free(wrbuf, 1);
+ wrbuf_destroy(wrbuf);
}
return 0;
}
-/* $Id: alvis.c,v 1.14 2007-03-07 14:18:35 marc Exp $
+/* $Id: alvis.c,v 1.15 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
else
wrbuf_printf(wrbuf, "</snippet>\n");
- xml_doc_str = odr_strdup(p->odr, wrbuf_buf(wrbuf));
+ xml_doc_str = odr_strdup(p->odr, wrbuf_cstr(wrbuf));
zebra_snippets_destroy(res);
- wrbuf_free(wrbuf, 1);
+ wrbuf_destroy(wrbuf);
return xml_doc_str;
}
-/* $Id: marcread.c,v 1.7 2007-03-08 13:18:35 adam Exp $
+/* $Id: marcread.c,v 1.8 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
field = cat_field(p, pf, buf, field);
- pb = wrbuf_buf(buf);
+ pb = wrbuf_cstr(buf);
for (pb = strtok(pb, "\n"); pb; pb = strtok(NULL, "\n"))
{
- if (!is_empty(pb))
- {
- new = data1_mk_tag_n(p->dh, p->mem, mc_stmnt, strlen(mc_stmnt), 0, top);
- data1_mk_text_n(p->dh, p->mem, pb, strlen(pb), new);
- }
+ if (!is_empty(pb))
+ {
+ new = data1_mk_tag_n(p->dh, p->mem, mc_stmnt, strlen(mc_stmnt), 0, top);
+ data1_mk_text_n(p->dh, p->mem, pb, strlen(pb), new);
+ }
}
}
else
}
mc_destroy_field(pf);
mc_destroy_context(c);
- wrbuf_free(buf, 1);
+ wrbuf_destroy(buf);
}
data1_node *grs_read_marcxml(struct grs_read_info *p)
-/* $Id: orddict.c,v 1.5 2007-01-15 15:10:16 adam Exp $
+/* $Id: orddict.c,v 1.6 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
char *dict_lookup_ord(Dict d, int ord, const char *str)
{
WRBUF w = zebra_mk_ord_str(ord, str);
- char *rinfo = dict_lookup(d, wrbuf_buf(w));
- wrbuf_free(w, 1);
+ char *rinfo = dict_lookup(d, wrbuf_cstr(w));
+ wrbuf_destroy(w);
return rinfo;
}
int userlen, void *userinfo)
{
WRBUF w = zebra_mk_ord_str(ord, p);
- int r = dict_insert(d, wrbuf_buf(w), userlen, userinfo);
- wrbuf_free(w, 1);
+ int r = dict_insert(d, wrbuf_cstr(w), userlen, userinfo);
+ wrbuf_destroy(w);
return r;
}
int dict_delete_ord(Dict d, int ord, const char *p)
{
WRBUF w = zebra_mk_ord_str(ord, p);
- int r = dict_delete(d, wrbuf_buf(w));
- wrbuf_free(w, 1);
+ int r = dict_delete(d, wrbuf_cstr(w));
+ wrbuf_destroy(w);
return r;
}
int (*f)(const char *info, void *client))
{
WRBUF w = zebra_mk_ord_str(ord, "");
- int r = dict_delete_subtree(d, wrbuf_buf(w), client, f);
- wrbuf_free(w, 1);
+ int r = dict_delete_subtree(d, wrbuf_cstr(w), client, f);
+ wrbuf_destroy(w);
return r;
}
/*
-/* $Id: regxread.c,v 1.6 2007-01-15 15:10:17 adam Exp $
+/* $Id: regxread.c,v 1.7 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
}
}
fclose (spec_inf);
- wrbuf_free(lineBuf, 1);
+ wrbuf_destroy(lineBuf);
for (lc = spec->context; lc; lc = lc->next)
{
-/* $Id: retrieve.c,v 1.66 2007-03-06 12:40:18 adam Exp $
+/* $Id: retrieve.c,v 1.67 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
*rec_lenp = wrbuf_len(wrbuf);
*rec_bufp = odr_malloc(odr, *rec_lenp);
memcpy(*rec_bufp, wrbuf_buf(wrbuf), *rec_lenp);
- wrbuf_free(wrbuf, 1);
+ wrbuf_destroy(wrbuf);
return 0;
}
}
*rec_lenp = wrbuf_len(wrbuf);
*rec_bufp = odr_malloc(odr, *rec_lenp);
memcpy(*rec_bufp, wrbuf_buf(wrbuf), *rec_lenp);
- wrbuf_free(wrbuf, 1);
+ wrbuf_destroy(wrbuf);
}
zebra_rec_keys_close(keys);
return ret_code;
}
*rec_lenp = wrbuf_len(wrbuf);
if (*rec_lenp)
- *rec_bufp = odr_strdup(odr, wrbuf_buf(wrbuf));
+ *rec_bufp = odr_strdup(odr, wrbuf_cstr(wrbuf));
else
ret = YAZ_BIB1_NO_SYNTAXES_AVAILABLE_FOR_THIS_REQUEST;
- wrbuf_free(wrbuf, 1);
+ wrbuf_destroy(wrbuf);
return ret;
}
}
*rec_lenp = wrbuf_len(wrbuf);
if (*rec_lenp)
- *rec_bufp = odr_strdup(odr, wrbuf_buf(wrbuf));
+ *rec_bufp = odr_strdup(odr, wrbuf_cstr(wrbuf));
else
ret = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
- wrbuf_free(wrbuf, 1);
+ wrbuf_destroy(wrbuf);
rec_free(&rec);
return ret;
}
-/* $Id: rpnscan.c,v 1.5 2007-01-15 15:10:17 adam Exp $
+/* $Id: rpnscan.c,v 1.6 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
RSET rset = 0;
for (i = 0; i < ord_no; i++)
{
- if (ar[i].isam_p && strcmp(wrbuf_buf(ar[i].term), term) == 0)
+ if (ar[i].isam_p && strcmp(wrbuf_cstr(ar[i].term), term) == 0)
{
RSET rset_t = rset_trunc(
zh, &ar[i].isam_p, 1,
ar[i].pos_to_save = -1;
strcpy(termz, ar[i].prefix);
- strcat(termz, wrbuf_buf(ar[i].term));
+ strcat(termz, wrbuf_cstr(ar[i].term));
dict_scan(zh->reg->dict, termz, &before, &after,
ar+i, scan_handle2);
}
for (i = 0; i < ord_no; i++)
{
if (ar[i].isam_p
- && (hi == 0 || strcmp(wrbuf_buf(ar[i].term), hi) > 0))
- hi = wrbuf_buf(ar[i].term);
+ && (hi == 0 || strcmp(wrbuf_cstr(ar[i].term), hi) > 0))
+ hi = wrbuf_cstr(ar[i].term);
}
if (!hi)
break;
ar[i].pos_to_save = 1;
strcpy(termz, ar[i].prefix);
- strcat(termz, wrbuf_buf(ar[i].term));
+ strcat(termz, wrbuf_cstr(ar[i].term));
dict_scan(zh->reg->dict, termz, &before, &after,
ar+i, scan_handle2);
}
for (i = 0; i < ord_no; i++)
{
if (ar[i].isam_p
- && (lo == 0 || strcmp(wrbuf_buf(ar[i].term), lo) < 0))
- lo = wrbuf_buf(ar[i].term);
+ && (lo == 0 || strcmp(wrbuf_cstr(ar[i].term), lo) < 0))
+ lo = wrbuf_cstr(ar[i].term);
}
if (!lo)
break;
-/* $Id: rpnsearch.c,v 1.9 2007-03-06 12:21:04 adam Exp $
+/* $Id: rpnsearch.c,v 1.10 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
cp++;
}
}
- wrbuf_puts(wbuf, "");
rset_attr = xpath_trunc(
- zh, stream, '0', wrbuf_buf(wbuf), ZEBRA_XPATH_ATTR_NAME,
+ zh, stream, '0', wrbuf_cstr(wbuf), ZEBRA_XPATH_ATTR_NAME,
rset_nmem, kc);
- wrbuf_free(wbuf, 1);
+ wrbuf_destroy(wbuf);
}
else
{
if (!first_path)
{
- wrbuf_free(xpath_rev, 1);
+ wrbuf_destroy(xpath_rev);
continue;
}
}
- yaz_log(log_level_rpn, "xpath_rev (%d) = %.*s", level,
- wrbuf_len(xpath_rev), wrbuf_buf(xpath_rev));
+ yaz_log(log_level_rpn, "xpath_rev (%d) = %s", level,
+ wrbuf_cstr(xpath_rev));
if (wrbuf_len(xpath_rev))
{
rset_start_tag = xpath_trunc(zh, stream, '0',
- wrbuf_buf(xpath_rev),
+ wrbuf_cstr(xpath_rev),
ZEBRA_XPATH_ELM_BEGIN,
rset_nmem, kc);
if (always_matches)
else
{
rset_end_tag = xpath_trunc(zh, stream, '0',
- wrbuf_buf(xpath_rev),
+ wrbuf_cstr(xpath_rev),
ZEBRA_XPATH_ELM_END,
rset_nmem, kc);
rset_end_tag, rset_attr);
}
}
- wrbuf_free(xpath_rev, 1);
+ wrbuf_destroy(xpath_rev);
first_path = 0;
}
}
-/* $Id: sgmlread.c,v 1.4 2007-01-15 15:10:17 adam Exp $
+/* $Id: sgmlread.c,v 1.5 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
{
struct sgml_getc_info *p = (struct sgml_getc_info *) clientData;
- wrbuf_free(p->wrbuf, 1);
- xfree (p->buf);
- xfree (p);
+ wrbuf_destroy(p->wrbuf);
+ xfree(p->buf);
+ xfree(p);
}
static int grs_extract_sgml(void *clientData, struct recExtractCtrl *ctrl)
-/* $Id: zebraapi.c,v 1.251 2007-03-14 11:48:32 adam Exp $
+/* $Id: zebraapi.c,v 1.252 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
return zebra_end_trans (zh);
}
-int zebra_string_norm (ZebraHandle zh, unsigned reg_id,
- const char *input_str, int input_len,
- char *output_str, int output_len)
+int zebra_string_norm(ZebraHandle zh, unsigned reg_id,
+ const char *input_str, int input_len,
+ char *output_str, int output_len)
{
WRBUF wrbuf;
ASSERTZH;
-/* $Id: zebrash.c,v 1.43 2007-03-14 11:48:32 adam Exp $
+/* $Id: zebrash.c,v 1.44 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
wrbuf_puts(qry,restargs(args,1));
if (!zh)
onecommand("quickstart", outbuff, "");
- wrbuf_printf(outbuff, "find %s\n",wrbuf_buf(qry));
- rc = zebra_search_PQF(zh, wrbuf_buf(qry), setname, &hits);
+ wrbuf_printf(outbuff, "find %s\n",wrbuf_cstr(qry));
+ rc = zebra_search_PQF(zh, wrbuf_cstr(qry), setname, &hits);
if (0==rc)
{
wrbuf_printf(outbuff, ZINT_FORMAT " hits found\n", hits);
nextrecno = 1;
}
- wrbuf_free(qry, 1);
+ wrbuf_destroy(qry);
return rc;
}
/* get rid of \n in line */
if ((nl_cp = strchr(buf, '\n')))
*nl_cp = '\0';
- strncpy(prevout, wrbuf_buf(outbuff), MAX_OUT_BUFF);
+ strncpy(prevout, wrbuf_cstr(outbuff), MAX_OUT_BUFF);
wrbuf_rewind(outbuff);
rc=onecommand(buf, outbuff, prevout);
if (rc==0)
wrbuf_printf(outbuff, " command returned %d\n",rc);
}
Zerrors(outbuff);
- printf("%s\n", wrbuf_buf(outbuff));
+ printf("%s\n", wrbuf_cstr(outbuff));
} /* while */
- wrbuf_free(outbuff,1);
+ wrbuf_destroy(outbuff);
} /* shell() */
-/* $Id: benchindex1.c,v 1.9 2007-01-15 15:10:17 adam Exp $
+/* $Id: benchindex1.c,v 1.10 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
index_block_check_flush(b, isb, dict, no_docs);
}
index_block_flush(b, isb, dict, no_docs);
- wrbuf_free(wrbuf, 1);
+ wrbuf_destroy(wrbuf);
yaz_marc_destroy(mt);
index_block_destroy(&b);
}
-/* $Id: zebramap.c,v 1.56 2007-01-22 18:15:04 adam Exp $
+/* $Id: zebramap.c,v 1.57 2007-03-19 21:50:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
chrmaptab_destroy(zm->maptab);
zm = zm->next;
}
- wrbuf_free(zms->wrbuf_1, 1);
+ wrbuf_destroy(zms->wrbuf_1);
nmem_destroy(zms->nmem);
xfree(zms);
}