When iterating Hash hash with Iterator ki, use ki.item instead of

Getattr(hash, ki.key).
[Patch recommit]


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9113 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2006-05-14 19:06:45 +00:00
commit 9139e439c9

View file

@ -120,7 +120,6 @@ static const char *php_header =
void void
SwigPHP_emit_resource_registrations() { SwigPHP_emit_resource_registrations() {
DOH *key;
Iterator ki; Iterator ki;
String *destructor=0; String *destructor=0;
String *classname=0; String *classname=0;
@ -131,9 +130,9 @@ SwigPHP_emit_resource_registrations() {
ki = First(zend_types); ki = First(zend_types);
if (ki.key) Printf(s_oinit,"\n/* Register resource destructors for pointer types */\n"); if (ki.key) Printf(s_oinit,"\n/* Register resource destructors for pointer types */\n");
while (ki.key) if (1 /* is pointer type*/) { while (ki.key) if (1 /* is pointer type*/) {
key = ki.key; DOH *key = ki.key;
Node *class_node; Node *class_node = ki.item;
if ((class_node=Getattr(zend_types,key))) {
// Write out destructor function header // Write out destructor function header
Printf(s_wrappers,"/* NEW Destructor style */\nstatic ZEND_RSRC_DTOR_FUNC(_wrap_destroy%s) {\n",key); Printf(s_wrappers,"/* NEW Destructor style */\nstatic ZEND_RSRC_DTOR_FUNC(_wrap_destroy%s) {\n",key);
@ -168,7 +167,7 @@ SwigPHP_emit_resource_registrations() {
// store php type in class struct // store php type in class struct
Printf(s_oinit,"SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n", Printf(s_oinit,"SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n",
key,key); key,key);
}
ki = Next(ki); ki = Next(ki);
} }
} }
@ -306,6 +305,7 @@ public:
Printf(f_make, "\t$(CXX) $(EXTRA_INC) $(PHP_INC) $(CFLAGS) -c $<\n"); Printf(f_make, "\t$(CXX) $(EXTRA_INC) $(PHP_INC) $(CFLAGS) -c $<\n");
Printf(f_make, "%%.o: %%.c\n"); Printf(f_make, "%%.o: %%.c\n");
Printf(f_make, "\t$(CC) $(EXTRA_INC) $(PHP_INC) $(CFLAGS) -c $<\n"); Printf(f_make, "\t$(CC) $(EXTRA_INC) $(PHP_INC) $(CFLAGS) -c $<\n");
Close(f_make); Close(f_make);
} }
@ -352,7 +352,6 @@ public:
Printf(f_extra,"LTLIBRARY_SOURCES = %s\n", withc ); Printf(f_extra,"LTLIBRARY_SOURCES = %s\n", withc );
Printf(f_extra,"LTLIBRARY_SOURCES_CPP = %s %s\n", Swig_file_filename(outfile),withcxx); Printf(f_extra,"LTLIBRARY_SOURCES_CPP = %s %s\n", Swig_file_filename(outfile),withcxx);
Printf(f_extra,"LTLIBRARY_OBJECTS_X = $(LTLIBRARY_SOURCES_CPP:.cpp=.lo) $(LTLIBRARY_SOURCES_CPP:.cxx=.lo)\n"); Printf(f_extra,"LTLIBRARY_OBJECTS_X = $(LTLIBRARY_SOURCES_CPP:.cpp=.lo) $(LTLIBRARY_SOURCES_CPP:.cxx=.lo)\n");
} }
Printf(f_extra,"LTLIBRARY_SHARED_NAME = php_%s.la\n", module); Printf(f_extra,"LTLIBRARY_SHARED_NAME = php_%s.la\n", module);
Printf(f_extra,"LTLIBRARY_SHARED_LIBADD = $(%s_SHARED_LIBADD)\n\n", cap_module); Printf(f_extra,"LTLIBRARY_SHARED_LIBADD = $(%s_SHARED_LIBADD)\n\n", cap_module);
@ -593,7 +592,6 @@ public:
Printf(f_phpcode," if (!dl(\"%s\")) return;\n", dlname); Printf(f_phpcode," if (!dl(\"%s\")) return;\n", dlname);
Printf(f_phpcode,"}\n\n"); Printf(f_phpcode,"}\n\n");
/* sub-sections of the php file */ /* sub-sections of the php file */
pragma_code = NewString(""); pragma_code = NewString("");
pragma_incl = NewString(""); pragma_incl = NewString("");
@ -1526,7 +1524,7 @@ public:
if (scount++) { if (scount++) {
Printf(s_propset," else"); Printf(s_propset," else");
} }
Printf(s_propset," if (strcmp(propname,\"%s\")==0) {\n",Getattr(shadow_set_vars,key) ); Printf(s_propset," if (strcmp(propname,\"%s\")==0) {\n", ki.item);
Printf(s_propset," return _wrap_%s(property_reference, value);\n",key); Printf(s_propset," return _wrap_%s(property_reference, value);\n",key);
Printf(s_propset," }"); Printf(s_propset," }");
@ -1616,7 +1614,7 @@ public:
if (gcount++) { if (gcount++) {
Printf(s_propget," else"); Printf(s_propget," else");
} }
Printf(s_propget," if (strcmp(propname,\"%s\")==0) {\n",Getattr(shadow_get_vars,key)); Printf(s_propget," if (strcmp(propname,\"%s\")==0) {\n", ki.item);
Printf(s_propget," *value=_wrap_%s(property_reference);\n",key); Printf(s_propget," *value=_wrap_%s(property_reference);\n",key);
Printf(s_propget," return SUCCESS;\n"); Printf(s_propget," return SUCCESS;\n");
Printf(s_propget," }"); Printf(s_propget," }");