diff options
Diffstat (limited to 'Lib/guile/std_string.i')
-rw-r--r-- | Lib/guile/std_string.i | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Lib/guile/std_string.i b/Lib/guile/std_string.i index 6513173ee..178c484ce 100644 --- a/Lib/guile/std_string.i +++ b/Lib/guile/std_string.i @@ -30,7 +30,7 @@ namespace std { if (scm_is_string($input)) { tempptr = SWIG_scm2str($input); $1.assign(tempptr); - if (tempptr) SWIG_free(tempptr); + SWIG_free(tempptr); } else { SWIG_exception(SWIG_TypeError, "string expected"); } @@ -40,7 +40,7 @@ namespace std { if (scm_is_string($input)) { tempptr = SWIG_scm2str($input); temp.assign(tempptr); - if (tempptr) SWIG_free(tempptr); + SWIG_free(tempptr); $1 = &temp; } else { SWIG_exception(SWIG_TypeError, "string expected"); @@ -51,7 +51,7 @@ namespace std { if (scm_is_string($input)) { tempptr = SWIG_scm2str($input); $1 = new $*1_ltype(tempptr); - if (tempptr) SWIG_free(tempptr); + SWIG_free(tempptr); } else { SWIG_exception(SWIG_TypeError, "string expected"); } @@ -73,7 +73,7 @@ namespace std { if (scm_is_string($input)) { char *tempptr = SWIG_scm2str($input); $1.assign(tempptr); - if (tempptr) SWIG_free(tempptr); + SWIG_free(tempptr); } else { SWIG_exception(SWIG_TypeError, "string expected"); } @@ -83,4 +83,13 @@ namespace std { $result = SWIG_str02scm($1.c_str()); } + %typemap(throws) string { + scm_throw(scm_from_locale_symbol("swig-exception"), + scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED)); + } + + %typemap(throws) const string & { + scm_throw(scm_from_locale_symbol("swig-exception"), + scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED)); + } } |