aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez>2005-03-14 14:39:01 +0000
committerantirez <antirez>2005-03-14 14:39:01 +0000
commit49b3429ec87fd6d6b26706b9871fe33d076da752 (patch)
tree6095b6a5dc378a83e415e144f605dc79181e23a6
parenta14ede31a66f7e54b326a53ec123e7dd2e2f1dab (diff)
downloadjimtcl-49b3429ec87fd6d6b26706b9871fe33d076da752.zip
jimtcl-49b3429ec87fd6d6b26706b9871fe33d076da752.tar.gz
jimtcl-49b3429ec87fd6d6b26706b9871fe33d076da752.tar.bz2
'iterator' argument modified to 'iter' for C++ STL safety.
-rw-r--r--ChangeLog5
-rw-r--r--jim.c34
-rw-r--r--jim.h4
3 files changed, 24 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 4adc0ae..a077b4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-14 14:11 antirez
+
+ * ChangeLog, jim.c, jim.h: more fixes to allow inclusion of jim.h
+ into C++ programs.
+
2005-03-14 13:20 antirez
* ChangeLog, jim.h: Some change to make jim.h more C++ friendly,
diff --git a/jim.c b/jim.c
index 40ebc13..073d00b 100644
--- a/jim.c
+++ b/jim.c
@@ -1,7 +1,7 @@
/* Jim - A small embeddable Tcl interpreter
* Copyright 2005 Salvatore Sanfilippo <antirez@invece.org>
*
- * $Id: jim.c,v 1.103 2005/03/14 13:11:26 antirez Exp $
+ * $Id: jim.c,v 1.104 2005/03/14 14:39:01 antirez Exp $
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -784,31 +784,31 @@ Jim_HashEntry *Jim_FindHashEntry(Jim_HashTable *ht, const void *key)
Jim_HashTableIterator *Jim_GetHashTableIterator(Jim_HashTable *ht)
{
- Jim_HashTableIterator *iterator = Jim_Alloc(sizeof(*iterator));
+ Jim_HashTableIterator *iter = Jim_Alloc(sizeof(*iter));
- iterator->ht = ht;
- iterator->index = -1;
- iterator->entry = NULL;
- iterator->nextEntry = NULL;
- return iterator;
+ iter->ht = ht;
+ iter->index = -1;
+ iter->entry = NULL;
+ iter->nextEntry = NULL;
+ return iter;
}
-Jim_HashEntry *Jim_NextHashEntry(Jim_HashTableIterator *iterator)
+Jim_HashEntry *Jim_NextHashEntry(Jim_HashTableIterator *iter)
{
while (1) {
- if (iterator->entry == NULL) {
- iterator->index++;
- if (iterator->index >=
- (signed)iterator->ht->size) break;
- iterator->entry = iterator->ht->table[iterator->index];
+ if (iter->entry == NULL) {
+ iter->index++;
+ if (iter->index >=
+ (signed)iter->ht->size) break;
+ iter->entry = iter->ht->table[iter->index];
} else {
- iterator->entry = iterator->nextEntry;
+ iter->entry = iter->nextEntry;
}
- if (iterator->entry) {
+ if (iter->entry) {
/* We need to save the 'next' here, the iterator user
* may delete the entry we are returning. */
- iterator->nextEntry = iterator->entry->next;
- return iterator->entry;
+ iter->nextEntry = iter->entry->next;
+ return iter->entry;
}
}
return NULL;
diff --git a/jim.h b/jim.h
index 7bab289..60ddc15 100644
--- a/jim.h
+++ b/jim.h
@@ -1,7 +1,7 @@
/* Jim - A small embeddable Tcl interpreter
* Copyright 2005 Salvatore Sanfilippo <antirez@invece.org>
*
- * $Id: jim.h,v 1.53 2005/03/14 13:11:26 antirez Exp $
+ * $Id: jim.h,v 1.54 2005/03/14 14:39:01 antirez Exp $
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -545,7 +545,7 @@ JIM_STATIC int JIM_API(Jim_ResizeHashTable) (Jim_HashTable *ht);
JIM_STATIC Jim_HashTableIterator *JIM_API(Jim_GetHashTableIterator)
(Jim_HashTable *ht);
JIM_STATIC Jim_HashEntry * JIM_API(Jim_NextHashEntry)
- (Jim_HashTableIterator *iterator);
+ (Jim_HashTableIterator *iter);
/* objects */
JIM_STATIC Jim_Obj * JIM_API(Jim_NewObj) (Jim_Interp *interp);