X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fsrwutil.c;h=fdf99440373924dc3282c8d415027bd95943d60c;hb=d6b502441f8d9b4b169e4f9bb28468d8f2dec627;hp=2591fc99a460c0382c13f222f2d04e73c5b77eaa;hpb=2edd9764942ec2d62cabcb4190a69921c60af293;p=yaz-moved-to-github.git diff --git a/src/srwutil.c b/src/srwutil.c index 2591fc9..fdf9944 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -141,13 +141,6 @@ static void yaz_srw_decodeauth(Z_SRW_PDU *sr, Z_HTTP_Request *hreq, } } -void yaz_uri_val_int(const char *path, const char *name, ODR o, Odr_int **intp) -{ - const char *v = yaz_uri_val(path, name, o); - if (v) - *intp = odr_intdup(o, atoi(v)); -} - void yaz_mk_srw_diagnostic(ODR o, Z_SRW_diagnostic *d, const char *uri, const char *message, const char *details) @@ -246,9 +239,7 @@ static void grab_charset(ODR o, const char *content_type, char **charset) while (i < 20 && charset_p[i] && !strchr("; \n\r", charset_p[i])) i++; - *charset = (char*) odr_malloc(o, i+1); - memcpy(*charset, charset_p, i); - (*charset)[i] = '\0'; + *charset = odr_strdupn(o, charset_p, i); } } } @@ -1182,6 +1173,9 @@ void yaz_encode_sru_extra(Z_SRW_PDU *sr, ODR odr, const char *extra_args) Z_SRW_extra_arg **ea = &sr->extra_args; yaz_uri_to_array(extra_args, odr, &name, &val); + /** append rather than override */ + while (*ea) + ea = &(*ea)->next; while (*name) { *ea = (Z_SRW_extra_arg *) odr_malloc(odr, sizeof(**ea));