aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez>2006-11-06 21:48:57 +0000
committerantirez <antirez>2006-11-06 21:48:57 +0000
commite5ba64de6c1cc81beb43eb3ad302f649017af045 (patch)
treefa2a01db92352b2006c8823322c4f74879648f5c
parent5db91be426c94058b31b419b5028b1b643f52ebe (diff)
downloadjimtcl-e5ba64de6c1cc81beb43eb3ad302f649017af045.zip
jimtcl-e5ba64de6c1cc81beb43eb3ad302f649017af045.tar.gz
jimtcl-e5ba64de6c1cc81beb43eb3ad302f649017af045.tar.bz2
Fixed a bug with proc lookup caching. Now the proc epoch is updated when a
procedure having the same name of an old one is created, as this will drop the old and create the new invalidating the cached proc lookups.
-rw-r--r--ChangeLog8
-rw-r--r--jim.c19
2 files changed, 21 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index abd80fb..04bb82f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-11-06 21:29 antirez
+
+ * ChangeLog, jim.c, jim.h: Jim_GetStdin/out/err API removed, now
+ Jim-SetStdin/out/err returns the old value if called with NULL.
+ JIM_NL define introduced in order to force Jim to output CRLF
+ instead of just LF in the core output printf/fwrite calls. This
+ appears to be useful in some kind of terminal under eCos.
+
2006-11-06 17:54 antirez
* jim-aio.c: Jim-aio is now able to be statically linked with jim.c
diff --git a/jim.c b/jim.c
index 31be1e5..be987c9 100644
--- a/jim.c
+++ b/jim.c
@@ -2,7 +2,7 @@
* Copyright 2005 Salvatore Sanfilippo <antirez@invece.org>
* Copyright 2005 Clemens Hintze <c.hintze@gmx.net>
*
- * $Id: jim.c,v 1.169 2006/11/06 20:29:15 antirez Exp $
+ * $Id: jim.c,v 1.170 2006/11/06 21:48:57 antirez Exp $
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -2925,11 +2925,18 @@ int Jim_CreateProcedure(Jim_Interp *interp, const char *cmdName,
}
/* Add the new command */
- Jim_DeleteHashEntry(&interp->commands, cmdName); /* it may already exist */
+
+ /* it may already exist, so we try to delete the old one */
+ if (Jim_DeleteHashEntry(&interp->commands, cmdName) != JIM_ERR) {
+ /* There was an old procedure with the same name, this requires
+ * a 'proc epoch' update. */
+ Jim_InterpIncrProcEpoch(interp);
+ }
+ /* If a procedure with the same name didn't existed there is no need
+ * to increment the 'proc epoch' because creation of a new procedure
+ * can never affect existing cached commands. We don't do
+ * negative caching. */
Jim_AddHashEntry(&interp->commands, cmdName, cmdPtr);
- /* There is no need to increment the 'proc epoch' because
- * creation of a new procedure can never affect existing
- * cached commands. We don't do negative caching. */
return JIM_OK;
err:
@@ -11741,7 +11748,7 @@ int Jim_InteractivePrompt(Jim_Interp *interp)
"Copyright (c) 2005 Salvatore Sanfilippo" JIM_NL,
JIM_VERSION / 100, JIM_VERSION % 100);
fprintf(interp->stdout,
- "CVS ID: $Id: jim.c,v 1.169 2006/11/06 20:29:15 antirez Exp $"
+ "CVS ID: $Id: jim.c,v 1.170 2006/11/06 21:48:57 antirez Exp $"
JIM_NL);
Jim_SetVariableStrWithStr(interp, "jim_interactive", "1");
while (1) {