From 38627eac3f33e461a3c73478f464f2c7eb552c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6ppe?= Date: Wed, 18 Jun 2003 13:18:01 +0000 Subject: [PATCH] (tmop_name): Fix for the case of a String *op. This fixes the Guile testcase pointer_in_out (and others). git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4913 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Swig/typemap.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/SWIG/Source/Swig/typemap.c b/SWIG/Source/Swig/typemap.c index 7f313eb32..0114d408f 100644 --- a/SWIG/Source/Swig/typemap.c +++ b/SWIG/Source/Swig/typemap.c @@ -59,11 +59,24 @@ void Swig_typemap_init() { static String *tmop_name(const String_or_char *op) { static Hash *names = 0; String *s; + /* Due to "interesting" object-identity semantics of DOH, + we have to make sure that we only intern strings without object + identity into the hash table. + + (Swig_typemap_attach_kwargs calls tmop_name several times with + the "same" String *op (i.e., same object identity) but differing + string values.) + + Most other callers work around this by using char* rather than + String *. + -- mkoeppe, Jun 17, 2003 + */ + const char *op_without_object_identity = Char(op); if (!names) names = NewHash(); - s = Getattr(names,op); + s = Getattr(names, op_without_object_identity); if (s) return s; s = NewStringf("tmap:%s",op); - Setattr(names,op,s); + Setattr(names,op_without_object_identity,s); return s; }