Skip to content

Commit

Permalink
Cast const char* args from guile to char*.
Browse files Browse the repository at this point in the history
Swig's guile typemaps lack a const char* freearg typemap. When a function
argument is explicitly const char* Swig automatically discards the const
in the temporary's decl so freeing it isn't a problem, but if the function
arg is declared as something typedeffed to const char* the alias is used
in the temporary's decl causing an error about discarding the const
qualifier when it's time to free the temporary. Providing a const char*
freearg typemap works around the shortcoming.
  • Loading branch information
jralls committed Aug 1, 2021
1 parent e484160 commit ae73b38
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gnucash/html/gnc-html.i
Expand Up @@ -34,6 +34,9 @@
#include <gnc-html.h>
%}
#if defined(SWIGGUILE)

%typemap (freearg) const char* "if (must_free$argnum && $1) SWIG_free((char*)$1);";

%{
#include "guile-mappings.h"

Expand Down

0 comments on commit ae73b38

Please sign in to comment.