Eliminate "found" flag for simpler, clearer code
This commit is contained in:
parent
2a43178021
commit
8fe85e764f
1 changed files with 3 additions and 6 deletions
|
|
@ -55,7 +55,7 @@ SWIGRUNTIME void
|
||||||
SWIG_InitializeModule(void *clientdata) {
|
SWIG_InitializeModule(void *clientdata) {
|
||||||
size_t i;
|
size_t i;
|
||||||
swig_module_info *module_head, *iter;
|
swig_module_info *module_head, *iter;
|
||||||
int found, init;
|
int init;
|
||||||
|
|
||||||
/* check to see if the circular list has been setup, if not, set it up */
|
/* check to see if the circular list has been setup, if not, set it up */
|
||||||
if (swig_module.next==0) {
|
if (swig_module.next==0) {
|
||||||
|
|
@ -76,18 +76,15 @@ SWIG_InitializeModule(void *clientdata) {
|
||||||
SWIG_SetModule(clientdata, &swig_module);
|
SWIG_SetModule(clientdata, &swig_module);
|
||||||
} else {
|
} else {
|
||||||
/* the interpreter has loaded a SWIG module, but has it loaded this one? */
|
/* the interpreter has loaded a SWIG module, but has it loaded this one? */
|
||||||
found=0;
|
|
||||||
iter=module_head;
|
iter=module_head;
|
||||||
do {
|
do {
|
||||||
if (iter==&swig_module) {
|
if (iter==&swig_module) {
|
||||||
found=1;
|
/* Our module is already in the list, so there's nothing more to do. */
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
iter=iter->next;
|
iter=iter->next;
|
||||||
} while (iter!= module_head);
|
} while (iter!= module_head);
|
||||||
|
|
||||||
/* if this module is already in the list, there's nothing more to do. */
|
|
||||||
if (found) return;
|
|
||||||
/* otherwise we must add our module into the list */
|
/* otherwise we must add our module into the list */
|
||||||
swig_module.next = module_head->next;
|
swig_module.next = module_head->next;
|
||||||
module_head->next = &swig_module;
|
module_head->next = &swig_module;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue