diff --git a/src/html/gnc-html.c b/src/html/gnc-html.c index c1be7486a8..227029581e 100644 --- a/src/html/gnc-html.c +++ b/src/html/gnc-html.c @@ -564,8 +564,37 @@ gnc_html_initialize( void ) gnc_html_register_urltype (types[i].type, types[i].protocol); } -char * -gnc_build_url (URLType type, const gchar * location, const gchar * label) +/** + * Creates a new HMTL url. + * + * @param type URL type + * @param location URL location + * @param label URL label (optional) + * @return Newly created URL. This string must be *NOT* freed by the caller. + */ +gchar* +gnc_build_url( URLType type, const gchar* location, const gchar* label ) +{ + static gchar buf[1000]; + gchar* url; + + url = gnc_html_build_url( type, location, label ); + strncpy( buf, url, sizeof(buf) ); + g_free( url ); + + return buf; +} + +/** + * Creates a new HMTL url. + * + * @param type URL type + * @param location URL location + * @param label URL label (optional) + * @return Newly created URL. This string must be freed by the caller. + */ +gchar* +gnc_html_build_url( URLType type, const gchar* location, const gchar* label ) { char * type_name; diff --git a/src/html/gnc-html.h b/src/html/gnc-html.h index 6136c624a4..a618ed0aff 100644 --- a/src/html/gnc-html.h +++ b/src/html/gnc-html.h @@ -265,4 +265,6 @@ void gnc_html_unregister_url_handler( URLType url_type ); const gchar* gnc_html_get_embedded_param( gpointer eb, const gchar* param_name ); +gchar* gnc_html_build_url( URLType type, const gchar* location, const gchar* label ); + #endif diff --git a/src/report/report-gnome/window-report.c b/src/report/report-gnome/window-report.c index b3ae92f464..5f8c5d0377 100644 --- a/src/report/report-gnome/window-report.c +++ b/src/report/report-gnome/window-report.c @@ -283,7 +283,7 @@ gnc_html_report_url_cb (const char *location, const char *label, { char *url; - url = gnc_build_url (URL_TYPE_REPORT, location, label); + url = gnc_html_build_url (URL_TYPE_REPORT, location, label); gnc_main_window_open_report_url (url, NULL); g_free (url);