diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2015-08-12 11:07:34 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2015-08-12 11:08:22 +0100 |
commit | 971c951dea4bcaf53fa231716644a423465e0c36 (patch) | |
tree | 5a9effa4a34a94ca96c5d05f6f0b63bc65b637ce | |
parent | 4a1c7aad1a9f5d58409454908c8a35f628827ce2 (diff) |
trace: Avoid deep if-then-else control flow.
Otherwise it will hit MSVC limits.
-rw-r--r-- | wrappers/trace.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/wrappers/trace.py b/wrappers/trace.py index 91144541..ad48ee3e 100644 --- a/wrappers/trace.py +++ b/wrappers/trace.py @@ -793,16 +793,12 @@ class Tracer: print r' return;' print r' }' print r' }' - else_ = '' for childIface in getInterfaceHierarchy(ifaces, iface): - print r' %sif (hasChildInterface(IID_%s, pObj)) {' % (else_, childIface.name) - print r' pObj = Wrap%s::_create(entryName, static_cast<%s *>(pObj));' % (childIface.name, childIface.name) + print r' if (hasChildInterface(IID_%s, pObj)) {' % (childIface.name,) + print r' *ppObj = Wrap%s::_create(entryName, static_cast<%s *>(pObj));' % (childIface.name, childIface.name) + print r' return;' print r' }' - else_ = 'else ' - print r' %s{' % else_ - print r' pObj = Wrap%s::_create(entryName, pObj);' % iface.name - print r' }' - print r' *ppObj = pObj;' + print r' *ppObj = Wrap%s::_create(entryName, pObj);' % iface.name print r'}' print @@ -919,15 +915,12 @@ class Tracer: print r' if (!ppvObj || !*ppvObj) {' print r' return;' print r' }' - else_ = '' for iface in ifaces: - print r' %sif (riid == IID_%s) {' % (else_, iface.name) + print r' if (riid == IID_%s) {' % (iface.name,) print r' Wrap%s::_wrap(entryName, (%s **) ppvObj);' % (iface.name, iface.name) + print r' return;' print r' }' - else_ = 'else ' - print r' %s{' % else_ - print r' warnIID(entryName, riid, *ppvObj, "unknown");' - print r' }' + print r' warnIID(entryName, riid, *ppvObj, "unknown");' print r'}' print |